Completed
Push — master ( feea64...6b28f6 )
by cam
01:26
created
prive/formulaires/traduire.php 1 patch
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 include_spip('inc/actions');
@@ -39,65 +39,65 @@  discard block
 block discarded – undo
39 39
  *     Contexte à transmettre au squelette du formulaire sinon
40 40
  */
41 41
 function formulaires_traduire_charger_dist($objet, $id_objet, $retour = '', $traduire = true) {
42
-	if (!intval($id_objet)) {
43
-		return false;
44
-	}
45
-	$valeurs = formulaires_editer_objet_charger($objet, $id_objet, null, 0, $retour, '');
46
-	// verifier que l'objet indique possede bien des champs id_trad et lang
47
-	// attention, charger renomme lang => langue pour ne pas perturber la langue d'affichage du squelette
48
-	if (!isset($valeurs['langue'])) {
49
-		return false;
50
-	}
51
-
52
-	$valeurs['editable'] = autoriser('changerlangue', $objet, $id_objet);
53
-	$valeurs['_langue'] = '';
54
-	$langue_parent = '';
55
-	$id_parent = '';
56
-	if (isset($valeurs['id_rubrique'])) {
57
-		$id_parent = $valeurs['id_rubrique'];
58
-	}
59
-	if (isset($valeurs['id_parent'])) {
60
-		$id_parent = $valeurs['id_parent'];
61
-	}
62
-	if ($id_parent) {
63
-		$langue_parent = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_parent));
64
-	}
65
-
66
-	if (!$langue_parent) {
67
-		$langue_parent = $GLOBALS['meta']['langue_site'];
68
-	}
69
-	if (
70
-		$valeurs['editable']
71
-		and in_array(table_objet_sql($objet), explode(',', $GLOBALS['meta']['multi_objets']))
72
-	) {
73
-		$valeurs['_langue'] = $valeurs['langue'];
74
-	}
75
-	$valeurs['langue_parent'] = $langue_parent;
76
-
77
-	$valeurs['_objet'] = $objet;
78
-	$valeurs['_id_objet'] = $id_objet;
79
-	$valeurs['changer_lang'] = '';
80
-
81
-
82
-	$valeurs['_traduisible'] = autoriser('changertraduction', $objet, $id_objet);
83
-	$valeurs['_traduire'] = '';
84
-	if (isset($valeurs['id_trad'])) {
85
-		$valeurs['_traduire'] = ($traduire ? ' ' : '');
86
-		$valeurs['_vue_traductions'] = 'prive/objets/liste/' . (trouver_fond(
87
-			$f = table_objet($objet) . '-trad',
88
-			'prive/objets/liste'
89
-		) ? $f : 'objets-trad');
90
-		// pour afficher la liste des trad sur la base de l'id_trad en base
91
-		// independamment d'une saisie en cours sur id_trad
92
-		$valeurs['_lister_id_trad'] = $valeurs['id_trad'];
93
-		$valeurs['_id_parent'] = $id_parent;
94
-	}
95
-
96
-	$valeurs['_saisie_en_cours'] = (!_request('annuler') and (_request('changer_lang') !== null
97
-		or _request('changer_id_trad') !== null));
98
-	$valeurs['_pipeline'] = ['traduire', ['type' => $objet, 'id' => $id_objet]];
99
-
100
-	return $valeurs;
42
+    if (!intval($id_objet)) {
43
+        return false;
44
+    }
45
+    $valeurs = formulaires_editer_objet_charger($objet, $id_objet, null, 0, $retour, '');
46
+    // verifier que l'objet indique possede bien des champs id_trad et lang
47
+    // attention, charger renomme lang => langue pour ne pas perturber la langue d'affichage du squelette
48
+    if (!isset($valeurs['langue'])) {
49
+        return false;
50
+    }
51
+
52
+    $valeurs['editable'] = autoriser('changerlangue', $objet, $id_objet);
53
+    $valeurs['_langue'] = '';
54
+    $langue_parent = '';
55
+    $id_parent = '';
56
+    if (isset($valeurs['id_rubrique'])) {
57
+        $id_parent = $valeurs['id_rubrique'];
58
+    }
59
+    if (isset($valeurs['id_parent'])) {
60
+        $id_parent = $valeurs['id_parent'];
61
+    }
62
+    if ($id_parent) {
63
+        $langue_parent = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_parent));
64
+    }
65
+
66
+    if (!$langue_parent) {
67
+        $langue_parent = $GLOBALS['meta']['langue_site'];
68
+    }
69
+    if (
70
+        $valeurs['editable']
71
+        and in_array(table_objet_sql($objet), explode(',', $GLOBALS['meta']['multi_objets']))
72
+    ) {
73
+        $valeurs['_langue'] = $valeurs['langue'];
74
+    }
75
+    $valeurs['langue_parent'] = $langue_parent;
76
+
77
+    $valeurs['_objet'] = $objet;
78
+    $valeurs['_id_objet'] = $id_objet;
79
+    $valeurs['changer_lang'] = '';
80
+
81
+
82
+    $valeurs['_traduisible'] = autoriser('changertraduction', $objet, $id_objet);
83
+    $valeurs['_traduire'] = '';
84
+    if (isset($valeurs['id_trad'])) {
85
+        $valeurs['_traduire'] = ($traduire ? ' ' : '');
86
+        $valeurs['_vue_traductions'] = 'prive/objets/liste/' . (trouver_fond(
87
+            $f = table_objet($objet) . '-trad',
88
+            'prive/objets/liste'
89
+        ) ? $f : 'objets-trad');
90
+        // pour afficher la liste des trad sur la base de l'id_trad en base
91
+        // independamment d'une saisie en cours sur id_trad
92
+        $valeurs['_lister_id_trad'] = $valeurs['id_trad'];
93
+        $valeurs['_id_parent'] = $id_parent;
94
+    }
95
+
96
+    $valeurs['_saisie_en_cours'] = (!_request('annuler') and (_request('changer_lang') !== null
97
+        or _request('changer_id_trad') !== null));
98
+    $valeurs['_pipeline'] = ['traduire', ['type' => $objet, 'id' => $id_objet]];
99
+
100
+    return $valeurs;
101 101
 }
