[ Index ] |
|
Code source de SPIP 1.9.2c |
1 <?php 2 3 /***************************************************************************\ 4 * SPIP, Systeme de publication pour l'internet * 5 * * 6 * Copyright (c) 2001-2007 * 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 if (!defined("_ECRIRE_INC_VERSION")) return; 14 15 include_spip('inc/lang'); 16 include_spip('inc/texte'); 17 18 // 19 // Presentation des pages d'installation et d'erreurs 20 // 21 22 // http://doc.spip.org/@install_debut_html 23 function install_debut_html($titre = 'AUTO', $onLoad = '') { 24 global $spip_lang_right; 25 26 include_spip('inc/filtres'); 27 include_spip('inc/headers'); 28 utiliser_langue_visiteur(); 29 30 http_no_cache(); 31 32 if ($titre=='AUTO') 33 $titre=_T('info_installation_systeme_publication'); 34 35 # le charset est en utf-8, pour recuperer le nom comme il faut 36 # lors de l'installation 37 if (!headers_sent()) 38 header('Content-Type: text/html; charset=utf-8'); 39 40 return _DOCTYPE_ECRIRE. 41 html_lang_attributes(). 42 "<head>\n". 43 "<title>". 44 textebrut($titre). 45 "</title> 46 <style type='text/css'><!--\n/*<![CDATA[*/\n\n\n". 47 "body { background: #FFF; color: #000; }\n". 48 "h1 { color: #970038; margin-top: 50px; font-family: Verdana; font-weigth: bold; font-size: 18px }\n". 49 "h2 { font-family: Verdana,Arial,Sans,sans-serif; font-weigth: normal; }\n". 50 "a { color: #E86519; text-decoration: none; }\n". 51 "a:visited { color: #6E003A; }\n". 52 "a:active { color: #FF9900; }\n". 53 "img { border: 0; }\n". 54 "p { text-align: justify; }\n". 55 "ul { text-align: justify; list-style-type: none; }\n". 56 "fieldset, .fieldset { font-weigth: bold; text-align: justify; border: 1px solid #444; padding: 10px; margin-top: 1em; }\n". 57 "legend { font-weight: bold; }\n". 58 "label {}\n". 59 "#minipres { width: 30em; text-align: center; margin-left: auto; margin-right: auto; }\n". 60 ".petit-centre { font-family: Verdana,Arial,Sans,sans-serif; font-size: 10px; }\n". 61 ".petit-centre p { text-align: center; }\n". 62 ".suivant { text-align: $spip_lang_right; display: block; margin-top: 1em; }\n". 63 ".fondl { padding: 3px; background-color: #eee; border: 1px solid #333; 64 background-position: center bottom; 65 font-size: 0.8em; 66 font-family: Verdana,Arial,Sans,sans-serif; }\n". 67 ".formo { width: 100%; display: block; padding: 3px; 68 margin-top: 1em; 69 background-color: #FFF; 70 border: 1px solid #333; 71 background-position: center bottom; 72 behavior: url(../dist/win_width.htc); 73 font-size: 0.8em; 74 font-family: Verdana,Arial,Sans,sans-serif; }\n". 75 "\n\n]]>\n--></style>\n\n 76 <script type='text/javascript' src='" 77 . _DIR_JAVASCRIPT . "spip_barre.js'></script> 78 </head> 79 <body".$onLoad."> 80 <div id='minipres'> 81 <h1>". 82 $titre . 83 "</h1> 84 <div>\n"; 85 } 86 87 // http://doc.spip.org/@install_fin_html 88 function install_fin_html() { 89 return "\n\t</div>\n\t</div>\n</body>\n</html>"; 90 } 91 92 // http://doc.spip.org/@info_etape 93 function info_etape($titre, $complement = ''){ 94 return "\n<h2>".$titre."</h2>\n" . 95 ($complement ? "<p>".$complement."</p>\n":''); 96 } 97 98 // http://doc.spip.org/@fieldset 99 function fieldset($legend, $champs = array(), $horchamps='') { 100 $fieldset = "<fieldset>\n" . 101 ($legend ? "<legend>".$legend."</legend>\n" : ''); 102 foreach ($champs as $nom => $contenu) { 103 $type = $contenu['hidden'] ? 'hidden' : (preg_match(',^pass,', $nom) ? 'password' : 'text'); 104 $class = $contenu['hidden'] ? '' : "class='formo' size='40' "; 105 $fieldset .= "<label for='".$nom."'>".$contenu['label']."</label>\n"; 106 if(is_array($contenu['alternatives'])) { 107 foreach($contenu['alternatives'] as $valeur => $label) { 108 $fieldset .= "<input type='radio' name='".$nom . 109 "'\nvalue='".$valeur."' ".(($valeur==$contenu['valeur'])?"checked='checked'":'')."/>\n"; 110 $fieldset .= "<label for='".$valeur."'>".$label."</label>\n"; 111 } 112 $fieldset .= "<br />\n"; 113 } 114 else { 115 $fieldset .= "<input ".$class."type='".$type."' name='".$nom."'\nvalue='".$contenu['valeur']."' />\n"; 116 } 117 } 118 $fieldset .= "$horchamps</fieldset>\n"; 119 return $fieldset; 120 } 121 122 // http://doc.spip.org/@bouton_suivant 123 function bouton_suivant($code = '') { 124 if($code=='') $code = _T('bouton_suivant'); 125 static $suivant = 0; 126 $id = 'suivant'.(($suivant>0)?strval($suivant):''); 127 $suivant +=1; 128 return "\n<span class='suivant'><input id='".$id."' type='submit' class='fondl'\nvalue=\"" . 129 $code . 130 " >>\" /></span>\n"; 131 } 132 133 // http://doc.spip.org/@minipres 134 function minipres($titre='', $corps="", $onload='') 135 { 136 if (!$titre) { 137 $titre = _T('info_acces_interdit'); 138 $corps = _request(_DIR_RESTREINT ? 'action' : 'exec'); 139 spip_log($GLOBALS['auteur_session']['nom'] . " $titre " . $_SERVER['REQUEST_URI']); 140 } 141 142 return install_debut_html($titre, $onload) 143 . $corps 144 . install_fin_html(); 145 } 146 147 // 148 // Aide. Surchargeable, et pas d'ereur fatale si pas disponible. 149 // 150 151 // http://doc.spip.org/@aide 152 function aide($aide='') { 153 $aider = charger_fonction('aider', 'inc', true); 154 return $aider ? $aider($aide) : ''; 155 } 156 157 158 // 159 // Mention de la revision SVN courante de l'espace restreint standard 160 // (numero non garanti pour l'espace public et en cas de mutualisation) 161 // on est negatif si on est sur .svn, et positif si on utilise svn.revision 162 // http://doc.spip.org/@version_svn_courante 163 function version_svn_courante($dir) { 164 if (!$dir) $dir = '.'; 165 166 // version installee par paquet ZIP 167 if (lire_fichier($dir.'/svn.revision', $c) 168 AND preg_match(',Revision: (\d+),', $c, $d)) 169 return intval($d[1]); 170 171 // version installee par SVN 172 if (lire_fichier($dir . '/.svn/entries', $c) 173 AND ( 174 (preg_match_all( 175 ',committed-rev="([0-9]+)",', $c, $r1, PREG_PATTERN_ORDER) 176 AND $v = max($r1[1]) 177 ) 178 OR 179 (preg_match(',^8.*dir[\r\n]+(\d+),ms', $c, $r1) # svn >= 1.4 180 AND $v = $r1[1] 181 ))) 182 return -$v; 183 184 // Bug ou paquet fait main 185 return 0; 186 } 187 188 // http://doc.spip.org/@info_copyright 189 function info_copyright() { 190 global $spip_version_affichee, $spip_lang; 191 192 $version = $spip_version_affichee; 193 194 // 195 // Mention, le cas echeant, de la revision SVN courante 196 // 197 if ($svn_revision = version_svn_courante(_DIR_RACINE)) { 198 $version .= ' ' . (($svn_revision < 0) ? 'SVN ':'') 199 . "[<a href='http://trac.rezo.net/trac/spip/changeset/" 200 . abs($svn_revision) . "' onclick=\"window.open(this.href); return false;\">" 201 . abs($svn_revision) . "</a>]"; 202 } 203 204 return _T('info_copyright', 205 array('spip' => "<b>SPIP $version</b> ", 206 'lien_gpl' => 207 "<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>")); 208 209 } 210 211 // normalement il faudrait creer exec/info.php, mais pour mettre juste ca: 212 213 // http://doc.spip.org/@exec_info_dist 214 function exec_info_dist() { 215 global $connect_statut; 216 if ($connect_statut == '0minirezo') phpinfo(); 217 } 218 219 // Idem faudrait creer exec/test_ajax, mais c'est si court. 220 // Tester si Ajax fonctionne pour ce brouteur 221 // (si on arrive la c'est que c'est bon, donc poser le cookie) 222 223 // http://doc.spip.org/@exec_test_ajax_dist 224 function exec_test_ajax_dist() { 225 switch (_request('js')) { 226 // on est appele par <noscript> 227 case -1: 228 spip_setcookie('spip_accepte_ajax', -1); 229 include_spip('inc/headers'); 230 redirige_par_entete(_DIR_IMG_PACK.'puce-orange-anim.gif'); 231 break; 232 233 // ou par ajax 234 case 1: 235 default: 236 spip_setcookie('spip_accepte_ajax', 1); 237 break; 238 } 239 } 240 241 // Afficher le bouton "preview" dans l'espace public 242 // http://doc.spip.org/@afficher_bouton_preview 243 function afficher_bouton_preview() { 244 $x = _T('previsualisation'); 245 return '<div class="spip_large" style=" 246 display: block; 247 color: #eeeeee; 248 background-color: #111111; 249 padding-right: 5px; 250 padding-top: 2px; 251 padding-bottom: 5px; 252 top: 0px; 253 left: 0px; 254 position: absolute; 255 ">' 256 . http_img_pack('naviguer-site.png', $x, '') 257 . ' ' . majuscules($x) . '</div>'; 258 } 259 260 // Fabrique une balise A, avec tous les attributs possibles 261 // attention au cas ou la href est du Javascript avec des "'" 262 // pour un href conforme au validateur W3C, faire & --> & avant 263 264 // http://doc.spip.org/@http_href 265 function http_href($href, $clic, $title='', $style='', $class='', $evt='') { 266 return '<a href="' . 267 $href . 268 '"' . 269 (!$title ? '' : ("\ntitle=\"" . supprimer_tags($title)."\"")) . 270 (!$style ? '' : ("\nstyle=\"" . $style . "\"")) . 271 (!$class ? '' : ("\nclass=\"" . $class . "\"")) . 272 ($evt ? "\n$evt" : '') . 273 '>' . 274 $clic . 275 '</a>'; 276 } 277 278 // produit une balise img avec un champ alt d'office si vide 279 // attention le htmlentities et la traduction doivent etre appliques avant. 280 281 // http://doc.spip.org/@http_wrapper 282 function http_wrapper($img){ 283 static $wrapper_state=NULL; 284 static $wrapper_table = array(); 285 286 if (strpos($img,'/')===FALSE) // on ne prefixe par _DIR_IMG_PACK que si c'est un nom de fichier sans chemin 287 $f = _DIR_IMG_PACK . $img; 288 else { // sinon, le path a ete fourni 289 $f = $img; 290 // gerer quand meme le cas des hacks pre 1.9.2 ou l'on faisait un path relatif depuis img_pack 291 if (substr($f,0,strlen("../"._DIR_PLUGINS))=="../"._DIR_PLUGINS) 292 $f = substr($img,3); // on enleve le ../ qui ne faisait que ramener au rep courant 293 } 294 295 if ($wrapper_state==NULL){ 296 global $browser_name; 297 if (!strlen($browser_name)){include_spip('inc/layer');} 298 $wrapper_state = ($browser_name=="MSIE"); 299 } 300 if ($wrapper_state){ 301 if (!isset($wrapper_table[$d=dirname($f)])) { 302 $wrapper_table[$d] = false; 303 if (file_exists("$d/wrapper.php")) 304 $wrapper_table[$d] = "$d/wrapper.php?file="; 305 } 306 if ($wrapper_table[$d]) 307 $f = $wrapper_table[$d] . urlencode(basename($img)); 308 } 309 return $f; 310 } 311 // http://doc.spip.org/@http_img_pack 312 function http_img_pack($img, $alt, $att, $title='') { 313 314 return "<img src='" . http_wrapper($img) 315 . ("'\nalt=\"" . 316 str_replace('"','', textebrut($alt ? $alt : ($title ? $title : ''))) 317 . '" ') 318 . ($title ? "title=\"$title\" " : '') 319 . $att 320 . " />"; 321 } 322 323 // http://doc.spip.org/@http_href_img 324 function http_href_img($href, $img, $att, $alt, $title='', $style='', $class='', $evt='') { 325 if (!$title) $title = $alt; 326 return http_href($href, http_img_pack($img, $alt, $att), $title, $style, $class, $evt); 327 } 328 329 330 // http://doc.spip.org/@http_style_background 331 function http_style_background($img, $att='') 332 { 333 return " style='background: url(\"".http_wrapper($img)."\")" . 334 ($att ? (' ' . $att) : '') . ";'"; 335 } 336 337 // Pour les formulaires en methode POST, 338 // mettre les arguments a la fois en input-hidden et dans le champ action: 339 // 1) on peut ainsi memoriser le signet comme si c'etait un GET 340 // 2) ca suit http://en.wikipedia.org/wiki/Representational_State_Transfer 341 342 // Attention: generer_url_ecrire peut rajouter des args 343 344 // http://doc.spip.org/@generer_url_post_ecrire 345 function generer_url_post_ecrire($script, $args='', $name='', $ancre='', $onchange='') { 346 include_spip('inc/filtres'); 347 $action = generer_url_ecrire($script, $args); 348 if ($name) $name = " name='$name'"; 349 return "\n<form action='$action$ancre'$name method='post'$onchange>" 350 .form_hidden($action); 351 } 352 353 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 10:20:27 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |