3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2011 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
15 include_spip('inc/agenda'); // inclut inc/layer, inc/texte, inc/filtre
16 include_spip('inc/boutons');
17 include_spip('inc/actions');
18 include_spip('inc/puce_statut');
20 define('_ACTIVER_PUCE_RAPIDE', true);
21 define('_SIGNALER_ECHOS', true);
22 define('_INTERFACE_ONGLETS', false);
24 // http://doc.spip.org/@echo_log
25 function echo_log($f, $ret) {
26 spip_log("Page " . self() . " function $f: echo ".substr($ret,0,50)."...",'echo');
28 (_SIGNALER_ECHOS?
"#Echo par $f#" :"")
31 // Faux HR, avec controle de couleur
33 // http://doc.spip.org/@hr
34 function hr($color, $retour = false) {
35 $ret = "\n<div style='height: 1px; margin-top: 5px; padding-top: 5px; border-top: 1px solid $color;'></div>";
37 if ($retour) return $ret; else echo_log('hr',$ret);
43 // http://doc.spip.org/@afficher_onglets_pages
44 function afficher_onglets_pages($ordre,$onglets){
45 static $onglet_compteur = 0;
51 foreach($ordre as $id => $label) {
53 $disabled = strlen(trim($onglets[$id]))?
"":" class='tabs-disabled'";
54 if (!$actif && !$disabled) $actif = $cpt;
55 $res .= "<li$disabled><a rel='$cpt' href='#$id'><span>" . $label . "</span></a></li>";
57 $res = "<ul class='tabs-nav'>$res</ul>";
58 foreach((_INTERFACE_ONGLETS ?
array_keys($ordre):array_keys($onglets)) as $id){
59 $res .= "<div id='$id' class='tabs-container'>" . $onglets[$id] . "<div class='nettoyeur'></div></div>";
62 return "<div class='boite_onglets' id='boite_onglet_$onglet_compteur'>$res</div>"
63 . (_INTERFACE_ONGLETS ?
64 http_script("$('#boite_onglet_$onglet_compteur').tabs(".($actif?
"$actif,":"")."{ fxAutoHeight: true });
65 if (!$.browser.safari)
66 $('ul.tabs-nav li').hover(
68 \$('#boite_onglet_$onglet_compteur').triggerTab(parseInt(\$(this).attr('rel')));
77 // http://doc.spip.org/@debut_cadre
78 function debut_cadre($style, $icone = "", $fonction = "", $titre = "", $id="", $class="", $padding=true) {
79 global $spip_display, $spip_lang_left;
80 static $accesskey = 97; // a
82 //zoom:1 fixes all expanding blocks in IE, see authors block in articles.php
83 //being not standard, next step can be putting this kind of hacks in a different stylesheet
84 //visible to IE only using conditional comments.
86 $style_cadre = " style='";
87 if ($spip_display != 1 AND $spip_display != 4 AND strlen($icone) > 1) {
88 $style_gauche = "padding-$spip_lang_left: 38px;";
95 // accesskey pour accessibilite espace prive
96 if ($accesskey <= 122) // z
98 $accesskey_c = chr($accesskey++
);
99 $ret = "<a id='access-$accesskey_c' href='#access-$accesskey_c' accesskey='$accesskey_c'></a>";
103 . ($id?
"id='$id' ":"")
104 ."class='cadre cadre-$style"
105 . ($class?
" $class":"")
108 if ($spip_display != 1 AND $spip_display != 4 AND strlen($icone) > 1) {
111 $ret .= http_img_pack("$fonction", "", " class='cadre-icone' ".http_style_background($icone, "no-repeat; padding: 0px; margin: 0px"));
113 else $ret .= http_img_pack("$icone", "", " class='cadre-icone'");
116 if (strlen($titre) > 0) {
117 if (strpos($titre,'titrem')!==false) {
119 } elseif ($spip_display == 4) {
120 $ret .= "\n<h3 class='cadre-titre'>$titre</h3>";
122 $ret .= bouton_block_depliable($titre,-1);
126 $ret .= "<div". ($padding ?
" class='cadre_padding'" : '') .">";
131 // http://doc.spip.org/@fin_cadre
132 function fin_cadre($style='') {
134 $ret = "<div class='nettoyeur'></div></div>".
137 /*if ($style != "forum" AND $style != "thread-forum")
138 $ret .= "<div style='height: 5px;'></div>\n";*/
144 // http://doc.spip.org/@debut_cadre_relief
145 function debut_cadre_relief($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
146 $retour_aff = debut_cadre('r', $icone, $fonction, $titre, $id, $class);
148 if ($return) return $retour_aff; else echo($retour_aff);
151 // http://doc.spip.org/@fin_cadre_relief
152 function fin_cadre_relief($return = false){
153 $retour_aff = fin_cadre('r');
155 if ($return) return $retour_aff; else echo($retour_aff);
159 // http://doc.spip.org/@debut_cadre_enfonce
160 function debut_cadre_enfonce($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
161 $retour_aff = debut_cadre('e', $icone, $fonction, $titre, $id, $class);
163 if ($return) return $retour_aff; else echo($retour_aff);
166 // http://doc.spip.org/@fin_cadre_enfonce
167 function fin_cadre_enfonce($return = false){
169 $retour_aff = fin_cadre('e');
171 if ($return) return $retour_aff; else echo_log('fin_cadre_enfonce',$retour_aff);
175 // http://doc.spip.org/@debut_cadre_sous_rub
176 function debut_cadre_sous_rub($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
177 $retour_aff = debut_cadre('sous_rub', $icone, $fonction, $titre, $id, $class);
178 if ($return) return $retour_aff; else echo_log('debut_cadre_sous_rub',$retour_aff);
181 // http://doc.spip.org/@fin_cadre_sous_rub
182 function fin_cadre_sous_rub($return = false){
183 $retour_aff = fin_cadre('sous_rub');
184 if ($return) return $retour_aff; else echo_log('fin_cadre_sous_rub',$retour_aff);
189 // http://doc.spip.org/@debut_cadre_forum
190 function debut_cadre_forum($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
191 $retour_aff = debut_cadre('forum', $icone, $fonction, $titre, $id, $class);
193 if ($return) return $retour_aff; else echo_log('debut_cadre_forum',$retour_aff);
196 // http://doc.spip.org/@fin_cadre_forum
197 function fin_cadre_forum($return = false){
198 $retour_aff = fin_cadre('forum');
200 if ($return) return $retour_aff; else echo_log('fin_cadre_forum',$retour_aff);
203 // http://doc.spip.org/@debut_cadre_thread_forum
204 function debut_cadre_thread_forum($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
205 $retour_aff = debut_cadre('thread-forum', $icone, $fonction, $titre, $id, $class);
207 if ($return) return $retour_aff; else echo_log('debut_cadre_thread_forum',$retour_aff);
210 // http://doc.spip.org/@fin_cadre_thread_forum
211 function fin_cadre_thread_forum($return = false){
212 $retour_aff = fin_cadre('thread-forum');
214 if ($return) return $retour_aff; else echo_log('fin_cadre_thread_forum',$retour_aff);
218 // http://doc.spip.org/@debut_cadre_couleur
219 function debut_cadre_couleur($icone='', $return = false, $fonction='', $titre='', $id="", $class=""){
220 $retour_aff = debut_cadre('couleur', $icone, $fonction, $titre, $id, $class);
222 if ($return) return $retour_aff; else echo_log('debut_cadre_couleur',$retour_aff);
225 // http://doc.spip.org/@fin_cadre_couleur
226 function fin_cadre_couleur($return = false){
227 $retour_aff = fin_cadre('couleur');
229 if ($return) return $retour_aff; else echo_log('fin_cadre_couleur',$retour_aff);
233 // http://doc.spip.org/@debut_cadre_couleur_foncee
234 function debut_cadre_couleur_foncee($icone='', $return = false, $fonction='', $titre='', $id="", $class=""){
235 $retour_aff = debut_cadre('couleur-foncee', $icone, $fonction, $titre, $id, $class);
237 if ($return) return $retour_aff; else echo_log('debut_cadre_couleur_foncee',$retour_aff);
240 // http://doc.spip.org/@fin_cadre_couleur_foncee
241 function fin_cadre_couleur_foncee($return = false){
242 $retour_aff = fin_cadre('couleur-foncee');
244 if ($return) return $retour_aff; else echo_log('fin_cadre_couleur_foncee',$retour_aff);
247 // http://doc.spip.org/@debut_cadre_trait_couleur
248 function debut_cadre_trait_couleur($icone='', $return = false, $fonction='', $titre='', $id="", $class=""){
249 $retour_aff = debut_cadre('trait-couleur', $icone, $fonction, $titre, $id, $class);
250 if ($return) return $retour_aff; else echo_log('debut_cadre_trait_couleur',$retour_aff);
253 // http://doc.spip.org/@fin_cadre_trait_couleur
254 function fin_cadre_trait_couleur($return = false){
255 $retour_aff = fin_cadre('trait-couleur');
257 if ($return) return $retour_aff; else echo_log('fin_cadre_trait_couleur',$retour_aff);
264 // http://doc.spip.org/@debut_boite_alerte
265 function debut_boite_alerte() {
266 return debut_cadre('alerte', '', '', '', '', '');
269 // http://doc.spip.org/@fin_boite_alerte
270 function fin_boite_alerte() {
271 return fin_cadre('alerte');
278 // http://doc.spip.org/@debut_boite_info
279 function debut_boite_info($return=false) {
280 $r = debut_cadre('info', '', '', '', '', 'verdana1');
281 if ($return) return $r; else echo_log('debut_boite_info',$r);
284 // http://doc.spip.org/@fin_boite_info
285 function fin_boite_info($return=false) {
286 $r = fin_cadre('info');
287 if ($return) return $r; else echo_log('fin_boite_info',$r);
292 // La boite des raccourcis
293 // Se place a droite si l'ecran est en mode panoramique.
295 // http://doc.spip.org/@bloc_des_raccourcis
296 function bloc_des_raccourcis($bloc) {
297 global $spip_display;
300 . creer_colonne_droite('',true)
301 . debut_cadre_enfonce('',true)
302 . (($spip_display != 4)
303 ?
("\n<div style='font-size: x-small' class='verdana1'><b>"
304 ._T('titre_cadre_raccourcis')
306 : ( "<h3>"._T('titre_cadre_raccourcis')."</h3><ul>"))
308 . (($spip_display != 4) ?
"</div>" : "</ul>")
309 . fin_cadre_enfonce(true);
312 // Afficher un petit "+" pour lien vers autre page
314 // http://doc.spip.org/@afficher_plus
315 function afficher_plus($lien) {
316 global $spip_lang_right, $spip_display;
318 if ($spip_display != 4) {
319 return "\n<a href='$lien' style='float:$spip_lang_right; padding-right: 10px;'>" .
320 http_img_pack("plus.gif", "+", "") ."</a>";
325 // Fonctions d'affichage
328 // http://doc.spip.org/@afficher_objets
329 function afficher_objets($type, $titre_table,$requete,$formater='',$force=false){
330 $afficher_objets = charger_fonction('afficher_objets','inc');
331 return $afficher_objets($type, $titre_table,$requete,$formater,$force);
334 // http://doc.spip.org/@navigation_pagination
335 function navigation_pagination($num_rows, $nb_aff=10, $href=null, $debut, $tmp_var=null, $on='') {
338 $self = parametre_url(self(), 'date', '');
339 $deb_aff = intval($debut);
341 for ($i = 0; $i < $num_rows; $i +
= $nb_aff){
344 // Pagination : si on est trop loin, on met des '...'
345 if (abs($deb-$deb_aff)>101) {
347 if (!isset($premiere)) {
348 $premiere = '0 ... ';
352 $derniere = ' | ... '.$num_rows;
359 if ($fin > $num_rows)
364 if ($deb_aff +
1 >= $deb AND $deb_aff +
1 <= $fin) {
365 $texte .= "<b>$deb</b>";
368 $script = parametre_url($self, $tmp_var, $deb-1);
369 if ($on) $on = generer_onclic_ajax($href, $tmp_var, $deb-1);
370 $texte .= "<a href=\"$script\"$on>$deb</a>";
378 // http://doc.spip.org/@generer_onclic_ajax
379 function generer_onclic_ajax($url, $idom, $val)
381 return "\nonclick=\"return charger_id_url('"
382 . parametre_url($url, $idom, $val)
388 // http://doc.spip.org/@avoir_visiteurs
389 function avoir_visiteurs($past=false, $accepter=true) {
390 if ($GLOBALS['meta']["forums_publics"] == 'abo') return true;
391 if ($accepter AND $GLOBALS['meta']["accepter_visiteurs"] <> 'non') return true;
392 if (sql_countsel('spip_articles', "accepter_forum='abo'"))return true;
393 if (!$past) return false;
394 return sql_countsel('spip_auteurs', "statut NOT IN ('0minirezo','1comite', 'nouveau', '5poubelle')");
398 // http://doc.spip.org/@forum_logo
399 function forum_logo($statut)
401 if ($statut == "prive") return "forum-interne-24.gif";
402 else if ($statut == "privadm") return "forum-admin-24.gif";
403 else if ($statut == "privrac") return "forum-interne-24.gif";
404 else return "forum-public-24.gif";
408 // Retourne les parametres de personnalisation css de l'espace prive
409 // (ltr et couleurs) ce qui permet une ecriture comme :
410 // generer_url_public('style_prive', parametres_css_prive())
411 // qu'il est alors possible de recuperer dans le squelette style_prive.html avec
412 // #SET{claire,##ENV{couleur_claire,edf3fe}}
413 // #SET{foncee,##ENV{couleur_foncee,3874b0}}
414 // #SET{left,#ENV{ltr}|choixsiegal{left,left,right}}
415 // #SET{right,#ENV{ltr}|choixsiegal{left,right,left}}
416 // http://doc.spip.org/@parametres_css_prive
417 function parametres_css_prive(){
418 global $visiteur_session;
419 global $browser_name, $browser_version;
422 include_spip('inc/layer');
423 if ($browser_name=='MSIE')
424 $ie = "&ie=$browser_version";
426 $v = "&v=".$GLOBALS['spip_version_code'];
428 $p = "&p=".substr(md5($GLOBALS['meta']['plugin']),0,4);
430 $c = (is_array($visiteur_session)
431 AND is_array($visiteur_session['prefs']))
432 ?
$visiteur_session['prefs']['couleur']
435 $couleurs = charger_fonction('couleurs', 'inc');
436 return 'ltr=' . $GLOBALS['spip_lang_left'] . '&'. $couleurs($c) . $v . $p . $ie ;
440 // http://doc.spip.org/@envoi_link
441 function envoi_link($nom_site_spip, $minipres=false) {
442 global $spip_display, $spip_lang;
444 $paramcss = parametres_css_prive();
446 // CSS de secours en cas de non fonct de la suivante
447 $res = '<link rel="stylesheet" type="text/css" href="'
448 . url_absolue(find_in_path('style_prive_defaut.css'))
449 . '" id="cssprivee" />' . "\n"
452 . (($GLOBALS['meta']['messagerie_agenda'] != 'non')
453 ?
'<link rel="stylesheet" type="text/css" href="'
454 . url_absolue(find_in_path('agenda.css')) .'" />' . "\n"
457 // CSS imprimante (masque des trucs, a completer)
458 . '<link rel="stylesheet" type="text/css" href="'
459 . url_absolue(find_in_path('spip_style.css'))
460 . '" media="all" />' . "\n"
462 // CSS imprimante (masque des trucs, a completer)
463 . '<link rel="stylesheet" type="text/css" href="'
464 . url_absolue(find_in_path('spip_style_print.css'))
465 . '" media="print" />' . "\n"
467 // CSS "visible au chargement" differente selon js actif ou non
469 . '<link rel="stylesheet" type="text/css" href="'
470 . url_absolue(find_in_path('spip_style_'
471 . (_SPIP_AJAX ?
'invisible' : 'visible')
475 // CSS espace prive : la vraie
476 . '<link rel="stylesheet" type="text/css" href="'
477 . generer_url_public('style_prive', $paramcss) .'" />' . "\n"
478 . "<!--[if lt IE 8]>\n"
479 . '<link rel="stylesheet" type="text/css" href="'
480 . generer_url_public('style_prive_ie', $paramcss) .'" />' . "\n"
483 // CSS optionelle minipres
484 . ($minipres?
'<link rel="stylesheet" type="text/css" href="'
485 . url_absolue(find_in_path('minipres.css')).'" />' . "\n":"");
487 $favicon = find_in_path('spip.ico');
490 $res .= '<link rel="shortcut icon" href="'
491 . url_absolue($favicon)
492 . "\" type='image/x-icon' />\n";
494 $js = debut_javascript();
496 if ($spip_display == 4) return $res . $js;
498 $nom = entites_html($nom_site_spip);
500 $res .= "<link rel='alternate' type='application/rss+xml' title=\"$nom\" href='"
501 . generer_url_public('backend') . "' />\n";
502 $res .= "<link rel='help' type='text/html' title=\""._T('icone_aide_ligne') .
504 . generer_url_ecrire('aide_index',"var_lang=$spip_lang")
506 if ($GLOBALS['meta']["activer_breves"] != "non")
507 $res .= "<link rel='alternate' type='application/rss+xml' title=\""
509 . " ("._T("info_breves_03")
510 . ")\" href='" . generer_url_public('backend-breves') . "' />\n";
515 // http://doc.spip.org/@debut_javascript
516 function debut_javascript()
518 global $spip_lang_left, $browser_name, $browser_version;
519 include_spip('inc/charsets');
521 // tester les capacites JS :
523 // On envoie un script ajah ; si le script reussit le cookie passera a +1
524 // on installe egalement un <noscript></noscript> qui charge une image qui
525 // pose un cookie valant -1
527 $testeur = str_replace('&', '\\x26', generer_url_ecrire('test_ajax', 'js=1'));
529 if (_SPIP_AJAX
AND !defined('_TESTER_NOSCRIPT')) {
530 // pour le pied de page (deja defini si on est validation XML)
531 define('_TESTER_NOSCRIPT',
532 "<noscript>\n<div style='display:none;'><img src='"
533 . generer_url_ecrire('test_ajax', 'js=-1')
534 . "' width='1' height='1' alt='' /></div></noscript>\n");
537 if (!defined('_LARGEUR_ICONES_BANDEAU'))
538 include_spip('inc/bandeau');
540 // envoi le fichier JS de config si browser ok.
541 $GLOBALS['browser_layer'] .
543 ((isset($_COOKIE['spip_accepte_ajax']) && $_COOKIE['spip_accepte_ajax'] >= 1)
545 : "jQuery.ajax({'url':'$testeur'});") .
546 (_OUTILS_DEVELOPPEURS ?
"var _OUTILS_DEVELOPPEURS=true;":"") .
547 "\nvar ajax_image_searching = \n'<img src=\"".url_absolue(chemin_image("searching.gif"))."\" alt=\"\" />';" .
548 "\nvar stat = " . (($GLOBALS['meta']["activer_statistiques"] != 'non') ?
1 : 0) .
549 "\nvar largeur_icone = " .
550 intval(_LARGEUR_ICONES_BANDEAU
) .
551 "\nvar bug_offsetwidth = " .
552 // uniquement affichage ltr: bug Mozilla dans offsetWidth quand ecran inverse!
553 ((($spip_lang_left == "left") &&
554 (($browser_name != "MSIE") ||
555 ($browser_version >= 6))) ?
1 : 0) .
556 "\nvar confirm_changer_statut = '" .
557 unicode_to_javascript(addslashes(html2unicode(_T("confirm_changer_statut")))) .
559 //plugin needed to fix the select showing through the submenus o IE6
560 (($browser_name == "MSIE" && $browser_version <= 6) ?
http_script('', 'bgiframe.js'):'' ) .
561 http_script('', 'presentation.js') .
562 http_script('', 'gadgets.js');
568 // http://doc.spip.org/@debut_onglet
569 function debut_onglet(){
572 \n<div style='padding: 7px;'><table cellpadding='0' cellspacing='0' border='0' class='centered'><tr>
576 // http://doc.spip.org/@fin_onglet
577 function fin_onglet(){
578 return "</tr></table></div>\n";
581 // http://doc.spip.org/@onglet
582 function onglet($texte, $lien, $onglet_ref, $onglet, $icone=""){
583 global $spip_display, $spip_lang_left ;
586 $res .= "\n<div style='position: relative;'>";
587 if ($spip_display != 1) {
588 if (strlen($icone) > 0) {
589 $res .= "\n<div style='z-index: 2; position: absolute; top: 0px; $spip_lang_left: 5px;'>" .
590 http_img_pack("$icone", "", "") . "</div>";
591 $style = " top: 7px; padding-$spip_lang_left: 32px; z-index: 1;";
593 $style = " top: 7px;";
597 if ($onglet != $onglet_ref) {
598 $res .= "\n<div onmouseover=\"changeclass(this, 'onglet_on');\" onmouseout=\"changeclass(this, 'onglet');\" class='onglet' style='position: relative;$style'><a href='$lien'>$texte</a></div>";
601 $res .= "\n<div class='onglet_off' style='position: relative;$style'>$texte</div>";
608 // http://doc.spip.org/@icone
609 function icone($texte, $lien, $fond, $fonction="", $align="", $echo=false){
610 $retour = "<div style='padding-top: 20px;width:100px' class='icone36'>" . icone_inline($texte, $lien, $fond, $fonction, $align) . "</div>";
611 if ($echo) echo_log('icone',$retour); else return $retour;
614 // http://doc.spip.org/@icone_inline
615 function icone_inline($texte, $lien, $fond, $fonction="", $align="", $ajax=false, $javascript=''){
616 global $spip_display;
618 if ($fonction == "supprimer.gif") {
619 $style = 'icone36 danger';
622 if (strlen($fonction) < 3) $fonction = "rien.gif";
624 $style .= " " . substr(basename($fond),0,-4);
626 if ($spip_display == 1){
631 else if ($spip_display == 3){
634 $title = "\ntitle=\"$texte\"";
645 if (preg_match("/-([0-9]{1,3})[.](gif|png)$/i",$fond,$match))
647 if ($spip_display != 1 AND $spip_display != 4){
648 if ($fonction != "rien.gif"){
649 $icone = http_img_pack($fonction, $alt, "$title width='$size' height='$size'\n" .
650 http_style_background($fond, "no-repeat center center"));
653 $icone = http_img_pack($fond, $alt, "$title width='$size' height='$size'");
657 // cas d'ajax_action_auteur: faut defaire le boulot
658 // (il faudrait fusionner avec le cas $javascript)
659 if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i",$lien,$r))
660 list($x,$lien,$atts,$texte)= $r;
663 if ($align && $align!='center') $align = "float: $align; ";
665 $icone = "<a style='$align' class='$style'"
667 . (!$ajax ?
'' : (' onclick=' . ajax_action_declencheur($lien,$ajax)))
673 . (($spip_display == 3) ?
'' : "<span>$texte</span>")
676 if ($align <> 'center') return $icone;
677 $style = " style='text-align:center;'";
678 return "<div$style>$icone</div>";
681 // http://doc.spip.org/@icone_horizontale
682 function icone_horizontale($texte, $lien, $fond = "", $fonction = "", $af = true, $javascript='') {
683 global $spip_display;
686 // cas d'ajax_action_auteur: faut defaire le boulot
687 // (il faudrait fusionner avec le cas $javascript)
688 if (preg_match(",^<a href='([^']*)'([^>]*)>(.*)</a>$,i",$lien,$r))
689 list($x,$lien,$atts,$texte)= $r;
691 $lien = "\nhref='$lien'$atts";
693 if ($spip_display != 4) {
695 if ($spip_display != 1) {
696 $retour .= "\n<table class='cellule-h-table' cellpadding='0' style='vertical-align: middle'>"
697 . "\n<tr><td><a $javascript$lien class='cellule-h'>"
698 . "<span class='cell-i'>" ;
700 $retour .= http_img_pack($fonction, $texte, http_style_background($fond, "center center no-repeat"));
703 $retour .= http_img_pack($fond, $texte, "");
705 $retour .= "</span></a></td>"
706 . "\n<td class='cellule-h-lien'><a $javascript$lien class='cellule-h'>"
708 . "</a></td></tr></table>\n";
711 $retour .= "\n<div><a class='cellule-h-texte' $javascript$lien>$texte</a></div>\n";
713 if ($fonction == "supprimer.gif")
714 $retour = "\n<div class='danger'>$retour</div>";
716 $retour = "\n<li><a$lien>$texte</a></li>";
719 if ($af) echo_log('icone_horizontale',$retour); else return $retour;
722 // http://doc.spip.org/@icone_horizontale_display
723 function icone_horizontale_display($texte, $lien, $fond = "", $fonction = "", $af = true, $js='') {
724 global $spip_display, $spip_lang_left;
725 $img = icone_horizontale($texte, $lien, $fond, $fonction, $af, $js);
726 if ($spip_display != 4)
727 return "<div style='float: $spip_lang_left; width:140px;'>$img</div>\n";
728 else return "<ul>$img</ul>";
731 // Fonction standard pour le pipeline 'boite_infos'
732 // http://doc.spip.org/@f_boite_infos
733 function f_boite_infos($flux) {
734 $args = $flux['args'];
735 $type = $args['type'];
737 $flux['data'] .= recuperer_fond("prive/infos/$type",$args);
742 // http://doc.spip.org/@gros_titre
743 function gros_titre($titre, $ze_logo='', $aff=true){
744 global $spip_display;
746 if ($spip_display != 4) {
747 $res .= $ze_logo.' ';
749 $res .= typo($titre)."</h1>\n";
750 if ($aff) echo_log('gros_titre',$res); else return $res;
755 // Cadre centre (haut de page)
758 // http://doc.spip.org/@debut_grand_cadre
759 function debut_grand_cadre($return=false){
760 $res = "\n<div class='table_page'>\n";
761 if ($return) return $res; else echo_log('debut_grand_cadre',$res);
764 // http://doc.spip.org/@fin_grand_cadre
765 function fin_grand_cadre($return=false){
767 if ($return) return $res; else echo_log('fin_grand_cadre',$res);
772 // http://doc.spip.org/@debut_cadre_formulaire
773 function debut_cadre_formulaire($style='', $return=false){
774 $x = "\n<div class='cadre-formulaire'" .
775 (!$style ?
"" : " style='$style'") .
777 if ($return) return $x; else echo_log('debut_cadre_formulaire',$x);
780 // http://doc.spip.org/@fin_cadre_formulaire
781 function fin_cadre_formulaire($return=false){
782 if ($return) return "</div>\n"; else echo_log('fin_cadre_formulaire', "</div>\n");
786 // http://doc.spip.org/@formulaire_recherche
787 function formulaire_recherche($page, $complement=""){
788 $recherche = _request('recherche');
789 $recherche_aff = entites_html($recherche);
790 if (!strlen($recherche)) {
791 $recherche_aff = _T('info_rechercher');
792 $onfocus = " onfocus=\"this.value='';\"";
793 } else $onfocus = '';
795 $form = '<input type="text" size="10" value="'.$recherche_aff.'" name="recherche" class="recherche" accesskey="r"' . $onfocus . ' />';
796 $form .= "<input type='image' src='" . chemin_image('loupe.png') . "' name='submit' class='submit' alt='"._T('info_rechercher')."' />";
797 return "<div class='spip_recherche'>".generer_form_ecrire($page, $form . $complement, " method='get'")."</div>";
801 // Debut de la colonne de gauche
804 // http://doc.spip.org/@debut_gauche
805 function debut_gauche($rubrique = "accueil", $return=false) {
806 global $spip_display;
807 global $spip_ecran, $spip_lang_rtl, $spip_lang_left;
809 // div navigation fermee par creer_colonne_droite qui ouvre
810 // div extra lui-meme ferme par debut_droite qui ouvre
811 // div contenu lui-meme ferme par fin_gauche() ainsi que
814 $res = "<br /><div id='conteneur' class='".(_INTERFACE_ONGLETS ?
"onglets" : "no_onglets") ."'>
815 \n<div id='navigation'>\n";
817 if ($spip_display == 4) $res .= "<!-- ";
819 if ($return) return $res; else echo_log('debut_gauche',$res);
822 // http://doc.spip.org/@fin_gauche
823 function fin_gauche()
825 return "</div></div><div class='nettoyeur'></div>";
829 // Presentation de l''interface privee, marge de droite
832 // http://doc.spip.org/@creer_colonne_droite
833 function creer_colonne_droite($rubrique="", $return= false){
834 static $deja_colonne_droite;
835 global $spip_ecran, $spip_lang_rtl, $spip_lang_left;
837 if ((!($spip_ecran == "large")) OR $deja_colonne_droite) return '';
838 $deja_colonne_droite = true;
840 $res = "\n</div><div id='extra'>";
842 if ($return) return $res; else echo_log('creer_colonne_droite',$res);
845 // http://doc.spip.org/@formulaire_large
846 function formulaire_large()
848 return isset($_GET['exec'])?
preg_match(',^((articles|breves|rubriques)_edit|poster_forum_prive),', $_GET['exec']):false;
851 // http://doc.spip.org/@debut_droite
852 function debut_droite($rubrique="", $return= false) {
853 global $spip_ecran, $spip_display, $spip_lang_left;
857 if ($spip_display == 4) $res .= " -->";
859 $res .= liste_articles_bloques();
861 $res .= creer_colonne_droite($rubrique, true)
864 $res .= "\n<div id='contenu'>";
866 // touche d'acces rapide au debut du contenu : z
867 // Attention avant c'etait 's' mais c'est incompatible avec
868 // le ctrl-s qui fait "enregistrer"
869 $res .= "\n<a id='saut' href='#saut' accesskey='z'></a>\n";
871 if ($return) return $res; else echo_log('debut_droite',$res);
874 // http://doc.spip.org/@liste_articles_bloques
875 function liste_articles_bloques()
877 global $connect_id_auteur;
880 if ($GLOBALS['meta']["articles_modif"] != "non") {
881 include_spip('inc/drapeau_edition');
882 $articles_ouverts = liste_drapeau_edition ($connect_id_auteur, 'article');
883 if (count($articles_ouverts)) {
885 debut_cadre('bandeau-rubriques',"article-24.gif",'',_T('info_cours_edition'))
886 . "\n<div class='plan-articles-bloques'>";
887 foreach ($articles_ouverts as $row) {
888 $ze_article = $row['id_article'];
889 $ze_titre = $row['titre'];
890 $statut = $row["statut"];
892 $res .= "\n<div class='$statut'>"
893 . "\n<div style='float:right; '>"
894 . debloquer_article($ze_article,_T('lien_liberer'))
897 . generer_url_ecrire("articles","id_article=$ze_article")
902 if (count($articles_ouverts) >= 4) {
903 $res .= "\n<div style='text-align:right; '>"
904 . debloquer_article('tous', _T('lien_liberer_tous'))
907 $res .= fin_cadre('bandeau-rubriques') . "</div>";
914 // Fin de page de l'interface privee.
915 // Elle comporte une image invisible declenchant une tache de fond
917 // http://doc.spip.org/@fin_page
920 global $spip_display;
922 return debut_grand_cadre(true)
923 . (($spip_display == 4)
925 . generer_action_auteur('preferer','display:2', self('&'))
927 . _T("access_interface_graphique")
929 : ("<div style='text-align: right; ' class='verdana1 spip_xx-small'>"
933 . _T('info_copyright_doc',
934 array('spipnet' => $GLOBALS['home_server']
935 . '/' . $GLOBALS['spip_lang']))
938 . fin_grand_cadre(true)
939 . "</div>\n" // cf. div centered ouverte dans conmmencer_page()
940 . $GLOBALS['rejoue_session']
941 . '<div style="background-image: url(\''
942 . generer_url_action('cron')
944 . (defined('_TESTER_NOSCRIPT') ? _TESTER_NOSCRIPT
: '')
945 . "</body></html>\n";
948 function info_maj_spip(){
950 $maj = $GLOBALS['meta']['info_maj_spip'];
954 $maj = explode('|',$maj);
955 // c'est une ancienne notif, on a fait la maj depuis !
956 if ($GLOBALS['spip_version_branche']!==array_shift($maj))
959 if (!autoriser('webmestre'))
962 $maj = implode('|',$maj);
963 if (strncmp($maj,"<a",2)==0) $maj = extraire_attribut ($maj, 'title');
964 $lien = "http://www.spip.net/".$GLOBALS['spip_lang']."_download";
965 $maj = "<a class='info_maj_spip' href='$lien'><strong>" .
966 _T('nouvelle_version_spip',array('version'=>$maj)) .
972 // http://doc.spip.org/@info_copyright
973 function info_copyright() {
974 global $spip_version_affichee, $spip_lang;
976 $version = $spip_version_affichee;
979 // Mention, le cas echeant, de la revision SVN courante
981 if ($svn_revision = version_svn_courante(_DIR_RACINE
)) {
982 $version .= ' ' . (($svn_revision < 0) ?
'SVN ':'')
983 . "[<a href='http://core.spip.org/trac/spip/changeset/"
984 . abs($svn_revision) . "' onclick=\"window.open(this.href); return false;\">"
985 . abs($svn_revision) . "</a>]";
988 return _T('info_copyright',
989 array('spip' => "<b>SPIP $version</b> ",
991 "<a href='". generer_url_ecrire("aide_index", "aide=licence&var_lang=$spip_lang") . "' onclick=\"window.open(this.href, 'spip_aide', 'scrollbars=yes,resizable=yes,width=740,height=580'); return false;\">" . _T('info_copyright_gpl')."</a>"));
995 // http://doc.spip.org/@debloquer_article
996 function debloquer_article($arg, $texte) {
998 // cas d'un article pas liberable : on est sur sa page d'edition
999 if (_request('exec') == 'articles_edit'
1000 AND $arg == _request('id_article'))
1003 $lien = parametre_url(self(), 'debloquer_article', '', '&');
1004 return "<a href='" .
1005 generer_action_auteur('instituer_collaboration', $arg, $lien) .
1007 attribut_html($texte) .
1009 . ($arg == 'tous' ?
"$texte " : '')
1010 . http_img_pack("croix-rouge.gif", ($arg=='tous' ?
"" : "X"),
1011 "width='7' height='7' ") .
1017 // Afficher la hierarchie des rubriques
1020 // http://doc.spip.org/@afficher_hierarchie
1021 function afficher_hierarchie($id_parent, $message='',$id_objet=0,$type='',$id_secteur=0,$restreint='') {
1022 global $spip_lang_left,$spip_lang_right;
1027 # desactiver le selecteur de rubrique sur le chemin
1028 # $nav = chercher_rubrique($message,$id_objet, $id_parent, $type, $id_secteur, $restreint,true);
1029 $nav = $nav ?
"<div class='none'>$nav</div>":"";
1033 $style1 = "$spip_lang_left center no-repeat; padding-$spip_lang_left: 15px";
1034 $style2 = "margin-$spip_lang_left: 15px;";
1038 $id_rubrique = $id_parent;
1039 while ($id_rubrique) {
1041 $res = sql_fetsel("id_parent, titre, lang", "spip_rubriques", "id_rubrique=".intval($id_rubrique));
1043 if (!$res){ // rubrique inexistante
1048 $id_parent = $res['id_parent'];
1049 changer_typo($res['lang']);
1051 $class = (!$id_parent) ?
"secteur"
1052 : (acces_restreint_rubrique($id_rubrique)
1053 ?
"admin" : "rubrique");
1055 $parents = "<ul><li><span class='bloc'><em> > </em><$tag class='$class$on'"
1056 . ($tag=='a'?
" href='". generer_url_ecrire("naviguer","id_rubrique=$id_rubrique")."'":"")
1058 . supprimer_numero(typo(sinon($res['titre'], _T('ecrire:info_sans_titre'))))
1063 $id_rubrique = $id_parent;
1069 . "\n<ul id='chemin' class='verdana3' dir='".lang_dir()."'"
1070 //. http_style_background("racine-site-12.gif", $style1)
1071 . "><li><span class='bloc'><$tag class='racine$on'"
1072 . ($tag=='a'?
" href='". generer_url_ecrire("naviguer","id_rubrique=$id_rubrique")."'":"")
1073 . ">"._T('info_racine_site')."</$tag>"
1079 " <a href='#' onclick=\"$(this).prev().prev().toggle('fast');return false;\" class='verdana2'>"
1080 . _T('bouton_changer') ."</a>"
1083 $out = pipeline('affiche_hierarchie',array('args'=>array(
1084 'id_parent'=>$id_parent,
1085 'message'=>$message,
1086 'id_objet'=>$id_objet,
1088 'id_secteur'=>$id_secteur,
1089 'restreint'=>$restreint),
1095 // Pour construire des menu avec SELECTED
1096 // http://doc.spip.org/@mySel
1097 function mySel($varaut,$variable, $option = NULL) {
1098 $res = ' value="'.$varaut.'"' . (($variable==$varaut) ?
' selected="selected"' : '');
1100 return (!isset($option) ?
$res : "<option$res>$option</option>\n");
1104 // Voir en ligne, ou apercu, ou rien (renvoie tout le bloc)
1105 // http://doc.spip.org/@voir_en_ligne
1106 function voir_en_ligne ($type, $id, $statut=false, $image='racine-24.gif', $af = true, $inline=true) {
1108 $en_ligne = $message = '';
1111 if ($statut == "publie" AND $GLOBALS['meta']["post_dates"] == 'non') {
1112 $n = sql_fetsel("id_article", "spip_articles", "id_article=$id AND date<=".sql_quote(date('Y-m-d H:i:s')));
1113 if (!$n) $statut = 'prop';
1115 if ($statut == 'publie')
1116 $en_ligne = 'calcul';
1117 else if ($statut == 'prop')
1118 $en_ligne = 'preview';
1122 if ($statut == 'publie')
1123 $en_ligne = 'calcul';
1125 $en_ligne = 'preview';
1129 if ($statut == 'publie')
1130 $en_ligne = 'calcul';
1131 else if ($statut == 'prop')
1132 $en_ligne = 'preview';
1135 $en_ligne = 'calcul';
1138 $n = sql_fetsel('A.id_article', 'spip_auteurs_articles AS L LEFT JOIN spip_articles AS A ON L.id_article=A.id_article', "A.statut='publie' AND L.id_auteur=".sql_quote($id));
1139 if ($n) $en_ligne = 'calcul';
1140 else $en_ligne = 'preview';
1145 if ($en_ligne == 'calcul')
1146 $message = _T('icone_voir_en_ligne');
1147 else if ($en_ligne == 'preview'
1148 AND autoriser('previsualiser'))
1149 $message = _T('previsualiser');
1153 $h = generer_url_action('redirect', "type=$type&id=$id&var_mode=$en_ligne");
1156 ?
icone_inline($message, $h, $image, "rien.gif", $GLOBALS['spip_lang_left'])
1157 : icone_horizontale($message, $h, $image, "rien.gif",$af);
1161 // http://doc.spip.org/@bouton_spip_rss
1162 function bouton_spip_rss($op, $args=array(), $lang='') {
1164 global $spip_lang_right;
1165 include_spip('inc/acces');
1166 $clic = http_img_pack('feed.png', 'RSS', '', 'RSS');
1167 $args = param_low_sec($op, $args, $lang, 'rss');
1168 $url = generer_url_public('rss', $args);
1169 return "<a style='float: $spip_lang_right;' href='$url'>$clic</a>";