102 102
 
103 103
 /**
@@ -115,32 +115,32 @@  discard block
 block discarded – undo
115 115
  *     Erreurs des saisies
116 116
  */
117 117
 function formulaires_traduire_verifier_dist($objet, $id_objet, $retour = '', $traduire = true) {
118
-	$erreurs = [];
119
-
120
-	if (null !== _request('changer_lang')) {
121
-		$erreurs = formulaires_editer_objet_verifier($objet, $id_objet, ['changer_lang']);
122
-	}
123
-
124
-	// si id_trad fourni, verifier que cela ne conflicte pas avec un id_trad existant
125
-	// et que ca reference bien un objet existant
126
-	if ($id_trad = _request('id_trad')) {
127
-		$table_objet_sql = table_objet_sql($objet);
128
-		$_id_table_objet = id_table_objet($objet);
129
-		if (
130
-			sql_getfetsel(
131
-				'id_trad',
132
-				$table_objet_sql,
133
-				"$_id_table_objet=" . intval($id_objet)
134
-			)
135
-		) {
136
-			// ne devrait jamais arriver sauf concurence de saisie
137
-			$erreurs['id_trad'] = _L('Une traduction est deja referencee');
138
-		} elseif (!sql_getfetsel($_id_table_objet, $table_objet_sql, "$_id_table_objet=" . intval($id_trad))) {
139
-			$erreurs['id_trad'] = _L('Indiquez un contenu existant');
140
-		}
141
-	}
142
-
143
-	return $erreurs;
118
+    $erreurs = [];
119
+
120
+    if (null !== _request('changer_lang')) {
121
+        $erreurs = formulaires_editer_objet_verifier($objet, $id_objet, ['changer_lang']);
122
+    }
123
+
124
+    // si id_trad fourni, verifier que cela ne conflicte pas avec un id_trad existant
125
+    // et que ca reference bien un objet existant
126
+    if ($id_trad = _request('id_trad')) {
127
+        $table_objet_sql = table_objet_sql($objet);
128
+        $_id_table_objet = id_table_objet($objet);
129
+        if (
130
+            sql_getfetsel(
131
+                'id_trad',
132
+                $table_objet_sql,
133
+                "$_id_table_objet=" . intval($id_objet)
134
+            )
135
+        ) {
136
+            // ne devrait jamais arriver sauf concurence de saisie
137
+            $erreurs['id_trad'] = _L('Une traduction est deja referencee');
138
+        } elseif (!sql_getfetsel($_id_table_objet, $table_objet_sql, "$_id_table_objet=" . intval($id_trad))) {
139
+            $erreurs['id_trad'] = _L('Indiquez un contenu existant');
140
+        }
141
+    }
142
+
143
+    return $erreurs;
144 144
 }
145 145
 
146 146
 
@@ -159,32 +159,32 @@  discard block
 block discarded – undo
159 159
  *     Retour des traitements
160 160
  */
161 161
 function formulaires_traduire_traiter_dist($objet, $id_objet, $retour = '', $traduire = true) {
162
-	$res = [];
163
-	if (!_request('annuler') and autoriser('changerlangue', $objet, $id_objet)) {
164
-		// action/editer_xxx doit traiter la modif de changer_lang
165
-		$res = formulaires_editer_objet_traiter($objet, $id_objet, 0, 0, $retour);
166
-	}
167
-	if (!_request('annuler') and autoriser('changertraduction', $objet, $id_objet)) {
168
-		if ($id_trad = _request('id_trad') or _request('supprimer_trad')) {
169
-			$referencer_traduction = charger_fonction('referencer_traduction', 'action');
170
-			$referencer_traduction($objet, $id_objet, intval($id_trad)); // 0 si supprimer_trad
171
-		} elseif (
172
-			$new_id_trad = _request('changer_reference_trad')
173
-			and $new_id_trad = array_keys($new_id_trad)
174
-			and $new_id_trad = reset($new_id_trad)
175
-		) {
176
-			$table_objet_sql = table_objet_sql($objet);
177
-			$_id_table_objet = id_table_objet($objet);
178
-			if ($id_trad = sql_getfetsel('id_trad', $table_objet_sql, "$_id_table_objet=" . intval($id_objet))) {
179
-				$referencer_traduction = charger_fonction('referencer_traduction', 'action');
180
-				$referencer_traduction($objet, $id_trad, $new_id_trad);
181
-			}
182
-		}
183
-	}
184
-	$res['editable'] = true;
185
-	if (!isset($res['message_erreur'])) {
186
-		set_request('annuler', 'annuler');
187
-	} // provoquer la fermeture du forumlaire
188
-
189
-	return $res;
162
+    $res = [];
163
+    if (!_request('annuler') and autoriser('changerlangue', $objet, $id_objet)) {
164
+        // action/editer_xxx doit traiter la modif de changer_lang
165
+        $res = formulaires_editer_objet_traiter($objet, $id_objet, 0, 0, $retour);
166
+    }
167
+    if (!_request('annuler') and autoriser('changertraduction', $objet, $id_objet)) {
168
+        if ($id_trad = _request('id_trad') or _request('supprimer_trad')) {
169
+            $referencer_traduction = charger_fonction('referencer_traduction', 'action');
170
+            $referencer_traduction($objet, $id_objet, intval($id_trad)); // 0 si supprimer_trad
171
+        } elseif (
172
+            $new_id_trad = _request('changer_reference_trad')
173
+            and $new_id_trad = array_keys($new_id_trad)
174
+            and $new_id_trad = reset($new_id_trad)
175
+        ) {
176
+            $table_objet_sql = table_objet_sql($objet);
177
+            $_id_table_objet = id_table_objet($objet);
178
+            if ($id_trad = sql_getfetsel('id_trad', $table_objet_sql, "$_id_table_objet=" . intval($id_objet))) {
179
+                $referencer_traduction = charger_fonction('referencer_traduction', 'action');
180
+                $referencer_traduction($objet, $id_trad, $new_id_trad);
181
+            }
182
+        }
183
+    }
184
+    $res['editable'] = true;
185
+    if (!isset($res['message_erreur'])) {
186
+        set_request('annuler', 'annuler');
187
+    } // provoquer la fermeture du forumlaire
188
+
189
+    return $res;
190 190
 }
