[SPIP] ~2.1.12 -->2.1.25
[velocampus/web/www.git] / www / ecrire / exec / sites_edit.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2014 *
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 include_spip('inc/presentation');
15
16 // http://doc.spip.org/@exec_sites_edit_dist
17 function exec_sites_edit_dist()
18 {
19 global $connect_statut, $connect_id_rubrique, $spip_lang_right;
20
21 $id_syndic = intval(_request('id_syndic'));
22 $row = sql_fetsel("*", "spip_syndic", "id_syndic=$id_syndic");
23
24 if ($row) {
25 $id_syndic = $row["id_syndic"];
26 $id_rubrique = $row["id_rubrique"];
27 $nom_site = $row["nom_site"];
28 $new = false;
29 } else {
30 $id_rubrique = intval(_request('id_rubrique'));
31 $new = 'oui';
32 $nom_site = '';
33 if (!$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);
37 }
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'];
43 }
44 }
45 }
46
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');
50 echo minipres();
51 } else {
52
53 $commencer_page = charger_fonction('commencer_page', 'inc');
54 pipeline('exec_init',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
55
56 echo $commencer_page(_T('info_site_reference_2'), "naviguer", "sites", $id_rubrique);
57
58 echo debut_grand_cadre(true);
59
60 echo afficher_hierarchie($id_rubrique);
61
62 echo fin_grand_cadre(true);
63
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);
69
70 $contexte = array(
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"),
73 'titre'=>$nom_site,
74 'new'=>$new == "oui"?$new:$id_syndic,
75 'id_rubrique'=>$id_rubrique,
76 'config_fonc'=>'sites_edit_config'
77 );
78
79 echo recuperer_fond("prive/editer/site", $contexte);
80
81 echo pipeline('affiche_milieu',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
82 echo fin_gauche(), fin_page();
83 }
84 }
85 ?>