3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2014 *
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) {
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 // accesskey pour accessibilite espace prive
87 if ($accesskey <= 122) // z
89 $accesskey_c = chr($accesskey++
);
90 $ret = "<a id='access-$accesskey_c' href='#access-$accesskey_c' accesskey='$accesskey_c'></a>";
94 . ($id?
"id='$id' ":"")
95 ."class='cadre cadre-$style"
96 . ($class?
" $class":"")
99 if ($spip_display != 1 AND $spip_display != 4 AND strlen($icone) > 1) {
102 $ret .= http_img_pack("$fonction", "", " class='cadre-icone' ".http_style_background($icone, "no-repeat; padding: 0px; margin: 0px"));
104 else $ret .= http_img_pack("$icone", "", " class='cadre-icone'");
107 if (strlen($titre) > 0) {
108 if (strpos($titre,'titrem')!==false) {
110 } elseif ($spip_display == 4) {
111 $ret .= "\n<h3 class='cadre-titre'>$titre</h3>";
113 $ret .= bouton_block_depliable($titre,-1);
117 $ret .= "<div". ($padding ?
" class='cadre_padding'" : '') .">";
122 // http://doc.spip.org/@fin_cadre
123 function fin_cadre($style='') {
125 $ret = "<div class='nettoyeur'></div></div>".
128 /*if ($style != "forum" AND $style != "thread-forum")
129 $ret .= "<div style='height: 5px;'></div>\n";*/
135 // http://doc.spip.org/@debut_cadre_relief
136 function debut_cadre_relief($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
137 $retour_aff = debut_cadre('r', $icone, $fonction, $titre, $id, $class);
139 if ($return) return $retour_aff; else echo($retour_aff);
142 // http://doc.spip.org/@fin_cadre_relief
143 function fin_cadre_relief($return = false){
144 $retour_aff = fin_cadre('r');
146 if ($return) return $retour_aff; else echo($retour_aff);
150 // http://doc.spip.org/@debut_cadre_enfonce
151 function debut_cadre_enfonce($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
152 $retour_aff = debut_cadre('e', $icone, $fonction, $titre, $id, $class);
154 if ($return) return $retour_aff; else echo($retour_aff);
157 // http://doc.spip.org/@fin_cadre_enfonce
158 function fin_cadre_enfonce($return = false){
160 $retour_aff = fin_cadre('e');
162 if ($return) return $retour_aff; else echo_log('fin_cadre_enfonce',$retour_aff);
166 // http://doc.spip.org/@debut_cadre_sous_rub
167 function debut_cadre_sous_rub($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
168 $retour_aff = debut_cadre('sous_rub', $icone, $fonction, $titre, $id, $class);
169 if ($return) return $retour_aff; else echo_log('debut_cadre_sous_rub',$retour_aff);
172 // http://doc.spip.org/@fin_cadre_sous_rub
173 function fin_cadre_sous_rub($return = false){
174 $retour_aff = fin_cadre('sous_rub');
175 if ($return) return $retour_aff; else echo_log('fin_cadre_sous_rub',$retour_aff);
180 // http://doc.spip.org/@debut_cadre_forum
181 function debut_cadre_forum($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
182 $retour_aff = debut_cadre('forum', $icone, $fonction, $titre, $id, $class);
184 if ($return) return $retour_aff; else echo_log('debut_cadre_forum',$retour_aff);
187 // http://doc.spip.org/@fin_cadre_forum
188 function fin_cadre_forum($return = false){
189 $retour_aff = fin_cadre('forum');
191 if ($return) return $retour_aff; else echo_log('fin_cadre_forum',$retour_aff);
194 // http://doc.spip.org/@debut_cadre_thread_forum
195 function debut_cadre_thread_forum($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
196 $retour_aff = debut_cadre('thread-forum', $icone, $fonction, $titre, $id, $class);
198 if ($return) return $retour_aff; else echo_log('debut_cadre_thread_forum',$retour_aff);
201 // http://doc.spip.org/@fin_cadre_thread_forum
202 function fin_cadre_thread_forum($return = false){
203 $retour_aff = fin_cadre('thread-forum');
205 if ($return) return $retour_aff; else echo_log('fin_cadre_thread_forum',$retour_aff);
209 // http://doc.spip.org/@debut_cadre_couleur
210 function debut_cadre_couleur($icone='', $return = false, $fonction='', $titre='', $id="", $class=""){
211 $retour_aff = debut_cadre('couleur', $icone, $fonction, $titre, $id, $class);
213 if ($return) return $retour_aff; else echo_log('debut_cadre_couleur',$retour_aff);
216 // http://doc.spip.org/@fin_cadre_couleur
217 function fin_cadre_couleur($return = false){
218 $retour_aff = fin_cadre('couleur');
220 if ($return) return $retour_aff; else echo_log('fin_cadre_couleur',$retour_aff);
224 // http://doc.spip.org/@debut_cadre_couleur_foncee
225 function debut_cadre_couleur_foncee($icone='', $return = false, $fonction='', $titre='', $id="", $class=""){
226 $retour_aff = debut_cadre('couleur-foncee', $icone, $fonction, $titre, $id, $class);
228 if ($return) return $retour_aff; else echo_log('debut_cadre_couleur_foncee',$retour_aff);
231 // http://doc.spip.org/@fin_cadre_couleur_foncee
232 function fin_cadre_couleur_foncee($return = false){
233 $retour_aff = fin_cadre('couleur-foncee');
235 if ($return) return $retour_aff; else echo_log('fin_cadre_couleur_foncee',$retour_aff);
238 // http://doc.spip.org/@debut_cadre_trait_couleur
239 function debut_cadre_trait_couleur($icone='', $return = false, $fonction='', $titre='', $id="", $class=""){
240 $retour_aff = debut_cadre('trait-couleur', $icone, $fonction, $titre, $id, $class);
241 if ($return) return $retour_aff; else echo_log('debut_cadre_trait_couleur',$retour_aff);
244 // http://doc.spip.org/@fin_cadre_trait_couleur
245 function fin_cadre_trait_couleur($return = false){
246 $retour_aff = fin_cadre('trait-couleur');
248 if ($return) return $retour_aff; else echo_log('fin_cadre_trait_couleur',$retour_aff);
255 // http://doc.spip.org/@debut_boite_alerte
256 function debut_boite_alerte() {
257 return debut_cadre('alerte', '', '', '', '', '');
260 // http://doc.spip.org/@fin_boite_alerte
261 function fin_boite_alerte() {
262 return fin_cadre('alerte');
269 // http://doc.spip.org/@debut_boite_info
270 function debut_boite_info($return=false) {
271 $r = debut_cadre('info', '', '', '', '', 'verdana1');
272 if ($return) return $r; else echo_log('debut_boite_info',$r);
275 // http://doc.spip.org/@fin_boite_info
276 function fin_boite_info($return=false) {
277 $r = fin_cadre('info');
278 if ($return) return $r; else echo_log('fin_boite_info',$r);
283 // La boite des raccourcis
284 // Se place a droite si l'ecran est en mode panoramique.
286 // http://doc.spip.org/@bloc_des_raccourcis
287 function bloc_des_raccourcis($bloc) {
288 global $spip_display;
291 . creer_colonne_droite('',true)
292 . debut_cadre_enfonce('',true)
293 . (($spip_display != 4)
294 ?
("\n<div style='font-size: x-small' class='verdana1'><b>"
295 ._T('titre_cadre_raccourcis')
297 : ( "<h3>"._T('titre_cadre_raccourcis')."</h3><ul>"))
299 . (($spip_display != 4) ?
"</div>" : "</ul>")
300 . fin_cadre_enfonce(true);
303 // Afficher un petit "+" pour lien vers autre page
305 // http://doc.spip.org/@afficher_plus
306 function afficher_plus($lien) {
307 global $spip_lang_right, $spip_display;
309 if ($spip_display != 4) {
310 return "\n<a href='$lien' style='float:$spip_lang_right; padding-right: 10px;'>" .
311 http_img_pack("plus.gif", "+", "") ."</a>";
316 // Fonctions d'affichage
319 // http://doc.spip.org/@afficher_objets
320 function afficher_objets($type, $titre_table,$requete,$formater='',$force=false){
321 $afficher_objets = charger_fonction('afficher_objets','inc');
322 return $afficher_objets($type, $titre_table,$requete,$formater,$force);
325 // http://doc.spip.org/@navigation_pagination
326 function navigation_pagination($num_rows, $nb_aff=10, $href=null, $debut, $tmp_var=null, $on='') {
329 $self = parametre_url(self(), 'date', '');
330 $deb_aff = intval($debut);
332 for ($i = 0; $i < $num_rows; $i +
= $nb_aff){
335 // Pagination : si on est trop loin, on met des '...'
336 if (abs($deb-$deb_aff)>101) {
338 if (!isset($premiere)) {
339 $premiere = '0 ... ';
343 $derniere = ' | ... '.$num_rows;
350 if ($fin > $num_rows)
355 if ($deb_aff +
1 >= $deb AND $deb_aff +
1 <= $fin) {
356 $texte .= "<b>$deb</b>";
359 $script = parametre_url($self, $tmp_var, $deb-1);
360 if ($on) $on = generer_onclic_ajax($href, $tmp_var, $deb-1);
361 $texte .= "<a href=\"$script\"$on>$deb</a>";
369 // http://doc.spip.org/@generer_onclic_ajax
370 function generer_onclic_ajax($url, $idom, $val)
372 return "\nonclick=\"return charger_id_url('"
373 . parametre_url($url, $idom, $val)
379 // http://doc.spip.org/@avoir_visiteurs
380 function avoir_visiteurs($past=false, $accepter=true) {
381 if ($GLOBALS['meta']["forums_publics"] == 'abo') return true;
382 if ($accepter AND $GLOBALS['meta']["accepter_visiteurs"] <> 'non') return true;
383 if (sql_countsel('spip_articles', "accepter_forum='abo'"))return true;
384 if (!$past) return false;
385 return sql_countsel('spip_auteurs', "statut NOT IN ('0minirezo','1comite', 'nouveau', '5poubelle')");
389 // http://doc.spip.org/@forum_logo
390 function forum_logo($statut)
392 if ($statut == "prive") return "forum-interne-24.gif";
393 else if ($statut == "privadm") return "forum-admin-24.gif";
394 else if ($statut == "privrac") return "forum-interne-24.gif";
395 else return "forum-public-24.gif";
399 // Retourne les parametres de personnalisation css de l'espace prive
400 // (ltr et couleurs) ce qui permet une ecriture comme :
401 // generer_url_public('style_prive', parametres_css_prive())
402 // qu'il est alors possible de recuperer dans le squelette style_prive.html avec
403 // #SET{claire,##ENV{couleur_claire,edf3fe}}
404 // #SET{foncee,##ENV{couleur_foncee,3874b0}}
405 // #SET{left,#ENV{ltr}|choixsiegal{left,left,right}}
406 // #SET{right,#ENV{ltr}|choixsiegal{left,right,left}}
407 // http://doc.spip.org/@parametres_css_prive
408 function parametres_css_prive(){
409 global $visiteur_session;
410 global $browser_name, $browser_version;
413 include_spip('inc/layer');
414 if ($browser_name=='MSIE')
415 $ie = "&ie=$browser_version";
417 $v = "&v=".$GLOBALS['spip_version_code'];
419 $p = "&p=".substr(md5($GLOBALS['meta']['plugin']),0,4);
421 $c = (is_array($visiteur_session)
422 AND is_array($visiteur_session['prefs']))
423 ?
$visiteur_session['prefs']['couleur']
426 $couleurs = charger_fonction('couleurs', 'inc');
427 return 'ltr=' . $GLOBALS['spip_lang_left'] . '&'. $couleurs($c) . $v . $p . $ie ;
431 // http://doc.spip.org/@envoi_link
432 function envoi_link($nom_site_spip, $minipres=false, $js='') {
433 global $spip_display, $spip_lang;
435 $paramcss = parametres_css_prive();
437 // CSS de secours en cas de non fonct de la suivante
438 $res = '<link rel="stylesheet" type="text/css" href="'
439 . url_absolue(find_in_path('prive/style_prive_defaut.css'))
440 . '" id="cssprivee" />' . "\n"
443 . (($GLOBALS['meta']['messagerie_agenda'] != 'non')
444 ?
'<link rel="stylesheet" type="text/css" href="'
445 . url_absolue(find_in_path('agenda.css')) .'" />' . "\n"
448 // CSS des raccourcis
449 . '<link rel="stylesheet" type="text/css" href="'
450 . url_absolue(find_in_path('prive/spip_style.css'))
451 . '" media="all" />' . "\n"
453 // CSS imprimante (masque des trucs, a completer)
454 . '<link rel="stylesheet" type="text/css" href="'
455 . url_absolue(find_in_path('prive/spip_style_print.css'))
456 . '" media="print" />' . "\n"
458 // CSS "visible au chargement" differente selon js actif ou non
460 . '<link rel="stylesheet" type="text/css" href="'
461 . url_absolue(find_in_path('prive/spip_style_'
462 . (_SPIP_AJAX ?
'invisible' : 'visible')
466 // CSS espace prive : la vraie
467 . '<link rel="stylesheet" type="text/css" href="'
468 . generer_url_public('style_prive', $paramcss) .'" />' . "\n"
469 . "<!--[if lt IE 8]>\n"
470 . '<link rel="stylesheet" type="text/css" href="'
471 . generer_url_public('style_prive_ie', $paramcss) .'" />' . "\n"
474 // CSS optionelle minipres
475 . ($minipres?
'<link rel="stylesheet" type="text/css" href="'
476 . url_absolue(find_in_path('prive/minipres.css')).'" />' . "\n":"");
478 $favicon = find_in_path('spip.ico');
481 $res .= '<link rel="shortcut icon" href="'
482 . url_absolue($favicon)
483 . "\" type='image/x-icon' />\n";
485 $js = debut_javascript($js);
487 if ($spip_display == 4) return $res . $js;
489 $nom = entites_html($nom_site_spip);
491 $res .= "<link rel='alternate' type='application/rss+xml' title=\"$nom\" href='"
492 . generer_url_public('backend') . "' />\n";
493 $res .= "<link rel='help' type='text/html' title=\""._T('icone_aide_ligne') .
495 . generer_url_ecrire('aide_index',"var_lang=$spip_lang")
497 if ($GLOBALS['meta']["activer_breves"] != "non")
498 $res .= "<link rel='alternate' type='application/rss+xml' title=\""
500 . " ("._T("info_breves_03")
501 . ")\" href='" . generer_url_public('backend-breves') . "' />\n";
506 // http://doc.spip.org/@debut_javascript
507 function debut_javascript($fin='')
509 global $spip_lang_left, $browser_name, $browser_version;
510 include_spip('inc/charsets');
512 // tester les capacites JS :
514 // On envoie un script ajah ; si le script reussit le cookie passera a +1
515 // on installe egalement un <noscript></noscript> qui charge une image qui
516 // pose un cookie valant -1
518 $testeur = str_replace('&', '\\x26', generer_url_ecrire('test_ajax', 'js=1'));
520 if (_SPIP_AJAX
AND !defined('_TESTER_NOSCRIPT')) {
521 // pour le pied de page (deja defini si on est validation XML)
522 define('_TESTER_NOSCRIPT',
523 "<noscript>\n<div style='display:none;'><img src='"
524 . generer_url_ecrire('test_ajax', 'js=-1')
525 . "' width='1' height='1' alt='' /></div></noscript>\n");
528 if (!defined('_LARGEUR_ICONES_BANDEAU'))
529 include_spip('inc/bandeau');
531 $inline = ((isset($_COOKIE['spip_accepte_ajax']) && $_COOKIE['spip_accepte_ajax'] >= 1)
533 : "jQuery.ajax({'url':'$testeur'});") .
534 (_OUTILS_DEVELOPPEURS ?
"var _OUTILS_DEVELOPPEURS=true;":"") .
535 "\nvar ajax_image_searching = \n'<img src=\"".url_absolue(chemin_image("searching.gif"))."\" alt=\"\" />';" .
536 "\nvar stat = " . (($GLOBALS['meta']["activer_statistiques"] != 'non') ?
1 : 0) .
537 "\nvar largeur_icone = " .
538 intval(_LARGEUR_ICONES_BANDEAU
) .
539 "\nvar bug_offsetwidth = " .
540 // uniquement affichage ltr: bug Mozilla dans offsetWidth quand ecran inverse!
541 ((($spip_lang_left == "left") &&
542 (($browser_name != "MSIE") ||
543 ($browser_version >= 6))) ?
1 : 0) .
544 "\nvar confirm_changer_statut = '" .
545 unicode_to_javascript(addslashes(html2unicode(_T("confirm_changer_statut")))) .
548 // envoi le fichier JS de config si browser ok.
549 $GLOBALS['browser_layer'] .
550 //plugin needed to fix the select showing through the submenus o IE6
551 (($browser_name == "MSIE" && $browser_version <= 6) ?
http_script('', 'bgiframe.js'):'' ) .
552 http_script('', 'presentation.js') .
553 http_script('', 'gadgets.js') .
554 http_script($inline . $fin);
560 // http://doc.spip.org/@debut_onglet
561 function debut_onglet(){
564 \n<div style='padding: 7px;'><table cellpadding='0' cellspacing='0' border='0' class='centered'><tr>
568 // http://doc.spip.org/@fin_onglet
569 function fin_onglet(){
570 return "</tr></table></div>\n";
573 // http://doc.spip.org/@onglet
574 function onglet($texte, $lien, $onglet_ref, $onglet, $icone=""){
575 global $spip_display, $spip_lang_left ;
578 $res .= "\n<div style='position: relative;'>";
579 if ($spip_display != 1) {
580 if (strlen($icone) > 0) {
581 $res .= "\n<div style='z-index: 2; position: absolute; top: 0px; $spip_lang_left: 5px;'>" .
582 http_img_pack("$icone", "", "") . "</div>";
583 $style = " top: 7px; padding-$spip_lang_left: 32px; z-index: 1;";
585 $style = " top: 7px;";
589 if ($onglet != $onglet_ref) {
590 $res .= "\n<div onmouseover=\"changeclass(this, 'onglet_on');\" onmouseout=\"changeclass(this, 'onglet');\" class='onglet' style='position: relative;$style'><a href='$lien'>$texte</a></div>";
593 $res .= "\n<div class='onglet_off' style='position: relative;$style'>$texte</div>";
600 // http://doc.spip.org/@icone
601 function icone($texte, $lien, $fond, $fonction="", $align="", $echo=false){
602 $retour = "<div style='padding-top: 20px;width:100px' class='icone36'>" . icone_inline($texte, $lien, $fond, $fonction, $align) . "</div>";
603 if ($echo) echo_log('icone',$retour); else return $retour;
606 // http://doc.spip.org/@icone_inline
607 function icone_inline($texte, $lien, $fond, $fonction="", $align="", $ajax=false, $javascript=''){
608 global $spip_display;
610 if ($fonction == "supprimer.gif") {
611 $style = 'icone36 danger';
614 if (strlen($fonction) < 3) $fonction = "rien.gif";
616 $style .= " " . substr(basename($fond),0,-4);
618 if ($spip_display == 1){
623 else if ($spip_display == 3){
626 $title = "\ntitle=\"$texte\"";
637 if (preg_match("/-([0-9]{1,3})[.](gif|png)$/i",$fond,$match))
639 if ($spip_display != 1 AND $spip_display != 4){
640 if ($fonction != "rien.gif"){
641 $icone = http_img_pack($fonction, $alt, "$title width='$size' height='$size'\n" .
642 http_style_background($fond, "no-repeat center center"));
645 $icone = http_img_pack($fond, $alt, "$title width='$size' height='$size'");
649 // cas d'ajax_action_auteur: faut defaire le boulot
650 // (il faudrait fusionner avec le cas $javascript)
651 if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i",$lien,$r))
652 list($x,$lien,$atts,$texte)= $r;
655 if ($align && $align!='center') $align = "float: $align; ";
657 $icone = "<a style='$align' class='$style'"
659 . (!$ajax ?
'' : (' onclick=' . ajax_action_declencheur($lien,$ajax)))
665 . (($spip_display == 3) ?
'' : "<span>$texte</span>")
668 if ($align <> 'center') return $icone;
669 $style = " style='text-align:center;'";
670 return "<div$style>$icone</div>";
673 // http://doc.spip.org/@icone_horizontale
674 function icone_horizontale($texte, $lien, $fond = "", $fonction = "", $af = true, $javascript='') {
675 global $spip_display;
678 // cas d'ajax_action_auteur: faut defaire le boulot
679 // (il faudrait fusionner avec le cas $javascript)
680 if (preg_match(",^<a href='([^']*)'([^>]*)>(.*)</a>$,i",$lien,$r))
681 list($x,$lien,$atts,$texte)= $r;
683 $lien = "\nhref='$lien'$atts";
685 if ($spip_display != 4) {
687 if ($spip_display != 1) {
688 $retour .= "\n<table class='cellule-h-table' cellpadding='0' style='vertical-align: middle'>"
689 . "\n<tr><td><a $javascript$lien class='cellule-h'>"
690 . "<span class='cell-i'>" ;
692 $retour .= http_img_pack($fonction, $texte, http_style_background($fond, "center center no-repeat"));
695 $retour .= http_img_pack($fond, $texte, "");
697 $retour .= "</span></a></td>"
698 . "\n<td class='cellule-h-lien'><a $javascript$lien class='cellule-h'>"
700 . "</a></td></tr></table>\n";
703 $retour .= "\n<div><a class='cellule-h-texte' $javascript$lien>$texte</a></div>\n";
705 if ($fonction == "supprimer.gif")
706 $retour = "\n<div class='danger'>$retour</div>";
708 $retour = "\n<li><a$lien>$texte</a></li>";
711 if ($af) echo_log('icone_horizontale',$retour); else return $retour;
714 // http://doc.spip.org/@icone_horizontale_display
715 function icone_horizontale_display($texte, $lien, $fond = "", $fonction = "", $af = true, $js='') {
716 global $spip_display, $spip_lang_left;
717 $img = icone_horizontale($texte, $lien, $fond, $fonction, $af, $js);
718 if ($spip_display != 4)
719 return "<div style='float: $spip_lang_left; width:140px;'>$img</div>\n";
720 else return "<ul>$img</ul>";
723 // Fonction standard pour le pipeline 'boite_infos'
724 // http://doc.spip.org/@f_boite_infos
725 function f_boite_infos($flux) {
726 $args = $flux['args'];
727 $type = $args['type'];
729 $flux['data'] .= recuperer_fond("prive/infos/$type",$args);
734 // http://doc.spip.org/@gros_titre
735 function gros_titre($titre, $ze_logo='', $aff=true){
736 global $spip_display;
738 if ($spip_display != 4) {
739 $res .= $ze_logo.' ';
741 $res .= typo($titre)."</h1>\n";
742 if ($aff) echo_log('gros_titre',$res); else return $res;
747 // Cadre centre (haut de page)
750 // http://doc.spip.org/@debut_grand_cadre
751 function debut_grand_cadre($return=false){
752 $res = "\n<div class='table_page'>\n";
753 if ($return) return $res; else echo_log('debut_grand_cadre',$res);
756 // http://doc.spip.org/@fin_grand_cadre
757 function fin_grand_cadre($return=false){
759 if ($return) return $res; else echo_log('fin_grand_cadre',$res);
764 // http://doc.spip.org/@debut_cadre_formulaire
765 function debut_cadre_formulaire($style='', $return=false){
766 $x = "\n<div class='cadre-formulaire'" .
767 (!$style ?
"" : " style='$style'") .
769 if ($return) return $x; else echo_log('debut_cadre_formulaire',$x);
772 // http://doc.spip.org/@fin_cadre_formulaire
773 function fin_cadre_formulaire($return=false){
774 if ($return) return "</div>\n"; else echo_log('fin_cadre_formulaire', "</div>\n");
778 // http://doc.spip.org/@formulaire_recherche
779 function formulaire_recherche($page, $complement=""){
780 $recherche = _request('recherche');
781 $recherche_aff = entites_html($recherche);
782 if (!strlen($recherche)) {
783 $recherche_aff = _T('info_rechercher');
784 $onfocus = " onfocus=\"this.value='';\"";
785 } else $onfocus = '';
787 $form = '<input type="text" size="10" value="'.$recherche_aff.'" name="recherche" class="recherche" accesskey="r"' . $onfocus . ' />';
788 $form .= "<input type='image' src='" . chemin_image('loupe.png') . "' name='submit' class='submit' alt='"._T('info_rechercher')."' />";
789 return "<div class='spip_recherche'>".generer_form_ecrire($page, $form . $complement, " method='get'")."</div>";
793 // Debut de la colonne de gauche
796 // http://doc.spip.org/@debut_gauche
797 function debut_gauche($rubrique = "accueil", $return=false) {
798 global $spip_display;
799 global $spip_ecran, $spip_lang_rtl, $spip_lang_left;
801 // div navigation fermee par creer_colonne_droite qui ouvre
802 // div extra lui-meme ferme par debut_droite qui ouvre
803 // div contenu lui-meme ferme par fin_gauche() ainsi que
806 $res = "<br /><div id='conteneur' class='".(_INTERFACE_ONGLETS ?
"onglets" : "no_onglets") ."'>
807 \n<div id='navigation'>\n";
809 if ($spip_display == 4) $res .= "<!-- ";
811 if ($return) return $res; else echo_log('debut_gauche',$res);
814 // http://doc.spip.org/@fin_gauche
815 function fin_gauche()
817 return "</div></div><div class='nettoyeur'></div>";
821 // Presentation de l''interface privee, marge de droite
824 // http://doc.spip.org/@creer_colonne_droite
825 function creer_colonne_droite($rubrique="", $return= false){
826 static $deja_colonne_droite;
827 global $spip_ecran, $spip_lang_rtl, $spip_lang_left;
829 if ((!($spip_ecran == "large")) OR $deja_colonne_droite) return '';
830 $deja_colonne_droite = true;
832 $res = "\n</div><div id='extra'>";
834 if ($return) return $res; else echo_log('creer_colonne_droite',$res);
837 // http://doc.spip.org/@formulaire_large
838 function formulaire_large()
840 return isset($_GET['exec'])?
preg_match(',^((articles|breves|rubriques)_edit|poster_forum_prive),', $_GET['exec']):false;
843 // http://doc.spip.org/@debut_droite
844 function debut_droite($rubrique="", $return= false) {
845 global $spip_ecran, $spip_display, $spip_lang_left;
849 if ($spip_display == 4) $res .= " -->";
851 $res .= liste_articles_bloques();
853 $res .= creer_colonne_droite($rubrique, true)
856 $res .= "\n<div id='contenu'>";
858 // touche d'acces rapide au debut du contenu : z
859 // Attention avant c'etait 's' mais c'est incompatible avec
860 // le ctrl-s qui fait "enregistrer"
861 $res .= "\n<a id='saut' href='#saut' accesskey='z'></a>\n";
863 if ($return) return $res; else echo_log('debut_droite',$res);
866 // http://doc.spip.org/@liste_articles_bloques
867 function liste_articles_bloques()
869 global $connect_id_auteur;
872 if ($GLOBALS['meta']["articles_modif"] != "non") {
873 include_spip('inc/drapeau_edition');
874 $articles_ouverts = liste_drapeau_edition ($connect_id_auteur, 'article');
875 if (count($articles_ouverts)) {
877 debut_cadre('bandeau-rubriques',"article-24.gif",'',_T('info_cours_edition'))
878 . "\n<div class='plan-articles-bloques'>";
879 foreach ($articles_ouverts as $row) {
880 $ze_article = $row['id_article'];
881 $ze_titre = $row['titre'];
882 $statut = $row["statut"];
884 $res .= "\n<div class='$statut'>"
885 . "\n<div style='float:right; '>"
886 . debloquer_article($ze_article,_T('lien_liberer'))
889 . generer_url_ecrire("articles","id_article=$ze_article")
894 if (count($articles_ouverts) >= 4) {
895 $res .= "\n<div style='text-align:right; '>"
896 . debloquer_article('tous', _T('lien_liberer_tous'))
899 $res .= fin_cadre('bandeau-rubriques') . "</div>";
906 // Fin de page de l'interface privee.
907 // Elle comporte une image invisible declenchant une tache de fond
909 // http://doc.spip.org/@fin_page
912 global $spip_display;
914 return debut_grand_cadre(true)
915 . (($spip_display == 4)
917 . generer_action_auteur('preferer','display:2', self('&'))
919 . _T("access_interface_graphique")
921 : ("<div style='text-align: right; ' class='verdana1 spip_xx-small'>"
925 . _T('info_copyright_doc',
926 array('spipnet' => $GLOBALS['home_server']
927 . '/' . $GLOBALS['spip_lang']))
930 . fin_grand_cadre(true)
931 . "</div>\n" // cf. div centered ouverte dans conmmencer_page()
932 . $GLOBALS['rejoue_session']
933 . '<div style="background-image: url(\''
934 . generer_url_action('cron')
936 . (defined('_TESTER_NOSCRIPT') ? _TESTER_NOSCRIPT
: '')
937 . "</body></html>\n";
940 function info_maj_spip(){
942 $maj = $GLOBALS['meta']['info_maj_spip'];
946 $maj = explode('|',$maj);
947 // c'est une ancienne notif, on a fait la maj depuis !
948 if ($GLOBALS['spip_version_branche']!==array_shift($maj))
951 if (!autoriser('webmestre'))
954 $maj = implode('|',$maj);
955 if (strncmp($maj,"<a",2)==0) $maj = extraire_attribut ($maj, 'title');
956 $lien = "http://www.spip.net/".$GLOBALS['spip_lang']."_download";
957 $maj = "<a class='info_maj_spip' href='$lien'><strong>" .
958 _T('nouvelle_version_spip',array('version'=>$maj)) .
964 // http://doc.spip.org/@info_copyright
965 function info_copyright() {
966 global $spip_version_affichee, $spip_lang;
968 $version = $spip_version_affichee;
971 // Mention, le cas echeant, de la revision SVN courante
973 if ($svn_revision = version_svn_courante(_DIR_RACINE
)) {
974 $version .= ' ' . (($svn_revision < 0) ?
'SVN ':'')
975 . "[<a href='http://core.spip.org/trac/spip/changeset/"
976 . abs($svn_revision) . "' onclick=\"window.open(this.href); return false;\">"
977 . abs($svn_revision) . "</a>]";
980 return _T('info_copyright',
981 array('spip' => "<b>SPIP $version</b> ",
983 "<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>"));
987 // http://doc.spip.org/@debloquer_article
988 function debloquer_article($arg, $texte) {
990 // cas d'un article pas liberable : on est sur sa page d'edition
991 if (_request('exec') == 'articles_edit'
992 AND $arg == _request('id_article'))
995 $lien = parametre_url(self(), 'debloquer_article', '', '&');
997 generer_action_auteur('instituer_collaboration', $arg, $lien) .
999 attribut_html($texte) .
1001 . ($arg == 'tous' ?
"$texte " : '')
1002 . http_img_pack("croix-rouge.gif", ($arg=='tous' ?
"" : "X"),
1003 "width='7' height='7' ") .
1009 // Afficher la hierarchie des rubriques
1012 // http://doc.spip.org/@afficher_hierarchie
1013 function afficher_hierarchie($id_parent, $message='',$id_objet=0,$type='',$id_secteur=0,$restreint='') {
1014 global $spip_lang_left,$spip_lang_right;
1019 # desactiver le selecteur de rubrique sur le chemin
1020 # $nav = chercher_rubrique($message,$id_objet, $id_parent, $type, $id_secteur, $restreint,true);
1021 $nav = $nav ?
"<div class='none'>$nav</div>":"";
1025 $style1 = "$spip_lang_left center no-repeat; padding-$spip_lang_left: 15px";
1026 $style2 = "margin-$spip_lang_left: 15px;";
1030 $id_rubrique = $id_parent;
1031 while ($id_rubrique) {
1033 $res = sql_fetsel("id_parent, titre, lang", "spip_rubriques", "id_rubrique=".intval($id_rubrique));
1035 if (!$res){ // rubrique inexistante
1040 $id_parent = $res['id_parent'];
1041 changer_typo($res['lang']);
1043 $class = (!$id_parent) ?
"secteur"
1044 : (acces_restreint_rubrique($id_rubrique)
1045 ?
"admin" : "rubrique");
1047 $parents = "<ul><li><span class='bloc'><em> > </em><$tag class='$class$on'"
1048 . ($tag=='a'?
" href='". generer_url_ecrire("naviguer","id_rubrique=$id_rubrique")."'":"")
1050 . supprimer_numero(typo(sinon($res['titre'], _T('ecrire:info_sans_titre'))))
1055 $id_rubrique = $id_parent;
1061 . "\n<ul id='chemin' class='verdana3' dir='".lang_dir()."'"
1062 //. http_style_background("racine-site-12.gif", $style1)
1063 . "><li><span class='bloc'><$tag class='racine$on'"
1064 . ($tag=='a'?
" href='". generer_url_ecrire("naviguer","id_rubrique=$id_rubrique")."'":"")
1065 . ">"._T('info_racine_site')."</$tag>"
1071 " <a href='#' onclick=\"$(this).prev().prev().toggle('fast');return false;\" class='verdana2'>"
1072 . _T('bouton_changer') ."</a>"
1075 $out = pipeline('affiche_hierarchie',array('args'=>array(
1076 'id_parent'=>$id_parent,
1077 'message'=>$message,
1078 'id_objet'=>$id_objet,
1080 'id_secteur'=>$id_secteur,
1081 'restreint'=>$restreint),
1087 // Pour construire des menu avec SELECTED
1088 // http://doc.spip.org/@mySel
1089 function mySel($varaut,$variable, $option = NULL) {
1090 $res = ' value="'.$varaut.'"' . (($variable==$varaut) ?
' selected="selected"' : '');
1092 return (!isset($option) ?
$res : "<option$res>$option</option>\n");
1096 // Voir en ligne, ou apercu, ou rien (renvoie tout le bloc)
1097 // http://doc.spip.org/@voir_en_ligne
1098 function voir_en_ligne ($type, $id, $statut=false, $image='racine-24.gif', $af = true, $inline=true) {
1100 $en_ligne = $message = '';
1103 if ($statut == "publie" AND $GLOBALS['meta']["post_dates"] == 'non') {
1104 $n = sql_fetsel("id_article", "spip_articles", "id_article=$id AND date<=".sql_quote(date('Y-m-d H:i:s')));
1105 if (!$n) $statut = 'prop';
1107 if ($statut == 'publie')
1108 $en_ligne = 'calcul';
1109 else if ($statut == 'prop')
1110 $en_ligne = 'preview';
1114 if ($statut == 'publie')
1115 $en_ligne = 'calcul';
1117 $en_ligne = 'preview';
1121 if ($statut == 'publie')
1122 $en_ligne = 'calcul';
1123 else if ($statut == 'prop')
1124 $en_ligne = 'preview';
1127 $en_ligne = 'calcul';
1130 $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));
1131 if ($n) $en_ligne = 'calcul';
1132 else $en_ligne = 'preview';
1137 if ($en_ligne == 'calcul')
1138 $message = _T('icone_voir_en_ligne');
1139 else if ($en_ligne == 'preview'
1140 AND autoriser('previsualiser'))
1141 $message = _T('previsualiser');
1145 $h = generer_url_action('redirect', "type=$type&id=$id&var_mode=$en_ligne");
1148 ?
icone_inline($message, $h, $image, "rien.gif", $GLOBALS['spip_lang_left'])
1149 : icone_horizontale($message, $h, $image, "rien.gif",$af);
1153 // http://doc.spip.org/@bouton_spip_rss
1154 function bouton_spip_rss($op, $args=array(), $lang='', $title='RSS') {
1156 global $spip_lang_right;
1157 include_spip('inc/acces');
1158 $clic = http_img_pack('feed.png', 'RSS', '', $title);
1159 $args = param_low_sec($op, $args, $lang, 'rss');
1160 $url = generer_url_public('rss', $args);
1161 return "<a style='float: $spip_lang_right;' href='$url'>$clic</a>";