Please login to merge, or discard this patch.
prive/formulaires/recherche_ecrire.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
  * @return array Environnement du formulaire
34 34
  **/
35 35
 function formulaires_recherche_ecrire_charger_dist($action = '', $class = '') {
36
-	if ($GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site']) {
37
-		$lang = $GLOBALS['spip_lang'];
38
-	} else {
39
-		$lang = '';
40
-	}
36
+    if ($GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site']) {
37
+        $lang = $GLOBALS['spip_lang'];
38
+    } else {
39
+        $lang = '';
40
+    }
41 41
 
42
-	return
43
-		[
44
-			'action' => ($action ? $action : generer_url_ecrire('recherche')),
45
-			# action specifique, ne passe pas par Verifier, ni Traiter
46
-			'recherche' => _request('recherche'),
47
-			'lang' => $lang,
48
-			'class' => $class,
49
-			'_id_champ' => 'rechercher_' . substr(md5($action . $class), 0, 4),
50
-		];
42
+    return
43
+        [
44
+            'action' => ($action ? $action : generer_url_ecrire('recherche')),
45
+            # action specifique, ne passe pas par Verifier, ni Traiter
46
+            'recherche' => _request('recherche'),
47
+            'lang' => $lang,
48
+            'class' => $class,
49
+            '_id_champ' => 'rechercher_' . substr(md5($action . $class), 0, 4),
50
+        ];
51 51
 }
Please login to merge, or discard this patch.
prive/formulaires/configurer_articles.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -11,65 +11,65 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 function formulaires_configurer_articles_charger_dist() {
18
-	$valeurs = [];
19
-	foreach (
20
-		[
21
-		'articles_surtitre',
22
-		'articles_soustitre',
23
-		'articles_descriptif',
24
-		'articles_chapeau',
25
-		'articles_texte',
26
-		'articles_ps',
27
-		'articles_redac',
28
-		'articles_urlref',
29
-		'post_dates',
30
-		'articles_redirection',
31
-		] as $m
32
-	) {
33
-		$valeurs[$m] = $GLOBALS['meta'][$m];
34
-	}
18
+    $valeurs = [];
19
+    foreach (
20
+        [
21
+        'articles_surtitre',
22
+        'articles_soustitre',
23
+        'articles_descriptif',
24
+        'articles_chapeau',
25
+        'articles_texte',
26
+        'articles_ps',
27
+        'articles_redac',
28
+        'articles_urlref',
29
+        'post_dates',
30
+        'articles_redirection',
31
+        ] as $m
32
+    ) {
33
+        $valeurs[$m] = $GLOBALS['meta'][$m];
34
+    }
35 35
 
36
-	return $valeurs;
36
+    return $valeurs;
37 37
 }
38 38
 
39 39
 
40 40
 function formulaires_configurer_articles_traiter_dist() {
41
-	$res = ['editable' => true];
42
-	$purger_skel = false;
43
-	// Purger les squelettes si un changement de meta les affecte
44
-	if ($i = _request('post_dates') and ($i != $GLOBALS['meta']['post_dates'])) {
45
-		$purger_skel = true;
46
-	}
41
+    $res = ['editable' => true];
42
+    $purger_skel = false;
43
+    // Purger les squelettes si un changement de meta les affecte
44
+    if ($i = _request('post_dates') and ($i != $GLOBALS['meta']['post_dates'])) {
45
+        $purger_skel = true;
46
+    }
47 47
 
48
-	foreach (
49
-		[
50
-		'articles_surtitre',
51
-		'articles_soustitre',
52
-		'articles_descriptif',
53
-		'articles_chapeau',
54
-		'articles_texte',
55
-		'articles_ps',
56
-		'articles_redac',
57
-		'articles_urlref',
58
-		'post_dates',
59
-		'articles_redirection',
60
-		] as $m
61
-	) {
62
-		if (!is_null($v = _request($m))) {
63
-			ecrire_meta($m, $v == 'oui' ? 'oui' : 'non');
64
-		}
65
-	}
48
+    foreach (
49
+        [
50
+        'articles_surtitre',
51
+        'articles_soustitre',
52
+        'articles_descriptif',
53
+        'articles_chapeau',
54
+        'articles_texte',
55
+        'articles_ps',
56
+        'articles_redac',
57
+        'articles_urlref',
58
+        'post_dates',
59
+        'articles_redirection',
60
+        ] as $m
61
+    ) {
62
+        if (!is_null($v = _request($m))) {
63
+            ecrire_meta($m, $v == 'oui' ? 'oui' : 'non');
64
+        }
65
+    }
66 66
 
67
-	if ($purger_skel) {
68
-		include_spip('inc/invalideur');
69
-		purger_repertoire(_DIR_SKELS);
70
-	}
67
+    if ($purger_skel) {
68
+        include_spip('inc/invalideur');
69
+        purger_repertoire(_DIR_SKELS);
70
+    }
71 71
 
72
-	$res['message_ok'] = _T('config_info_enregistree');
72
+    $res['message_ok'] = _T('config_info_enregistree');
73 73
 
74
-	return $res;
74
+    return $res;
75 75
 }
