4 |
david |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/***************************************************************************\
|
|
|
4 |
* SPIP, Systeme de publication pour l'internet *
|
|
|
5 |
* *
|
|
|
6 |
* Copyright (c) 2001-2005 *
|
|
|
7 |
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
|
|
|
8 |
* *
|
|
|
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 |
\***************************************************************************/
|
|
|
12 |
|
|
|
13 |
//
|
|
|
14 |
// Ce fichier ne sera execute qu'une fois
|
|
|
15 |
if (defined("_INC_LAYER")) return;
|
|
|
16 |
define("_INC_LAYER", "1");
|
|
|
17 |
|
|
|
18 |
include_ecrire("inc_filtres.php3"); # pour http_script (normalement déjà fait)
|
|
|
19 |
|
|
|
20 |
function debut_block_visible($nom_block){
|
|
|
21 |
global $numero_block, $compteur_block, $browser_layer;
|
|
|
22 |
if (!$browser_layer) return '';
|
|
|
23 |
if (!$numero_block["$nom_block"] > 0){
|
|
|
24 |
$compteur_block++;
|
|
|
25 |
$numero_block["$nom_block"] = $compteur_block;
|
|
|
26 |
}
|
|
|
27 |
return "<div id='Layer".$numero_block["$nom_block"]."' style='display: block;'>";
|
|
|
28 |
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
function debut_block_invisible($nom_block){
|
|
|
32 |
global $numero_block, $compteur_block, $browser_layer;
|
|
|
33 |
if (!$browser_layer) return '';
|
|
|
34 |
if (!$numero_block["$nom_block"] > 0){
|
|
|
35 |
$compteur_block++;
|
|
|
36 |
$numero_block["$nom_block"] = $compteur_block;
|
|
|
37 |
}
|
|
|
38 |
return http_script("vis['".$numero_block["$nom_block"]."'] = 'hide';
|
|
|
39 |
document.write('<div id=\"Layer".$numero_block["$nom_block"]."\" style=\"display: none; margin-top: 1;\">');",
|
|
|
40 |
'',
|
|
|
41 |
"<div id='Layer".$numero_block["$nom_block"]."' style='display: block;'>");
|
|
|
42 |
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
function fin_block() {
|
|
|
46 |
if ($GLOBALS['browser_layer'])
|
|
|
47 |
return "<div style='clear: both;'></div></div>";
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
function bouton_block_invisible($nom_block, $icone='') {
|
|
|
51 |
global $numero_block, $compteur_block, $browser_layer, $spip_lang_rtl;
|
|
|
52 |
|
|
|
53 |
if (!$browser_layer) return '';
|
|
|
54 |
$blocks = explode(",", $nom_block);
|
|
|
55 |
$javasc = array();
|
|
|
56 |
for ($index=0; $index < count($blocks); $index ++){
|
|
|
57 |
$nom_block = $blocks[$index];
|
|
|
58 |
|
|
|
59 |
if (!$numero_block["$nom_block"] > 0){
|
|
|
60 |
$compteur_block++;
|
|
|
61 |
$numero_block["$nom_block"] = $compteur_block;
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
if (!$icone) {
|
|
|
65 |
$icone = "deplierhaut$spip_lang_rtl.gif";
|
|
|
66 |
$javasc[] = '[' . $numero_block[$nom_block] . ',0]';
|
|
|
67 |
}
|
|
|
68 |
else
|
|
|
69 |
$javasc[] = '[' . $numero_block[$nom_block] . ',1]';
|
|
|
70 |
}
|
|
|
71 |
return produire_acceder_couche($javasc, $numero_block[$nom_block], $icone);
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
function bouton_block_visible($nom_block){
|
|
|
76 |
global $numero_block, $compteur_block, $browser_layer, $spip_lang_rtl;
|
|
|
77 |
|
|
|
78 |
if (!$browser_layer) return '';
|
|
|
79 |
$blocks = explode(",", $nom_block);
|
|
|
80 |
$javasc = array();
|
|
|
81 |
for ($index=0; $index < count($blocks); $index ++){
|
|
|
82 |
$nom_block = $blocks[$index];
|
|
|
83 |
|
|
|
84 |
if (!$numero_block["$nom_block"] > 0){
|
|
|
85 |
$compteur_block++;
|
|
|
86 |
$numero_block["$nom_block"] = $compteur_block;
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
$javasc[] = '[' . $numero_block[$nom_block] . ',0]';
|
|
|
90 |
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
return produire_acceder_couche($javasc, $numero_block[$nom_block], "deplierbas.gif");
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
function produire_acceder_couche($couches, $nom, $icone) {
|
|
|
97 |
global $spip_lang_rtl;
|
|
|
98 |
return http_script("acceder_couche([" . join(',',$couches) . '], ' .
|
|
|
99 |
$nom .
|
|
|
100 |
", '" .
|
|
|
101 |
_DIR_IMG_PACK .
|
|
|
102 |
"', '" .
|
|
|
103 |
$icone .
|
|
|
104 |
"', '" .
|
|
|
105 |
addslashes(_T('info_deplier')) .
|
|
|
106 |
"','$spip_lang_rtl')");
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
//
|
|
|
110 |
// Tests sur le nom du butineur
|
|
|
111 |
//
|
|
|
112 |
function verif_butineur() {
|
|
|
113 |
global $HTTP_USER_AGENT, $browser_name, $browser_version;
|
|
|
114 |
global $browser_description, $browser_rev, $browser_layer, $browser_barre;
|
|
|
115 |
ereg("^([A-Za-z]+)/([0-9]+\.[0-9]+) (.*)$", $HTTP_USER_AGENT, $match);
|
|
|
116 |
$browser_name = $match[1];
|
|
|
117 |
$browser_version = $match[2];
|
|
|
118 |
$browser_description = $match[3];
|
|
|
119 |
$browser_layer = '';
|
|
|
120 |
$browser_barre = '';
|
|
|
121 |
|
|
|
122 |
if (eregi("opera", $browser_description)) {
|
|
|
123 |
eregi("Opera ([^\ ]*)", $browser_description, $match);
|
|
|
124 |
$browser_name = "Opera";
|
|
|
125 |
$browser_version = $match[1];
|
|
|
126 |
$browser_layer = (($browser_version < 7) ? '' : http_script('', _DIR_INCLUDE . 'layer.js',''));
|
|
|
127 |
}
|
|
|
128 |
else if (eregi("msie", $browser_description)) {
|
|
|
129 |
eregi("MSIE ([^;]*)", $browser_description, $match);
|
|
|
130 |
$browser_name = "MSIE";
|
|
|
131 |
$browser_version = $match[1];
|
|
|
132 |
$browser_layer = (($browser_version < 5) ? '' : http_script('', _DIR_INCLUDE . 'layer.js',''));
|
|
|
133 |
$browser_barre = ($browser_version >= 5.5);
|
|
|
134 |
}
|
|
|
135 |
else if (eregi("KHTML", $browser_description) &&
|
|
|
136 |
eregi("Safari/([^;]*)", $browser_description, $match)) {
|
|
|
137 |
$browser_name = "Safari";
|
|
|
138 |
$browser_version = $match[1];
|
|
|
139 |
$browser_layer = http_script('', _DIR_INCLUDE . 'layer.js','');
|
|
|
140 |
}
|
|
|
141 |
else if (eregi("mozilla", $browser_name) AND $browser_version >= 5) {
|
|
|
142 |
$browser_layer = http_script('', _DIR_INCLUDE . 'layer.js','');
|
|
|
143 |
// Numero de version pour Mozilla "authentique"
|
|
|
144 |
if (ereg("rv:([0-9]+\.[0-9]+)", $browser_description, $match))
|
|
|
145 |
$browser_rev = doubleval($match[1]);
|
|
|
146 |
// Autres Gecko => equivalents 1.4 par defaut (Galeon, etc.)
|
|
|
147 |
else if (strpos($browser_description, "Gecko") and !strpos($browser_description, "KHTML"))
|
|
|
148 |
$browser_rev = 1.4;
|
|
|
149 |
// Machins quelconques => equivalents 1.0 par defaut (Konqueror, etc.)
|
|
|
150 |
else $browser_rev = 1.0;
|
|
|
151 |
$browser_barre = $browser_rev >= 1.3;
|
|
|
152 |
}
|
|
|
153 |
|
|
|
154 |
if (!$browser_name) $browser_name = "Mozilla";
|
|
|
155 |
}
|
|
|
156 |
|
|
|
157 |
// Obsolete. Present pour compatibilite
|
|
|
158 |
function afficher_script_layer(){echo $GLOBALS['browser_layer'];}
|
|
|
159 |
function test_layer(){return $GLOBALS['browser_layer'];}
|
|
|
160 |
|
|
|
161 |
verif_butineur();
|
|
|
162 |
|
|
|
163 |
$GLOBALS['browser_caret'] = (!$GLOBALS['browser_barre'] ? '' : "
|
|
|
164 |
onselect='storeCaret(this);'
|
|
|
165 |
onclick='storeCaret(this);'
|
|
|
166 |
onkeyup='storeCaret(this);'
|
|
|
167 |
ondbclick='storeCaret(this);'");
|
|
|
168 |
|
|
|
169 |
?>
|