3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2011 *
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;
14 include_spip('inc/presentation');
16 // http://doc.spip.org/@exec_sites_edit_dist
17 function exec_sites_edit_dist()
19 global $connect_statut, $connect_id_rubrique, $spip_lang_right;
21 $id_syndic = intval(_request('id_syndic'));
22 $row = sql_fetsel("*", "spip_syndic", "id_syndic=$id_syndic");
25 $id_syndic = $row["id_syndic"];
26 $id_rubrique = $row["id_rubrique"];
27 $nom_site = $row["nom_site"];
30 $id_rubrique = intval(_request('id_rubrique'));
34 $in = !$connect_id_rubrique ?
''
35 : sql_in('id_rubrique', $connect_id_rubrique);
36 $id_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', $in, '', 'id_rubrique DESC', 1);
38 if (!autoriser('creersitedans','rubrique',$id_rubrique )){
39 // manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises
40 $res = sql_select("id_rubrique", "spip_rubriques", "id_parent=0");
41 while (!autoriser('creersitedans','rubrique',$id_rubrique ) && $t = sql_fetch($res)){
42 $id_rubrique = $t['id_rubrique'];
47 if ( ($new!='oui' AND (!autoriser('voir','site',$id_syndic) OR !autoriser('modifier','site',$id_syndic)))
48 OR ($new=='oui' AND !autoriser('creersitedans','rubrique',$id_rubrique)) ){
49 include_spip('inc/minipres');
53 $commencer_page = charger_fonction('commencer_page', 'inc');
54 pipeline('exec_init',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
56 echo $commencer_page(_T('info_site_reference_2'), "naviguer", "sites", $id_rubrique);
58 echo debut_grand_cadre(true);
60 echo afficher_hierarchie($id_rubrique);
62 echo fin_grand_cadre(true);
64 echo debut_gauche('', true);
65 echo pipeline('affiche_gauche',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
66 echo creer_colonne_droite('', true);
67 echo pipeline('affiche_droite',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
68 echo debut_droite('', true);
71 'icone_retour'=>$new=='oui'?
'':icone_inline(_T('icone_retour'), generer_url_ecrire("sites","id_syndic=$id_syndic"), "site-24.gif", "rien.gif",$GLOBALS['spip_lang_left']),
72 'redirect'=>generer_url_ecrire("sites"),
74 'new'=>$new == "oui"?
$new:$id_syndic,
75 'id_rubrique'=>$id_rubrique,
76 'config_fonc'=>'sites_edit_config'
79 echo recuperer_fond("prive/editer/site", $contexte);
81 echo pipeline('affiche_milieu',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
82 echo fin_gauche(), fin_page();