Please login to merge, or discard this patch.
prive/formulaires/configurer_flux.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -11,36 +11,36 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 function formulaires_configurer_flux_charger_dist() {
18
-	$valeurs = [];
19
-	foreach (
20
-		[
21
-		'syndication_integrale'
22
-		] as $m
23
-	) {
24
-		$valeurs[$m] = $GLOBALS['meta'][$m];
25
-	}
26
-
27
-	return $valeurs;
18
+    $valeurs = [];
19
+    foreach (
20
+        [
21
+        'syndication_integrale'
22
+        ] as $m
23
+    ) {
24
+        $valeurs[$m] = $GLOBALS['meta'][$m];
25
+    }
26
+
27
+    return $valeurs;
28 28
 }
29 29
 
30 30
 
31 31
 function formulaires_configurer_flux_traiter_dist() {
32
-	$res = ['editable' => true];
33
-	foreach (
34
-		[
35
-		'syndication_integrale',
36
-		] as $m
37
-	) {
38
-		if (!is_null($v = _request($m))) {
39
-			ecrire_meta($m, $v == 'oui' ? 'oui' : 'non');
40
-		}
41
-	}
42
-
43
-	$res['message_ok'] = _T('config_info_enregistree');
44
-
45
-	return $res;
32
+    $res = ['editable' => true];
33
+    foreach (
34
+        [
35
+        'syndication_integrale',
36
+        ] as $m
37
+    ) {
38
+        if (!is_null($v = _request($m))) {
39
+            ecrire_meta($m, $v == 'oui' ? 'oui' : 'non');
40
+        }
41
+    }
42
+
43
+    $res['message_ok'] = _T('config_info_enregistree');
44
+
45
+    return $res;
46 46
 }
Please login to merge, or discard this patch.
prive/formulaires/editer_article.php 1 patch
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 include_spip('inc/actions');
@@ -46,33 +46,33 @@  discard block
 block discarded – undo
46 46
  *     Environnement du formulaire
47 47
  **/
48 48
 function formulaires_editer_article_charger_dist(
49
-	$id_article = 'new',
50
-	$id_rubrique = 0,
51
-	$retour = '',
52
-	$lier_trad = 0,
53
-	$config_fonc = 'articles_edit_config',
54
-	$row = [],
55
-	$hidden = ''
49
+    $id_article = 'new',
50
+    $id_rubrique = 0,
51
+    $retour = '',
52
+    $lier_trad = 0,
53
+    $config_fonc = 'articles_edit_config',
54
+    $row = [],
55
+    $hidden = ''
56 56
 ) {
57
-	$valeurs = formulaires_editer_objet_charger(
58
-		'article',
59
-		$id_article,
60
-		$id_rubrique,
61
-		$lier_trad,
62
-		$retour,
63
-		$config_fonc,
64
-		$row,
65
-		$hidden
66
-	);
67
-
68
-	if (intval($id_article) and !autoriser('modifier', 'article', intval($id_article))) {
69
-		$valeurs['editable'] = '';
70
-	}
71
-
72
-	// il faut enlever l'id_rubrique car la saisie se fait sur id_parent
73
-	// et id_rubrique peut etre passe dans l'url comme rubrique parent initiale
74
-	// et sera perdue si elle est supposee saisie
75
-	return $valeurs;
57
+    $valeurs = formulaires_editer_objet_charger(
58
+        'article',
59
+        $id_article,
60
+        $id_rubrique,
61
+        $lier_trad,
62
+        $retour,
63
+        $config_fonc,
64
+        $row,
65
+        $hidden
66
+    );
67
+
68
+    if (intval($id_article) and !autoriser('modifier', 'article', intval($id_article))) {
69
+        $valeurs['editable'] = '';
70
+    }
71
+
72
+    // il faut enlever l'id_rubrique car la saisie se fait sur id_parent
73
+    // et id_rubrique peut etre passe dans l'url comme rubrique parent initiale
74
+    // et sera perdue si elle est supposee saisie
75
+    return $valeurs;
76 76
 }
77 77
 
78 78
 /**
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
  *     Hash du formulaire
98 98
  */
99 99
 function formulaires_editer_article_identifier_dist(
100
-	$id_article = 'new',
101
-	$id_rubrique = 0,
102
-	$retour = '',
103
-	$lier_trad = 0,
104
-	$config_fonc = 'articles_edit_config',
105
-	$row = [],
106
-	$hidden = ''
100
+    $id_article = 'new',
101
+    $id_rubrique = 0,
102
+    $retour = '',
103
+    $lier_trad = 0,
104
+    $config_fonc = 'articles_edit_config',
105
+    $row = [],
106
+    $hidden = ''
107 107
 ) {
108
-	return serialize([intval($id_article), $lier_trad]);
108
+    return serialize([intval($id_article), $lier_trad]);
109 109
 }
110 110
 
111 111
 /**
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
  *     Configuration pour le formulaire
118 118
  */
