[ 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/presentation'); 16 include_spip('inc/forum'); 17 18 // http://doc.spip.org/@exec_naviguer_dist 19 function exec_naviguer_dist() 20 { 21 global $id_rubrique, $spip_display, $cherche_mot, $select_groupe; 22 23 $id_rubrique = intval($id_rubrique); 24 25 $row = spip_fetch_array(spip_query("SELECT * FROM spip_rubriques WHERE id_rubrique='$id_rubrique'")); 26 if ($row) { 27 $id_parent=$row['id_parent']; 28 $titre=$row['titre']; 29 $descriptif=$row['descriptif']; 30 $texte=$row['texte']; 31 $statut = $row['statut']; 32 $extra = $row["extra"]; 33 } elseif ($id_rubrique) 34 {include_spip('minipres'); 35 echo minipres(); 36 exit; 37 } 38 39 else $statut = $titre = $descriptif = $texte = $extra = $id_parent=''; 40 41 if ($id_rubrique == 0) $ze_logo = "racine-site-24.gif"; 42 else if ($id_parent == 0) $ze_logo = "secteur-24.gif"; 43 else $ze_logo = "rubrique-24.gif"; 44 45 $flag_editable = autoriser('publierdans','rubrique',$id_rubrique); 46 47 pipeline('exec_init',array('args'=>array('exec'=>'naviguer','id_rubrique'=>$id_rubrique),'data'=>'')); 48 49 $commencer_page = charger_fonction('commencer_page', 'inc'); 50 echo $commencer_page(($titre ? ("« ".textebrut(typo($titre))." »") : 51 _T('titre_naviguer_dans_le_site')), 52 "naviguer", 53 "rubriques", 54 $id_rubrique); 55 56 debut_grand_cadre(); 57 58 if ($id_rubrique > 0) echo afficher_hierarchie($id_parent); 59 else $titre = _T('info_racine_site').": ". $GLOBALS['meta']["nom_site"]; 60 fin_grand_cadre(); 61 62 changer_typo('', 'rubrique'.$id_rubrique); 63 64 if (!autoriser('voir','rubrique',$id_rubrique)){ 65 echo "<strong>"._T('avis_acces_interdit')."</strong>"; 66 fin_page(); 67 exit; 68 } 69 70 debut_gauche(); 71 72 if ($spip_display != 4) { 73 74 infos_naviguer($id_rubrique, $statut, $ze_logo); 75 76 // 77 // Logos de la rubrique 78 // 79 if ($flag_editable AND ($spip_display != 4)) { 80 $iconifier = charger_fonction('iconifier', 'inc'); 81 echo $iconifier('id_rubrique', $id_rubrique, 'naviguer'); 82 } 83 } 84 85 echo pipeline('affiche_gauche',array('args'=>array('exec'=>'naviguer','id_rubrique'=>$id_rubrique),'data'=>'')); 86 87 // 88 // Afficher les boutons de creation d'article et de breve 89 // 90 if ($spip_display != 4) { 91 raccourcis_naviguer($id_rubrique, $id_parent); 92 } 93 94 95 creer_colonne_droite(); 96 echo pipeline('affiche_droite',array('args'=>array('exec'=>'naviguer','id_rubrique'=>$id_rubrique),'data'=>'')); 97 debut_droite(); 98 99 debut_cadre_relief($ze_logo); 100 101 montre_naviguer($id_rubrique, $titre, $descriptif, $ze_logo, $flag_editable); 102 103 if ($extra) { 104 include_spip('inc/extra'); 105 echo extra_affichage($extra, "rubriques"); 106 } 107 108 /// Mots-cles 109 if ($id_rubrique > 0) { 110 $editer_mot = charger_fonction('editer_mot', 'inc'); 111 echo $editer_mot('rubrique', $id_rubrique, $cherche_mot, $select_groupe, $flag_editable); 112 } 113 114 115 if (strlen($texte) > 1) { 116 echo "\n<div class='verdana1 spip_medium'>", justifier(propre($texte)), "</div>"; 117 } 118 119 langue_naviguer($id_rubrique, $id_parent, $flag_editable); 120 121 fin_cadre_relief(); 122 123 echo afficher_enfant_rub($id_rubrique, autoriser('creerrubriquedans','rubrique',$id_rubrique), false); 124 125 echo contenu_naviguer($id_rubrique, $id_parent, $ze_logo, $flag_editable); 126 127 128 /// Documents associes a la rubrique 129 if ($id_rubrique > 0) { 130 131 echo naviguer_doc($id_rubrique, "rubrique", 'naviguer', $flag_editable); 132 } 133 134 echo pipeline('affiche_milieu',array('args'=>array('exec'=>'naviguer','id_rubrique'=>$id_rubrique),'data'=>'')); 135 136 137 ////// Supprimer cette rubrique (si vide) 138 139 bouton_supprimer_naviguer($id_rubrique, $id_parent, $ze_logo, $flag_editable); 140 141 echo fin_gauche(), fin_page(); 142 } 143 144 // http://doc.spip.org/@infos_naviguer 145 function infos_naviguer($id_rubrique, $statut, $ze_logo) 146 { 147 if ($id_rubrique > 0) { 148 $res = "\n<div style='font-weight: bold; text-align: center' class='verdana1 spip_xx-small'>" 149 . _T('titre_numero_rubrique') 150 . "<br /><span class='spip_xx-large'>" 151 . $id_rubrique 152 . '</span></div>'; 153 154 debut_boite_info(); 155 echo $res; 156 voir_en_ligne ('rubrique', $id_rubrique, $statut); 157 158 if (autoriser('publierdans','rubrique',$id_rubrique)) { 159 $id_parent = spip_fetch_array(spip_query("SELECT id_parent FROM spip_rubriques WHERE id_rubrique=$id_rubrique")); 160 if (!$id_parent['id_parent']) { 161 list($from, $where) = critere_statut_controle_forum('prop', $id_rubrique); 162 $n = spip_num_rows(spip_query("SELECT id_forum FROM $from" .($where ? (" WHERE $where") : ''))); 163 164 if ($n) 165 icone_horizontale(_T('icone_suivi_forum', array('nb_forums' => $n)), generer_url_ecrire("controle_forum","id_rubrique=$id_rubrique"), "suivi-forum-24.gif", ""); 166 } 167 } 168 fin_boite_info(); 169 170 $res = spip_query("SELECT DISTINCT A.nom, A.id_auteur FROM spip_auteurs AS A, spip_auteurs_rubriques AS B WHERE A.id_auteur=B.id_auteur AND id_rubrique=$id_rubrique AND A.statut='0minirezo'"); 171 if (spip_num_rows($res)) 172 { 173 echo '<br />'; 174 debut_cadre_relief("fiche-perso-24.gif", false, '', _T('info_administrateurs')); 175 while ($row = spip_fetch_array($res)) { 176 $id = $row['id_auteur']; 177 178 echo 179 http_img_pack('admin-12.gif','',''), 180 " <a href='", generer_url_ecrire('auteur_infos', "id_auteur=$id"), 181 "'>", 182 extraire_multi($row['nom']), 183 '</a><br />'; 184 } 185 fin_cadre_relief(); 186 } 187 } 188 } 189 190 191 // http://doc.spip.org/@raccourcis_naviguer 192 function raccourcis_naviguer($id_rubrique, $id_parent) 193 { 194 global $connect_statut; 195 196 $res = icone_horizontale(_T('icone_tous_articles'), generer_url_ecrire("articles_page"), "article-24.gif", '',false); 197 198 $n = spip_num_rows(spip_query("SELECT id_rubrique FROM spip_rubriques LIMIT 1")); 199 if ($n) { 200 if (autoriser('creerarticledans','rubrique',$id_rubrique)) 201 $res .= icone_horizontale(_T('icone_ecrire_article'), generer_url_ecrire("articles_edit","id_rubrique=$id_rubrique&new=oui"), "article-24.gif","creer.gif", false); 202 203 $activer_breves = $GLOBALS['meta']["activer_breves"]; 204 if (autoriser('creerbrevedans','rubrique',$id_rubrique,NULL,array('id_parent'=>$id_parent))) { 205 $res .= icone_horizontale(_T('icone_nouvelle_breve'), generer_url_ecrire("breves_edit","id_rubrique=$id_rubrique&new=oui"), "breve-24.gif","creer.gif", false); 206 } 207 } 208 else { 209 if ($connect_statut == '0minirezo') { 210 $res .= "<br />"._T('info_creation_rubrique'); 211 } 212 } 213 214 echo bloc_des_raccourcis($res); 215 } 216 217 // http://doc.spip.org/@langue_naviguer 218 function langue_naviguer($id_rubrique, $id_parent, $flag_editable) 219 { 220 221 if ($id_rubrique>0 AND $GLOBALS['meta']['multi_rubriques'] == 'oui' AND ($GLOBALS['meta']['multi_secteurs'] == 'non' OR $id_parent == 0) AND $flag_editable) { 222 223 $row = spip_fetch_array(spip_query("SELECT lang, langue_choisie FROM spip_rubriques WHERE id_rubrique=$id_rubrique")); 224 $langue_rubrique = $row['lang']; 225 $langue_choisie_rubrique = $row['langue_choisie']; 226 if ($id_parent) { 227 $row = spip_fetch_array(spip_query("SELECT lang FROM spip_rubriques WHERE id_rubrique=$id_parent")); 228 $langue_parent = $row['lang']; 229 } 230 if (!$langue_parent) 231 $langue_parent = $GLOBALS['meta']['langue_site']; 232 if (!$langue_rubrique) 233 $langue_rubrique = $langue_parent; 234 235 debut_cadre_enfonce('langues-24.gif'); 236 echo "<table border='0' cellspacing='0' cellpadding='3' width='100%'><tr><td style='background-color: #eeeecc' class='serif2'>"; 237 echo bouton_block_invisible('languesrubrique'); 238 echo "<b>"; 239 echo _T('titre_langue_rubrique'); 240 echo " (".traduire_nom_langue($langue_rubrique).")"; 241 echo "</b>"; 242 echo "</td></tr></table>"; 243 244 echo debut_block_invisible('languesrubrique'); 245 echo "<div class='verdana2' style='text-align: center;'>"; 246 echo menu_langues('changer_lang', $langue_rubrique, '', $langue_parent, redirige_action_auteur('instituer_langue_rubrique', "$id_rubrique-$id_parent","naviguer","id_rubrique=$id_rubrique")); 247 echo "</div>\n"; 248 echo fin_block(); 249 250 fin_cadre_enfonce(); 251 } 252 } 253 254 // http://doc.spip.org/@contenu_naviguer 255 function contenu_naviguer($id_rubrique, $id_parent) { 256 257 global $connect_toutes_rubriques, $spip_lang_right; 258 259 // 260 // Verifier les boucles a mettre en relief 261 // 262 263 $relief = spip_num_rows(spip_query("SELECT id_article FROM spip_articles AS articles WHERE id_rubrique='$id_rubrique' AND statut='prop' LIMIT 1")); 264 265 if (!$relief) { 266 $relief = spip_num_rows(spip_query("SELECT id_breve FROM spip_breves WHERE id_rubrique='$id_rubrique' AND (statut='prepa' OR statut='prop') LIMIT 1")); 267 } 268 269 if (!$relief AND $GLOBALS['meta']['activer_syndic'] != 'non') { 270 $relief = spip_num_rows(spip_query("SELECT id_syndic FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND statut='prop' LIMIT 1")); 271 } 272 273 if (!$relief AND $GLOBALS['meta']['activer_syndic'] != 'non' AND $connect_toutes_rubriques) { 274 $relief = spip_num_rows(spip_query("SELECT id_syndic FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND (syndication='off' OR syndication='sus') AND statut='publie' LIMIT 1")); 275 } 276 277 278 $res = ''; 279 280 if ($relief) { 281 282 $res .= debut_cadre_couleur('',true); 283 $res .= "<div class='verdana2' style='color: black;'><b>"._T('texte_en_cours_validation')."</b></div>"; 284 285 // 286 // Les articles a valider 287 // 288 $res .= afficher_articles(_T('info_articles_proposes'), array('WHERE' => "id_rubrique='$id_rubrique' AND statut='prop'", 'ORDER BY' => "date DESC")); 289 290 // 291 // Les breves a valider 292 // 293 $res .= afficher_breves('<b>' . _T('info_breves_valider') . '</b>', array("FROM" => 'spip_breves', 'WHERE' => "id_rubrique='$id_rubrique' AND (statut='prepa' OR statut='prop')", 'ORDER BY' => "date_heure DESC"), true); 294 295 296 // 297 // Les sites references a valider 298 // 299 if ($GLOBALS['meta']['activer_sites'] != 'non') { 300 include_spip('inc/sites_voir'); 301 $res .= afficher_sites('<b>' . _T('info_site_valider') . '</b>', array("FROM" => 'spip_syndic', 'WHERE' => "id_rubrique='$id_rubrique' AND statut='prop'", 'ORDER BY' => "nom_site")); 302 } 303 304 // 305 // Les sites a probleme 306 // 307 if ($GLOBALS['meta']['activer_sites'] != 'non' AND $connect_toutes_rubriques) { 308 include_spip('inc/sites_voir'); 309 $res .= afficher_sites('<b>' . _T('avis_sites_syndiques_probleme') . '</b>', array('FROM' => 'spip_syndic', 'WHERE' => "id_rubrique='$id_rubrique' AND (syndication='off' OR syndication='sus') AND statut='publie'", 'ORDER BY' => "nom_site")); 310 } 311 312 // Les articles syndiques en attente de validation 313 if ($id_rubrique == 0 AND $connect_toutes_rubriques) { 314 $cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_syndic_articles WHERE statut='dispo'")); 315 if ($cpt = $cpt['n']) 316 $res .= "<br /><small><a href='" . 317 generer_url_ecrire("sites_tous") . 318 "' style='color: black;'>" . 319 $cpt . 320 " " . 321 _T('info_liens_syndiques_1') . 322 " " . 323 _T('info_liens_syndiques_2') . 324 "</a></small>"; 325 } 326 327 $res .= fin_cadre_couleur(true); 328 } 329 330 ////////// Les articles en cours de redaction 331 ///////////////////////// 332 333 $res .= afficher_articles(_T('info_tous_articles_en_redaction'), array("WHERE" => "statut='prepa' AND id_rubrique='$id_rubrique'", 'ORDER BY' => "date DESC")); 334 335 336 ////////// Les articles publies 337 ///////////////////////// 338 339 $res .= afficher_articles(_T('info_tous_articles_presents'), array("WHERE" => "statut='publie' AND id_rubrique='$id_rubrique'", 'ORDER BY' => "date DESC")); 340 341 if (autoriser('creerarticledans','rubrique',$id_rubrique)){ 342 $res .= "<div align='$spip_lang_right'>" 343 . icone(_T('icone_ecrire_article'), generer_url_ecrire("articles_edit","id_rubrique=$id_rubrique&new=oui"), "article-24.gif", "creer.gif", '', 'non') 344 . "</div>"; 345 } 346 347 //// Les breves 348 349 $res .= afficher_breves('<b>' . _T('icone_ecrire_nouvel_article') . '</b>', array("FROM" => 'spip_breves', 'WHERE' => "id_rubrique='$id_rubrique' AND statut != 'prop' AND statut != 'prepa'", 'ORDER BY' => "date_heure DESC")); 350 351 352 if (autoriser('creerbrevedans','rubrique',$id_rubrique,NULL,array('id_parent'=>$id_parent))){ 353 $res .= "<br /><div align='$spip_lang_right'>" 354 . icone(_T('icone_nouvelle_breve'), generer_url_ecrire("breves_edit","id_rubrique=$id_rubrique&new=oui"), "breve-24.gif", "creer.gif",'','non') 355 . "</div>"; 356 } 357 358 //// Les sites references 359 360 if ($GLOBALS['meta']["activer_sites"] == 'oui') { 361 include_spip('inc/sites_voir'); 362 $res .= '<br />' . afficher_sites('<b>' . _T('titre_sites_references_rubrique') . '</b>', array("FROM" => 'spip_syndic', 'WHERE' => "id_rubrique='$id_rubrique' AND statut!='refuse' AND statut != 'prop' AND syndication NOT IN ('off','sus')", 'ORDER BY' => 'nom_site')); 363 364 if ($id_rubrique > 0 365 AND (autoriser('creersitedans','rubrique',$id_rubrique))) { 366 367 $res .= "<br /><div align='$spip_lang_right'>" 368 . icone(_T('info_sites_referencer'), generer_url_ecrire('sites_edit', "id_rubrique=$id_rubrique&redirect=" . generer_url_retour('naviguer', "id_rubrique=$id_rubrique")), "site-24.gif", "creer.gif",'', 'non') 369 . "</div>"; 370 } 371 } 372 return $res; 373 } 374 375 // http://doc.spip.org/@naviguer_doc 376 function naviguer_doc ($id, $type = "article", $script, $flag_editable) { 377 global $spip_lang_left; 378 379 if ($GLOBALS['meta']["documents_$type"]!='non' AND $flag_editable) { 380 381 $joindre = charger_fonction('joindre', 'inc'); 382 $res = debut_cadre_relief("image-24.gif", true, "", _T('titre_joindre_document')) 383 . $joindre($script, "id_$type=$id", $id, _T('info_telecharger_ordinateur'), 'document', $type,'',0,generer_url_ecrire("documenter","id_rubrique=$id&type=$type",true)) 384 . fin_cadre_relief(true); 385 386 // eviter le formulaire upload qui se promene sur la page 387 // a cause des position:relative incompris de MSIE 388 389 if (!($align = $GLOBALS['browser_name']=="MSIE")) { 390 $res = "\n<table width='50%' cellpadding='0' cellspacing='0' border='0'>\n<tr><td style='text-align: $spip_lang_left;'>\n$res</td></tr></table>"; 391 $align = " align='right'"; 392 } 393 $res = "<div$align>$res</div>"; 394 $res .= "<script src='"._DIR_JAVASCRIPT."async_upload.js' type='text/javascript'></script>\n"; 395 $res .= <<<EOF 396 <script type='text/javascript'> 397 $(".form_upload").async_upload(async_upload_portfolio_documents); 398 </script> 399 EOF; 400 } else $res =''; 401 402 $documenter = charger_fonction('documenter', 'inc'); 403 404 return "<div id='portfolio'>".$documenter($id, $type, 'portfolio', $flag_editable)."</div>" 405 ."<div id='documents'>". $documenter($id, $type, 'documents', $flag_editable)."</div>" 406 . $res; 407 } 408 409 // http://doc.spip.org/@montre_naviguer 410 function montre_naviguer($id_rubrique, $titre, $descriptif, $logo, $flag_editable) 411 { 412 global $spip_lang_right, $spip_lang_left; 413 414 echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>"; 415 echo "<tr><td style='width: 100%' valign='top'>"; 416 gros_titre((!acces_restreint_rubrique($id_rubrique) ? '' : 417 http_img_pack("admin-12.gif",'', "width='12' height='12'", 418 _T('info_administrer_rubrique'))) . 419 $titre); 420 echo "</td>"; 421 422 if ($id_rubrique > 0 AND $flag_editable) { 423 echo "<td>", http_img_pack("rien.gif", ' ', "width='5'") ."</td>\n"; 424 echo "<td align='$spip_lang_right' valign='top'>"; 425 icone(_T('icone_modifier_rubrique'), generer_url_ecrire("rubriques_edit","id_rubrique=$id_rubrique&retour=nav"), $logo, "edit.gif"); 426 echo "</td>"; 427 } 428 echo "</tr>\n"; 429 430 if (strlen($descriptif) > 1) { 431 echo "<tr><td><div align='$spip_lang_left' style='padding: 5px; border: 1px dashed #aaaaaa; ' class='verdana1 spip_small'>", propre($descriptif."~"), "</div></td></tr>\n"; 432 } 433 echo "</table>\n"; 434 } 435 436 // http://doc.spip.org/@tester_rubrique_vide 437 function tester_rubrique_vide($id_rubrique) { 438 $n = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_rubriques WHERE id_parent='$id_rubrique' LIMIT 1")); 439 if ($n['n'] > 0) return false; 440 441 $n = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_articles WHERE id_rubrique='$id_rubrique' AND (statut='publie' OR statut='prepa' OR statut='prop') LIMIT 1")); 442 if ($n['n'] > 0) return false; 443 444 $n = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_breves WHERE id_rubrique='$id_rubrique' AND (statut='publie' OR statut='prop') LIMIT 1")); 445 if ($n['n'] > 0) return false; 446 447 $n = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND (statut='publie' OR statut='prop') LIMIT 1")); 448 if ($n['n'] > 0) return false; 449 450 $n = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_documents_rubriques WHERE id_rubrique='$id_rubrique' LIMIT 1")); 451 if ($n['n'] > 0) return false; 452 453 return true; 454 } 455 456 // http://doc.spip.org/@bouton_supprimer_naviguer 457 function bouton_supprimer_naviguer($id_rubrique, $id_parent, $ze_logo, $flag_editable) 458 { 459 if (($id_rubrique>0) AND tester_rubrique_vide($id_rubrique) AND $flag_editable) { 460 461 echo "<div align='center'>"; 462 icone(_T('icone_supprimer_rubrique'), redirige_action_auteur('supprimer', "rubrique-$id_rubrique", "naviguer","id_rubrique=$id_parent"), $ze_logo, "supprimer.gif"); 463 echo "</div>"; 464 } 465 } 466 467 ?>
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 |
![]() |