";
if ($retour) return $ret; else echo_log('hr',$ret);
}
//
// Cadres
//
// http://doc.spip.org/@afficher_onglets_pages
function afficher_onglets_pages($ordre,$onglets){
static $onglet_compteur = 0;
$res = "";
$corps = "";
$cpt = 0;
$actif = 0;
// ordre des onglets
foreach($ordre as $id => $label) {
$cpt++;
$disabled = strlen(trim($onglets[$id]))?"":" class='tabs-disabled'";
if (!$actif && !$disabled) $actif = $cpt;
$res .= "
" . $label . " ";
}
$res = "";
foreach((_INTERFACE_ONGLETS ? array_keys($ordre):array_keys($onglets)) as $id){
$res .= "";
}
$onglet_compteur++;
return "$res
"
. (_INTERFACE_ONGLETS ?
http_script("$('#boite_onglet_$onglet_compteur').tabs(".($actif?"$actif,":"")."{ fxAutoHeight: true });
if (!$.browser.safari)
$('ul.tabs-nav li').hover(
function(){
\$('#boite_onglet_$onglet_compteur').triggerTab(parseInt(\$(this).attr('rel')));
return false;
}
,
function(){}
);")
:"");
}
// http://doc.spip.org/@debut_cadre
function debut_cadre($style, $icone = "", $fonction = "", $titre = "", $id="", $class="", $padding=true) {
global $spip_display;
static $accesskey = 97; // a
//zoom:1 fixes all expanding blocks in IE, see authors block in articles.php
//being not standard, next step can be putting this kind of hacks in a different stylesheet
//visible to IE only using conditional comments.
// accesskey pour accessibilite espace prive
if ($accesskey <= 122) // z
{
$accesskey_c = chr($accesskey++);
$ret = " ";
} else $ret ='';
$ret .= "\n";
if ($spip_display != 1 AND $spip_display != 4 AND strlen($icone) > 1) {
if ($fonction) {
$ret .= http_img_pack("$fonction", "", " class='cadre-icone' ".http_style_background($icone, "no-repeat; padding: 0px; margin: 0px"));
}
else $ret .= http_img_pack("$icone", "", " class='cadre-icone'");
}
if (strlen($titre) > 0) {
if (strpos($titre,'titrem')!==false) {
$ret .= $titre;
} elseif ($spip_display == 4) {
$ret .= "\n
$titre ";
} else {
$ret .= bouton_block_depliable($titre,-1);
}
}
$ret .= "
";
return $ret;
}
// http://doc.spip.org/@fin_cadre
function fin_cadre($style='') {
$ret = "
".
"
\n";
/*if ($style != "forum" AND $style != "thread-forum")
$ret .= "
\n";*/
return $ret;
}
// http://doc.spip.org/@debut_cadre_relief
function debut_cadre_relief($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
$retour_aff = debut_cadre('r', $icone, $fonction, $titre, $id, $class);
if ($return) return $retour_aff; else echo($retour_aff);
}
// http://doc.spip.org/@fin_cadre_relief
function fin_cadre_relief($return = false){
$retour_aff = fin_cadre('r');
if ($return) return $retour_aff; else echo($retour_aff);
}
// http://doc.spip.org/@debut_cadre_enfonce
function debut_cadre_enfonce($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
$retour_aff = debut_cadre('e', $icone, $fonction, $titre, $id, $class);
if ($return) return $retour_aff; else echo($retour_aff);
}
// http://doc.spip.org/@fin_cadre_enfonce
function fin_cadre_enfonce($return = false){
$retour_aff = fin_cadre('e');
if ($return) return $retour_aff; else echo_log('fin_cadre_enfonce',$retour_aff);
}
// http://doc.spip.org/@debut_cadre_sous_rub
function debut_cadre_sous_rub($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
$retour_aff = debut_cadre('sous_rub', $icone, $fonction, $titre, $id, $class);
if ($return) return $retour_aff; else echo_log('debut_cadre_sous_rub',$retour_aff);
}
// http://doc.spip.org/@fin_cadre_sous_rub
function fin_cadre_sous_rub($return = false){
$retour_aff = fin_cadre('sous_rub');
if ($return) return $retour_aff; else echo_log('fin_cadre_sous_rub',$retour_aff);
}
// http://doc.spip.org/@debut_cadre_forum
function debut_cadre_forum($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
$retour_aff = debut_cadre('forum', $icone, $fonction, $titre, $id, $class);
if ($return) return $retour_aff; else echo_log('debut_cadre_forum',$retour_aff);
}
// http://doc.spip.org/@fin_cadre_forum
function fin_cadre_forum($return = false){
$retour_aff = fin_cadre('forum');
if ($return) return $retour_aff; else echo_log('fin_cadre_forum',$retour_aff);
}
// http://doc.spip.org/@debut_cadre_thread_forum
function debut_cadre_thread_forum($icone='', $return = false, $fonction='', $titre = '', $id="", $class=""){
$retour_aff = debut_cadre('thread-forum', $icone, $fonction, $titre, $id, $class);
if ($return) return $retour_aff; else echo_log('debut_cadre_thread_forum',$retour_aff);
}
// http://doc.spip.org/@fin_cadre_thread_forum
function fin_cadre_thread_forum($return = false){
$retour_aff = fin_cadre('thread-forum');
if ($return) return $retour_aff; else echo_log('fin_cadre_thread_forum',$retour_aff);
}
// http://doc.spip.org/@debut_cadre_couleur
function debut_cadre_couleur($icone='', $return = false, $fonction='', $titre='', $id="", $class=""){
$retour_aff = debut_cadre('couleur', $icone, $fonction, $titre, $id, $class);
if ($return) return $retour_aff; else echo_log('debut_cadre_couleur',$retour_aff);
}
// http://doc.spip.org/@fin_cadre_couleur
function fin_cadre_couleur($return = false){
$retour_aff = fin_cadre('couleur');
if ($return) return $retour_aff; else echo_log('fin_cadre_couleur',$retour_aff);
}
// http://doc.spip.org/@debut_cadre_couleur_foncee
function debut_cadre_couleur_foncee($icone='', $return = false, $fonction='', $titre='', $id="", $class=""){
$retour_aff = debut_cadre('couleur-foncee', $icone, $fonction, $titre, $id, $class);
if ($return) return $retour_aff; else echo_log('debut_cadre_couleur_foncee',$retour_aff);
}
// http://doc.spip.org/@fin_cadre_couleur_foncee
function fin_cadre_couleur_foncee($return = false){
$retour_aff = fin_cadre('couleur-foncee');
if ($return) return $retour_aff; else echo_log('fin_cadre_couleur_foncee',$retour_aff);
}
// http://doc.spip.org/@debut_cadre_trait_couleur
function debut_cadre_trait_couleur($icone='', $return = false, $fonction='', $titre='', $id="", $class=""){
$retour_aff = debut_cadre('trait-couleur', $icone, $fonction, $titre, $id, $class);
if ($return) return $retour_aff; else echo_log('debut_cadre_trait_couleur',$retour_aff);
}
// http://doc.spip.org/@fin_cadre_trait_couleur
function fin_cadre_trait_couleur($return = false){
$retour_aff = fin_cadre('trait-couleur');
if ($return) return $retour_aff; else echo_log('fin_cadre_trait_couleur',$retour_aff);
}
//
// une boite alerte
//
// http://doc.spip.org/@debut_boite_alerte
function debut_boite_alerte() {
return debut_cadre('alerte', '', '', '', '', '');
}
// http://doc.spip.org/@fin_boite_alerte
function fin_boite_alerte() {
return fin_cadre('alerte');
}
//
// une boite info
//
// http://doc.spip.org/@debut_boite_info
function debut_boite_info($return=false) {
$r = debut_cadre('info', '', '', '', '', 'verdana1');
if ($return) return $r; else echo_log('debut_boite_info',$r);
}
// http://doc.spip.org/@fin_boite_info
function fin_boite_info($return=false) {
$r = fin_cadre('info');
if ($return) return $r; else echo_log('fin_boite_info',$r);
}
//
// La boite des raccourcis
// Se place a droite si l'ecran est en mode panoramique.
// http://doc.spip.org/@bloc_des_raccourcis
function bloc_des_raccourcis($bloc) {
global $spip_display;
return "\n"
. creer_colonne_droite('',true)
. debut_cadre_enfonce('',true)
. (($spip_display != 4)
? ("\n"
._T('titre_cadre_raccourcis')
." ")
: ( "
"._T('titre_cadre_raccourcis')." "))
. $bloc
. (($spip_display != 4) ? " " : "")
. fin_cadre_enfonce(true);
}
// Afficher un petit "+" pour lien vers autre page
// http://doc.spip.org/@afficher_plus
function afficher_plus($lien) {
global $spip_lang_right, $spip_display;
if ($spip_display != 4) {
return "\n" .
http_img_pack("plus.gif", "+", "") ." ";
}
}
//
// Fonctions d'affichage
//
// http://doc.spip.org/@afficher_objets
function afficher_objets($type, $titre_table,$requete,$formater='',$force=false){
$afficher_objets = charger_fonction('afficher_objets','inc');
return $afficher_objets($type, $titre_table,$requete,$formater,$force);
}
// http://doc.spip.org/@navigation_pagination
function navigation_pagination($num_rows, $nb_aff=10, $href=null, $debut, $tmp_var=null, $on='') {
$texte = '';
$self = parametre_url(self(), 'date', '');
$deb_aff = intval($debut);
for ($i = 0; $i < $num_rows; $i += $nb_aff){
$deb = $i + 1;
// Pagination : si on est trop loin, on met des '...'
if (abs($deb-$deb_aff)>101) {
if ($deb<$deb_aff) {
if (!isset($premiere)) {
$premiere = '0 ... ';
$texte .= $premiere;
}
} else {
$derniere = ' | ... '.$num_rows;
$texte .= $derniere;
break;
}
} else {
$fin = $i + $nb_aff;
if ($fin > $num_rows)
$fin = $num_rows;
if ($deb > 1)
$texte .= " |\n";
if ($deb_aff + 1 >= $deb AND $deb_aff + 1 <= $fin) {
$texte .= "$deb ";
}
else {
$script = parametre_url($self, $tmp_var, $deb-1);
if ($on) $on = generer_onclic_ajax($href, $tmp_var, $deb-1);
$texte .= "$deb ";
}
}
}
return $texte;
}
// http://doc.spip.org/@generer_onclic_ajax
function generer_onclic_ajax($url, $idom, $val)
{
return "\nonclick=\"return charger_id_url('"
. parametre_url($url, $idom, $val)
. "','"
. $idom
. '\');"';
}
// http://doc.spip.org/@avoir_visiteurs
function avoir_visiteurs($past=false, $accepter=true) {
if ($GLOBALS['meta']["forums_publics"] == 'abo') return true;
if ($accepter AND $GLOBALS['meta']["accepter_visiteurs"] <> 'non') return true;
if (sql_countsel('spip_articles', "accepter_forum='abo'"))return true;
if (!$past) return false;
return sql_countsel('spip_auteurs', "statut NOT IN ('0minirezo','1comite', 'nouveau', '5poubelle')");
}
// http://doc.spip.org/@forum_logo
function forum_logo($statut)
{
if ($statut == "prive") return "forum-interne-24.gif";
else if ($statut == "privadm") return "forum-admin-24.gif";
else if ($statut == "privrac") return "forum-interne-24.gif";
else return "forum-public-24.gif";
}
// Retourne les parametres de personnalisation css de l'espace prive
// (ltr et couleurs) ce qui permet une ecriture comme :
// generer_url_public('style_prive', parametres_css_prive())
// qu'il est alors possible de recuperer dans le squelette style_prive.html avec
// #SET{claire,##ENV{couleur_claire,edf3fe}}
// #SET{foncee,##ENV{couleur_foncee,3874b0}}
// #SET{left,#ENV{ltr}|choixsiegal{left,left,right}}
// #SET{right,#ENV{ltr}|choixsiegal{left,right,left}}
// http://doc.spip.org/@parametres_css_prive
function parametres_css_prive(){
global $visiteur_session;
global $browser_name, $browser_version;
$ie = "";
include_spip('inc/layer');
if ($browser_name=='MSIE')
$ie = "&ie=$browser_version";
$v = "&v=".$GLOBALS['spip_version_code'];
$p = "&p=".substr(md5($GLOBALS['meta']['plugin']),0,4);
$c = (is_array($visiteur_session)
AND is_array($visiteur_session['prefs']))
? $visiteur_session['prefs']['couleur']
: 1;
$couleurs = charger_fonction('couleurs', 'inc');
return 'ltr=' . $GLOBALS['spip_lang_left'] . '&'. $couleurs($c) . $v . $p . $ie ;
}
// http://doc.spip.org/@envoi_link
function envoi_link($nom_site_spip, $minipres=false, $js='') {
global $spip_display, $spip_lang;
$paramcss = parametres_css_prive();
// CSS de secours en cas de non fonct de la suivante
$res = ' ' . "\n"
// CSS calendrier
. (($GLOBALS['meta']['messagerie_agenda'] != 'non')
? ' ' . "\n"
: '')
// CSS des raccourcis
. ' ' . "\n"
// CSS imprimante (masque des trucs, a completer)
. ' ' . "\n"
// CSS "visible au chargement" differente selon js actif ou non
. ' ' . "\n"
// CSS espace prive : la vraie
. ' ' . "\n"
. "\n"
// CSS optionelle minipres
. ($minipres?' ' . "\n":"");
$favicon = find_in_path('spip.ico');
// favicon.ico
$res .= ' \n";
$js = debut_javascript($js);
if ($spip_display == 4) return $res . $js;
$nom = entites_html($nom_site_spip);
$res .= " \n";
$res .= " \n";
if ($GLOBALS['meta']["activer_breves"] != "non")
$res .= " \n";
return $res . $js;
}
// http://doc.spip.org/@debut_javascript
function debut_javascript($fin='')
{
global $spip_lang_left, $browser_name, $browser_version;
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 qui charge une image qui
// pose un cookie valant -1
$testeur = str_replace('&', '\\x26', generer_url_ecrire('test_ajax', 'js=1'));
if (_SPIP_AJAX AND !defined('_TESTER_NOSCRIPT')) {
// pour le pied de page (deja defini si on est validation XML)
define('_TESTER_NOSCRIPT',
"\n \n");
}
if (!defined('_LARGEUR_ICONES_BANDEAU'))
include_spip('inc/bandeau');
$inline = ((isset($_COOKIE['spip_accepte_ajax']) && $_COOKIE['spip_accepte_ajax'] >= 1)
? ''
: "jQuery.ajax({'url':'$testeur'});") .
(_OUTILS_DEVELOPPEURS ?"var _OUTILS_DEVELOPPEURS=true;":"") .
"\nvar ajax_image_searching = \n' ';" .
"\nvar stat = " . (($GLOBALS['meta']["activer_statistiques"] != 'non') ? 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";
return
// envoi le fichier JS de config si browser ok.
$GLOBALS['browser_layer'] .
//plugin needed to fix the select showing through the submenus o IE6
(($browser_name == "MSIE" && $browser_version <= 6) ? http_script('', 'bgiframe.js'):'' ) .
http_script('', 'presentation.js') .
http_script('', 'gadgets.js') .
http_script($inline . $fin);
}
// Fonctions onglets
// http://doc.spip.org/@debut_onglet
function debut_onglet(){
return "
\n
";
}
// http://doc.spip.org/@fin_onglet
function fin_onglet(){
return "
\n";
}
// http://doc.spip.org/@onglet
function onglet($texte, $lien, $onglet_ref, $onglet, $icone=""){
global $spip_display, $spip_lang_left ;
$res = "";
$res .= "\n";
if ($spip_display != 1) {
if (strlen($icone) > 0) {
$res .= "\n
" .
http_img_pack("$icone", "", "") . "
";
$style = " top: 7px; padding-$spip_lang_left: 32px; z-index: 1;";
} else {
$style = " top: 7px;";
}
}
if ($onglet != $onglet_ref) {
$res .= "\n
";
$res .= "
";
} else {
$res .= "\n$texte
";
$res .= "";
}
$res .= " ";
return $res;
}
// http://doc.spip.org/@icone
function icone($texte, $lien, $fond, $fonction="", $align="", $echo=false){
$retour = "" . icone_inline($texte, $lien, $fond, $fonction, $align) . "
";
if ($echo) echo_log('icone',$retour); else return $retour;
}
// http://doc.spip.org/@icone_inline
function icone_inline($texte, $lien, $fond, $fonction="", $align="", $ajax=false, $javascript=''){
global $spip_display;
if ($fonction == "supprimer.gif") {
$style = 'icone36 danger';
} else {
$style = 'icone36';
if (strlen($fonction) < 3) $fonction = "rien.gif";
}
$style .= " " . substr(basename($fond),0,-4);
if ($spip_display == 1){
$hauteur = 20;
$largeur = 100;
$title = $alt = "";
}
else if ($spip_display == 3){
$hauteur = 30;
$largeur = 30;
$title = "\ntitle=\"$texte\"";
$alt = $texte;
}
else {
$hauteur = 70;
$largeur = 100;
$title = '';
$alt = $texte;
}
$size = 24;
if (preg_match("/-([0-9]{1,3})[.](gif|png)$/i",$fond,$match))
$size = $match[1];
if ($spip_display != 1 AND $spip_display != 4){
if ($fonction != "rien.gif"){
$icone = http_img_pack($fonction, $alt, "$title width='$size' height='$size'\n" .
http_style_background($fond, "no-repeat center center"));
}
else {
$icone = http_img_pack($fond, $alt, "$title width='$size' height='$size'");
}
} else $icone = '';
// cas d'ajax_action_auteur: faut defaire le boulot
// (il faudrait fusionner avec le cas $javascript)
if (preg_match(",^]*)>(.*) $,i",$lien,$r))
list($x,$lien,$atts,$texte)= $r;
else $atts = '';
if ($align && $align!='center') $align = "float: $align; ";
$icone = ""
. $icone
. (($spip_display == 3) ? '' : "$texte ")
. " \n";
if ($align <> 'center') return $icone;
$style = " style='text-align:center;'";
return "$icone
";
}
// http://doc.spip.org/@icone_horizontale
function icone_horizontale($texte, $lien, $fond = "", $fonction = "", $af = true, $javascript='') {
global $spip_display;
$retour = '';
// cas d'ajax_action_auteur: faut defaire le boulot
// (il faudrait fusionner avec le cas $javascript)
if (preg_match(",^]*)>(.*) $,i",$lien,$r))
list($x,$lien,$atts,$texte)= $r;
else $atts = '';
$lien = "\nhref='$lien'$atts";
if ($spip_display != 4) {
if ($spip_display != 1) {
$retour .= "\n\n";
}
else {
$retour .= "\n\n";
}
if ($fonction == "supprimer.gif")
$retour = "\n$retour
";
} else {
$retour = "\n$texte ";
}
if ($af) echo_log('icone_horizontale',$retour); else return $retour;
}
// http://doc.spip.org/@icone_horizontale_display
function icone_horizontale_display($texte, $lien, $fond = "", $fonction = "", $af = true, $js='') {
global $spip_display, $spip_lang_left;
$img = icone_horizontale($texte, $lien, $fond, $fonction, $af, $js);
if ($spip_display != 4)
return "$img
\n";
else return "";
}
// Fonction standard pour le pipeline 'boite_infos'
// http://doc.spip.org/@f_boite_infos
function f_boite_infos($flux) {
$args = $flux['args'];
$type = $args['type'];
unset($args['row']);
$flux['data'] .= recuperer_fond("prive/infos/$type",$args);
return $flux;
}
// http://doc.spip.org/@gros_titre
function gros_titre($titre, $ze_logo='', $aff=true){
global $spip_display;
$res = "\n";
if ($spip_display != 4) {
$res .= $ze_logo.' ';
}
$res .= typo($titre)." \n";
if ($aff) echo_log('gros_titre',$res); else return $res;
}
//
// Cadre centre (haut de page)
//
// http://doc.spip.org/@debut_grand_cadre
function debut_grand_cadre($return=false){
$res = "\n\n";
if ($return) return $res; else echo_log('debut_grand_cadre',$res);
}
// http://doc.spip.org/@fin_grand_cadre
function fin_grand_cadre($return=false){
$res = "\n
";
if ($return) return $res; else echo_log('fin_grand_cadre',$res);
}
// Cadre formulaires
// http://doc.spip.org/@debut_cadre_formulaire
function debut_cadre_formulaire($style='', $return=false){
$x = "\n";
if ($return) return $x; else echo_log('debut_cadre_formulaire',$x);
}
// http://doc.spip.org/@fin_cadre_formulaire
function fin_cadre_formulaire($return=false){
if ($return) return "
\n"; else echo_log('fin_cadre_formulaire', "\n");
}
// http://doc.spip.org/@formulaire_recherche
function formulaire_recherche($page, $complement=""){
$recherche = _request('recherche');
$recherche_aff = entites_html($recherche);
if (!strlen($recherche)) {
$recherche_aff = _T('info_rechercher');
$onfocus = " onfocus=\"this.value='';\"";
} else $onfocus = '';
$form = ' ';
$form .= " ";
return "".generer_form_ecrire($page, $form . $complement, " method='get'")."
";
}
//
// Debut de la colonne de gauche
//
// http://doc.spip.org/@debut_gauche
function debut_gauche($rubrique = "accueil", $return=false) {
global $spip_display;
global $spip_ecran, $spip_lang_rtl, $spip_lang_left;
// div navigation fermee par creer_colonne_droite qui ouvre
// div extra lui-meme ferme par debut_droite qui ouvre
// div contenu lui-meme ferme par fin_gauche() ainsi que
// div conteneur
$res = "
\n
\n";
if ($spip_display == 4) $res .= "";
$res .= liste_articles_bloques();
$res .= creer_colonne_droite($rubrique, true)
. "
";
$res .= "\n
";
// touche d'acces rapide au debut du contenu : z
// Attention avant c'etait 's' mais c'est incompatible avec
// le ctrl-s qui fait "enregistrer"
$res .= "\n
\n";
if ($return) return $res; else echo_log('debut_droite',$res);
}
// http://doc.spip.org/@liste_articles_bloques
function liste_articles_bloques()
{
global $connect_id_auteur;
$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 .=
debut_cadre('bandeau-rubriques',"article-24.gif",'',_T('info_cours_edition'))
. "\n
";
foreach ($articles_ouverts as $row) {
$ze_article = $row['id_article'];
$ze_titre = $row['titre'];
$statut = $row["statut"];
$res .= "\n
"
. "\n
"
. debloquer_article($ze_article,_T('lien_liberer'))
. "
"
. "
$ze_titre "
. "
";
}
if (count($articles_ouverts) >= 4) {
$res .= "\n
"
. debloquer_article('tous', _T('lien_liberer_tous'))
. "
";
}
$res .= fin_cadre('bandeau-rubriques') . "
";
}
}
return $res;
}
//
// Fin de page de l'interface privee.
// Elle comporte une image invisible declenchant une tache de fond
// http://doc.spip.org/@fin_page
function fin_page()
{
global $spip_display;
return debut_grand_cadre(true)
. (($spip_display == 4)
? ("
")
: ("
"
. info_copyright()
. " "
. info_maj_spip()
. _T('info_copyright_doc',
array('spipnet' => $GLOBALS['home_server']
. '/' . $GLOBALS['spip_lang']))
. '
'))
. fin_grand_cadre(true)
. "
\n" // cf. div centered ouverte dans conmmencer_page()
. $GLOBALS['rejoue_session']
. '
'
. (defined('_TESTER_NOSCRIPT') ? _TESTER_NOSCRIPT : '')
. "