119 119
 function articles_edit_config($row) {
120
-	global $spip_lang;
120
+    global $spip_lang;
121 121
 
122
-	$config = $GLOBALS['meta'];
123
-	$config['lignes'] = 8;
124
-	$config['langue'] = $spip_lang;
122
+    $config = $GLOBALS['meta'];
123
+    $config['lignes'] = 8;
124
+    $config['langue'] = $spip_lang;
125 125
 
126
-	$config['restreint'] = ($row['statut'] == 'publie');
126
+    $config['restreint'] = ($row['statut'] == 'publie');
127 127
 
128
-	return $config;
128
+    return $config;
129 129
 }
130 130
 
131 131
 /**
@@ -151,43 +151,43 @@  discard block
 block discarded – undo
151 151
  *     Erreurs du formulaire
152 152
  **/
153 153
 function formulaires_editer_article_verifier_dist(
154
-	$id_article = 'new',
155
-	$id_rubrique = 0,
156
-	$retour = '',
157
-	$lier_trad = 0,
158
-	$config_fonc = 'articles_edit_config',
159
-	$row = [],
160
-	$hidden = ''
154
+    $id_article = 'new',
155
+    $id_rubrique = 0,
156
+    $retour = '',
157
+    $lier_trad = 0,
158
+    $config_fonc = 'articles_edit_config',
159
+    $row = [],
160
+    $hidden = ''
161 161
 ) {
162
-	// auto-renseigner le titre si il n'existe pas
163
-	titre_automatique('titre', ['descriptif', 'chapo', 'texte']);
164
-	if (!_request('id_parent') and !intval($id_article)) {
165
-		$valeurs = formulaires_editer_objet_charger(
166
-			'article',
167
-			$id_article,
168
-			$id_rubrique,
169
-			$lier_trad,
170
-			$retour,
171
-			$config_fonc,
172
-			$row,
173
-			$hidden
174
-		);
175
-		set_request('id_parent', $valeurs['id_parent']);
176
-	}
177
-	// on ne demande pas le titre obligatoire : il sera rempli a la volee dans editer_article si vide
178
-	$erreurs = formulaires_editer_objet_verifier('article', $id_article, ['id_parent']);
179
-	// si on utilise le formulaire dans le public
180
-	if (!function_exists('autoriser')) {
181
-		include_spip('inc/autoriser');
182
-	}
183
-	if (
184
-		!isset($erreurs['id_parent'])
185
-		and !autoriser('creerarticledans', 'rubrique', _request('id_parent'))
186
-	) {
187
-		$erreurs['id_parent'] = _T('info_creerdansrubrique_non_autorise');
188
-	}
189
-
190
-	return $erreurs;
162
+    // auto-renseigner le titre si il n'existe pas
163
+    titre_automatique('titre', ['descriptif', 'chapo', 'texte']);
164
+    if (!_request('id_parent') and !intval($id_article)) {
165
+        $valeurs = formulaires_editer_objet_charger(
166
+            'article',
167
+            $id_article,
168
+            $id_rubrique,
169
+            $lier_trad,
170
+            $retour,
171
+            $config_fonc,
172
+            $row,
173
+            $hidden
174
+        );
175
+        set_request('id_parent', $valeurs['id_parent']);
176
+    }
177
+    // on ne demande pas le titre obligatoire : il sera rempli a la volee dans editer_article si vide
178
+    $erreurs = formulaires_editer_objet_verifier('article', $id_article, ['id_parent']);
179
+    // si on utilise le formulaire dans le public
180
+    if (!function_exists('autoriser')) {
181
+        include_spip('inc/autoriser');
182
+    }
183
+    if (
184
+        !isset($erreurs['id_parent'])
185
+        and !autoriser('creerarticledans', 'rubrique', _request('id_parent'))
186
+    ) {
187
+        $erreurs['id_parent'] = _T('info_creerdansrubrique_non_autorise');
188
+    }
189
+
190
+    return $erreurs;
191 191
 }
192 192
 
193 193
 /**
@@ -213,29 +213,29 @@  discard block
 block discarded – undo
213 213
  *     Retours des traitements
214 214
  **/
215 215
 function formulaires_editer_article_traiter_dist(
216
-	$id_article = 'new',
217
-	$id_rubrique = 0,
218
-	$retour = '',
219
-	$lier_trad = 0,
220
-	$config_fonc = 'articles_edit_config',
221
-	$row = [],
222
-	$hidden = ''
216
+    $id_article = 'new',
217
+    $id_rubrique = 0,
218
+    $retour = '',
219
+    $lier_trad = 0,
220
+    $config_fonc = 'articles_edit_config',
221
+    $row = [],
222
+    $hidden = ''
223 223
 ) {
224
-	// ici on ignore changer_lang qui est poste en cas de trad,
225
-	// car l'heuristique du choix de la langue est pris en charge par article_inserer
226
-	// en fonction de la config du site et de la rubrique choisie
227
-	if (!$lier_trad) {
228
-		set_request('changer_lang');
229
-	}
230
-
231
-	return formulaires_editer_objet_traiter(
232
-		'article',
233
-		$id_article,
234
-		$id_rubrique,
235
-		$lier_trad,
236
-		$retour,
237
-		$config_fonc,
238
-		$row,
239
-		$hidden
240
-	);
224
+    // ici on ignore changer_lang qui est poste en cas de trad,
225
+    // car l'heuristique du choix de la langue est pris en charge par article_inserer
226
+    // en fonction de la config du site et de la rubrique choisie
227
+    if (!$lier_trad) {
228
+        set_request('changer_lang');
229
+    }
230
+
231
+    return formulaires_editer_objet_traiter(
232
+        'article',
233
+        $id_article,
234
+        $id_rubrique,
235
+        $lier_trad,
236
+        $retour,
237
+        $config_fonc,
238
+        $row,
239
+        $hidden
240
+    );
241 241
 }
Please login to merge, or discard this patch.
prive/formulaires/configurer_previsualiseur.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,28 +11,28 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 include_spip('inc/presentation');
17 17
 
18 18
 function formulaires_configurer_previsualiseur_charger_dist() {
19
-	$valeurs = [];
20
-	$valeurs['preview'] = explode(',', $GLOBALS['meta']['preview']);
19
+    $valeurs = [];
20
+    $valeurs['preview'] = explode(',', $GLOBALS['meta']['preview']);
21 21
 
22
-	return $valeurs;
22
+    return $valeurs;
23 23
 }
24 24
 
25 25
 
26 26
 function formulaires_configurer_previsualiseur_traiter_dist() {
27
-	$res = ['editable' => true];
27
+    $res = ['editable' => true];
28 28
 
29
-	if ($i = _request('preview') and is_array($i)) {
30
-		$i = ',' . implode(',', $i) . ',';
31
-	}
29
+    if ($i = _request('preview') and is_array($i)) {
30
+        $i = ',' . implode(',', $i) . ',';
31
+    }
32 32
 
33
-	ecrire_meta('preview', $i);
33
+    ecrire_meta('preview', $i);
34 34
 
35
-	$res['message_ok'] = _T('config_info_enregistree');
35
+    $res['message_ok'] = _T('config_info_enregistree');
36 36
 
37
-	return $res;
37
+    return $res;
38 38
 }
Please login to merge, or discard this patch.
prive/formulaires/configurer_reducteur.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  **/
19 19
 
20 20
 if (!defined('_ECRIRE_INC_VERSION')) {
21
-	return;
21
+    return;
22 22
 }
23 23
 
24 24
 /**
@@ -28,24 +28,24 @@  discard block
 block discarded – undo
28 28
  *     Environnement du formulaire
29 29
  **/
30 30
 function formulaires_configurer_reducteur_charger_dist() {
31
-	$valeurs = [];
32
-	foreach (
33
-		[
34
-		'image_process',
35
-		'formats_graphiques',
36
-		'creer_preview',
37
-		'taille_preview',
38
-		] as $m
39
-	) {
40
-		$valeurs[$m] = isset($GLOBALS['meta'][$m]) ? $GLOBALS['meta'][$m] : null;
41
-	}
31
+    $valeurs = [];
32
+    foreach (
33
+        [
34
+        'image_process',
35
+        'formats_graphiques',
36
+        'creer_preview',
37
+        'taille_preview',
38
+        ] as $m
39
+    ) {
40
+        $valeurs[$m] = isset($GLOBALS['meta'][$m]) ? $GLOBALS['meta'][$m] : null;
41
+    }
42 42
 
43
-	$valeurs['taille_preview'] = intval($valeurs['taille_preview']);
44
-	if ($valeurs['taille_preview'] < 10) {
45
-		$valeurs['taille_preview'] = 120;
46
-	}
43
+    $valeurs['taille_preview'] = intval($valeurs['taille_preview']);
44
+    if ($valeurs['taille_preview'] < 10) {
45
+        $valeurs['taille_preview'] = 120;
46
+    }
47 47
 
48
-	return $valeurs;
48
+    return $valeurs;
49 49
 }
50 50
 
51 51
 
@@ -56,53 +56,53 @@  discard block
 block discarded – undo
56 56
  *     Retours des traitements
57 57
  **/
58 58
 function formulaires_configurer_reducteur_traiter_dist() {
59
-	$res = ['editable' => true];
59
+    $res = ['editable' => true];
60 60
 
61
-	if (is_array($image_process = _request('image_process_'))) {
62
-		$image_process = array_keys($image_process);
63
-		$image_process = reset($image_process);
61
+    if (is_array($image_process = _request('image_process_'))) {
62
+        $image_process = array_keys($image_process);
63
+        $image_process = reset($image_process);
64 64
 
65
-		// application du choix de vignette
66
-		if ($image_process) {
67
-			// mettre a jour les formats graphiques lisibles
68
-			switch ($image_process) {
69
-				case 'gd1':
70
-				case 'gd2':
71
-					$formats_graphiques = $GLOBALS['meta']['gd_formats_read'];
72
-					break;
73
-				case 'netpbm':
74
-					$formats_graphiques = $GLOBALS['meta']['netpbm_formats'];
75
-					break;
76
-				case 'convert':
77
-				case 'imagick':
78
-					$formats_graphiques = 'gif,jpg,png,webp';
79
-					break;
80
-				default: #debug
81
-					$formats_graphiques = '';
82
-					$image_process = 'non';
83
-					break;
84
-			}
85
-			ecrire_meta('formats_graphiques', $formats_graphiques, 'non');
86
-			ecrire_meta('image_process', $image_process, 'non');
87
-		}
88
-	}
65
+        // application du choix de vignette
66
+        if ($image_process) {
67
+            // mettre a jour les formats graphiques lisibles
68
+            switch ($image_process) {
69
+                case 'gd1':
70
+                case 'gd2':
71
+                    $formats_graphiques = $GLOBALS['meta']['gd_formats_read'];
72
+                    break;
73
+                case 'netpbm':
74
+                    $formats_graphiques = $GLOBALS['meta']['netpbm_formats'];
75
+                    break;
76
+                case 'convert':
77
+                case 'imagick':
78
+                    $formats_graphiques = 'gif,jpg,png,webp';
79
+                    break;
80
+                default: #debug
81
+                    $formats_graphiques = '';
82
+                    $image_process = 'non';
83
+                    break;
84
+            }
85
+            ecrire_meta('formats_graphiques', $formats_graphiques, 'non');
86
+            ecrire_meta('image_process', $image_process, 'non');
87
+        }
88
+    }
89 89
 
90
-	foreach (
91
-		[
92
-		'creer_preview'
93
-		] as $m
94
-	) {
95
-		if (!is_null($v = _request($m))) {
96
-			ecrire_meta($m, $v == 'oui' ? 'oui' : 'non');
97
-		}
98
-	}
99
-	if (!is_null($v = _request('taille_preview'))) {
100
-		ecrire_meta('taille_preview', intval($v));
101
-	}
90
+    foreach (
91
+        [
92
+        'creer_preview'
93
+        ] as $m
94
+    ) {
95
+        if (!is_null($v = _request($m))) {
96
+            ecrire_meta($m, $v == 'oui' ? 'oui' : 'non');
97
+        }
98
+    }
99
+    if (!is_null($v = _request('taille_preview'))) {
100
+        ecrire_meta('taille_preview', intval($v));
101
+    }
102 102
 
103
-	$res['message_ok'] = _T('config_info_enregistree');
103
+    $res['message_ok'] = _T('config_info_enregistree');
104 104
 
105
-	return $res;
105
+    return $res;
106 106
 }
107 107
 
108 108
 /**
@@ -115,37 +115,37 @@  discard block
 block discarded – undo
115 115
  *     URL d'action pour tester la librairie graphique en créant une vignette
116 116
  **/
117 117
 function url_vignette_choix($process) {
118
-	switch ($process) {
119
-		case 'gd2':
120
-			if (!function_exists('ImageCreateTrueColor')) {
121
-				return '';
122
-			}
123
-			break;
124
-		case 'gd1':
125
-			if (
126
-				!function_exists('ImageGif')
127
-				and !function_exists('ImageJpeg')
128
-				and !function_exists('ImagePng')
129
-			) {
130
-				return '';
131
-			}
132
-			break;
133
-		case 'netpbm':
134
-			if (defined('_PNMSCALE_COMMAND') and _PNMSCALE_COMMAND == '') {
135
-				return '';
136
-			}
137
-			break;
138
-		case 'imagick':
139
-			if (!method_exists('Imagick', 'readImage')) {
140
-				return '';
141
-			}
142
-			break;
143
-		case 'convert':
144
-			if (defined('_CONVERT_COMMAND') and _CONVERT_COMMAND == '') {
145
-				return '';
146
-			}
147
-			break;
148
-	}
118
+    switch ($process) {
119
+        case 'gd2':
120
+            if (!function_exists('ImageCreateTrueColor')) {
121
+                return '';
122
+            }
123
+            break;
124
+        case 'gd1':
125
+            if (
126
+                !function_exists('ImageGif')
127
+                and !function_exists('ImageJpeg')
128
+                and !function_exists('ImagePng')
129
+            ) {
130
+                return '';
131
+            }
132
+            break;
133
+        case 'netpbm':
134
+            if (defined('_PNMSCALE_COMMAND') and _PNMSCALE_COMMAND == '') {
135
+                return '';
136
+            }
137
+            break;
138
+        case 'imagick':
139
+            if (!method_exists('Imagick', 'readImage')) {
140
+                return '';
141
+            }
142
+            break;
143
+        case 'convert':
144
+            if (defined('_CONVERT_COMMAND') and _CONVERT_COMMAND == '') {
145
+                return '';
146
+            }
147
+            break;
148
+    }
149 149
 
150
-	return generer_url_action('tester', "arg=$process&time=" . time());
150
+    return generer_url_action('tester', "arg=$process&time=" . time());
151 151
 }
Please login to merge, or discard this patch.
prive/formulaires/configurer_langage.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -11,49 +11,49 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 function formulaires_configurer_langage_charger_dist() {
18 18
 
19
-	include_spip('inc/lang');
20
-	$GLOBALS['meta']['langues_proposees'] = '';
21
-	init_langues();
22
-	$langues = explode(',', $GLOBALS['meta']['langues_proposees']);
19
+    include_spip('inc/lang');
20
+    $GLOBALS['meta']['langues_proposees'] = '';
21
+    init_langues();
22
+    $langues = explode(',', $GLOBALS['meta']['langues_proposees']);
23 23
 
24 24
 
25
-	$valeurs = [
26
-		'var_lang_ecrire' => $GLOBALS['spip_lang'],
27
-		'_langues' => $langues
28
-	];
25
+    $valeurs = [
26
+        'var_lang_ecrire' => $GLOBALS['spip_lang'],
27
+        '_langues' => $langues
28
+    ];
29 29
 
30
-	return $valeurs;
30
+    return $valeurs;
31 31
 }
32 32
 
33 33
 
34 34
 function formulaires_configurer_langage_traiter_dist() {
35
-	include_spip('action/converser');
36
-	action_converser_changer_langue(true);
35
+    include_spip('action/converser');
36
+    action_converser_changer_langue(true);
37 37
 
38
-	refuser_traiter_formulaire_ajax();
38
+    refuser_traiter_formulaire_ajax();
39 39
 
40
-	// on ne peut pas changer la langue pour tout le hit ici,
41
-	// car CVT repasse derriere et retablit la langue avant l'appel a traiter()
42
-	// il faut rediriger !
43
-	return ['message_ok' => _T('config_info_enregistree'), 'editable' => true, 'redirect' => self()];
40
+    // on ne peut pas changer la langue pour tout le hit ici,
41
+    // car CVT repasse derriere et retablit la langue avant l'appel a traiter()
42
+    // il faut rediriger !
43
+    return ['message_ok' => _T('config_info_enregistree'), 'editable' => true, 'redirect' => self()];
44 44
 }
45 45
 
46 46
 function afficher_langues_choix($langues, $name, $id, $selected) {
47
-	include_spip('inc/lang');
48
-	$ret = '';
49
-	sort($langues);
50
-	foreach ($langues as $l) {
51
-		$checked = ($l == $selected) ? ' checked=\'checked\'' : '';
52
-		$ret .= "<div class='choix'>"
53
-			. "<input type='radio' name='$name' id='{$id}_$l' value='$l'$checked />"
54
-			. "<label for='{$id}_$l'>" . traduire_nom_langue($l) . '</label>'
55
-			. '</div>';
56
-	}
57
-
58
-	return $ret;
47
+    include_spip('inc/lang');
48
+    $ret = '';
49
+    sort($langues);
50
+    foreach ($langues as $l) {
51
+        $checked = ($l == $selected) ? ' checked=\'checked\'' : '';
52
+        $ret .= "<div class='choix'>"
53
+            . "<input type='radio' name='$name' id='{$id}_$l' value='$l'$checked />"
54
+            . "<label for='{$id}_$l'>" . traduire_nom_langue($l) . '</label>'
55
+            . '</div>';
56
+    }
57
+
58
+    return $ret;
59 59
 }
Please login to merge, or discard this patch.
prive/formulaires/rediriger_article.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,65 +11,65 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 function formulaires_rediriger_article_charger_dist($id_article, $retour = '') {
18 18
 
19
-	include_spip('inc/autoriser');
20
-	if (!autoriser('modifier', 'article', $id_article)) {
21
-		return false;
22
-	}
23
-
24
-	$row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article=' . intval($id_article));
25
-	if (!$row['id_article']) {
26
-		return false;
27
-	}
28
-	include_spip('inc/lien');
29
-	$redirection = virtuel_redirige($row['virtuel']);
30
-
31
-	if (
32
-		!$redirection
33
-		and $GLOBALS['meta']['articles_redirection'] != 'oui'
34
-	) {
35
-		return false;
36
-	}
37
-
38
-
39
-	include_spip('inc/texte');
40
-	$valeurs = [
41
-		'redirection' => $redirection,
42
-		'id' => $id_article,
43
-		'_afficher_url' => ($redirection ? propre("[->$redirection]") : ''),
44
-	];
45
-
46
-	return $valeurs;
19
+    include_spip('inc/autoriser');
20
+    if (!autoriser('modifier', 'article', $id_article)) {
21
+        return false;
22
+    }
23
+
24
+    $row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article=' . intval($id_article));
25
+    if (!$row['id_article']) {
26
+        return false;
27
+    }
28
+    include_spip('inc/lien');
29
+    $redirection = virtuel_redirige($row['virtuel']);
30
+
31
+    if (
32
+        !$redirection
33
+        and $GLOBALS['meta']['articles_redirection'] != 'oui'
34
+    ) {
35
+        return false;
36
+    }
37
+
38
+
39
+    include_spip('inc/texte');
40
+    $valeurs = [
41
+        'redirection' => $redirection,
42
+        'id' => $id_article,
43
+        '_afficher_url' => ($redirection ? propre("[->$redirection]") : ''),
44
+    ];
45
+
46
+    return $valeurs;
47 47
 }
48 48
 
49 49
 function formulaires_rediriger_article_verifier_dist($id_article, $retour = '') {
50
-	$erreurs = [];
50
+    $erreurs = [];
51 51
 
52
-	if (($redirection = _request('redirection')) == $id_article || $redirection == 'art' . $id_article) {
53
-		$erreurs['redirection'] = _T('info_redirection_boucle');
54
-	}
52
+    if (($redirection = _request('redirection')) == $id_article || $redirection == 'art' . $id_article) {
53
+        $erreurs['redirection'] = _T('info_redirection_boucle');
54
+    }
55 55
 
56
-	return $erreurs;
56
+    return $erreurs;
57 57
 }
58 58
 
59 59
 function formulaires_rediriger_article_traiter_dist($id_article, $retour = '') {
60 60
 
61
-	$url = preg_replace(',^\s*https?://$,i', '', rtrim(_request('redirection')));
62
-	if ($url) {
63
-		$url = corriger_caracteres($url);
64
-	}
61
+    $url = preg_replace(',^\s*https?://$,i', '', rtrim(_request('redirection')));
62
+    if ($url) {
63
+        $url = corriger_caracteres($url);
64
+    }
65 65
 
66
-	include_spip('action/editer_article');
67
-	article_modifier($id_article, ['virtuel' => $url]);
66
+    include_spip('action/editer_article');
67
+    article_modifier($id_article, ['virtuel' => $url]);
68 68
 
69
-	$js = _AJAX ? '<script type="text/javascript">if (window.ajaxReload) ajaxReload("wysiwyg");</script>' : '';
69
+    $js = _AJAX ? '<script type="text/javascript">if (window.ajaxReload) ajaxReload("wysiwyg");</script>' : '';
70 70
 
71
-	return [
72
-		'message_ok' => ($url ? _T('info_redirection_activee') : _T('info_redirection_desactivee')) . $js,
73
-		'editable' => true
74
-	];
71
+    return [
72
+        'message_ok' => ($url ? _T('info_redirection_activee') : _T('info_redirection_desactivee')) . $js,
73
+        'editable' => true
74
+    ];
75 75
 }
Please login to merge, or discard this patch.