@@ -10,25 +10,25 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | include_spip('inc/presentation'); |
| 16 | 16 | |
| 17 | 17 | function formulaires_configurer_previsualiseur_charger_dist() { |
| 18 | - return ['preview' => explode(',', (string) $GLOBALS['meta']['preview'])]; |
|
| 18 | + return ['preview' => explode(',', (string) $GLOBALS['meta']['preview'])]; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | function formulaires_configurer_previsualiseur_traiter_dist() { |
| 23 | - $res = ['editable' => true]; |
|
| 23 | + $res = ['editable' => true]; |
|
| 24 | 24 | |
| 25 | - if (($i = _request('preview')) && is_array($i)) { |
|
| 26 | - $i = ',' . implode(',', $i) . ','; |
|
| 27 | - } |
|
| 25 | + if (($i = _request('preview')) && is_array($i)) { |
|
| 26 | + $i = ',' . implode(',', $i) . ','; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - ecrire_meta('preview', $i); |
|
| 29 | + ecrire_meta('preview', $i); |
|
| 30 | 30 | |
| 31 | - $res['message_ok'] = _T('config_info_enregistree'); |
|
| 31 | + $res['message_ok'] = _T('config_info_enregistree'); |
|
| 32 | 32 | |
| 33 | - return $res; |
|
| 33 | + return $res; |
|
| 34 | 34 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | **/ |
| 17 | 17 | |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/actions'); |
@@ -46,30 +46,30 @@ discard block |
||
| 46 | 46 | * Environnement du formulaire |
| 47 | 47 | **/ |
| 48 | 48 | function formulaires_editer_rubrique_charger_dist( |
| 49 | - $id_rubrique = 'new', |
|
| 50 | - $id_parent = 0, |
|
| 51 | - $retour = '', |
|
| 52 | - $lier_trad = 0, |
|
| 53 | - $config_fonc = 'rubriques_edit_config', |
|
| 54 | - $row = [], |
|
| 55 | - $hidden = '' |
|
| 49 | + $id_rubrique = 'new', |
|
| 50 | + $id_parent = 0, |
|
| 51 | + $retour = '', |
|
| 52 | + $lier_trad = 0, |
|
| 53 | + $config_fonc = 'rubriques_edit_config', |
|
| 54 | + $row = [], |
|
| 55 | + $hidden = '' |
|
| 56 | 56 | ) { |
| 57 | - $valeurs = formulaires_editer_objet_charger( |
|
| 58 | - 'rubrique', |
|
| 59 | - $id_rubrique, |
|
| 60 | - $id_parent, |
|
| 61 | - $lier_trad, |
|
| 62 | - $retour, |
|
| 63 | - $config_fonc, |
|
| 64 | - $row, |
|
| 65 | - $hidden |
|
| 66 | - ); |
|
| 57 | + $valeurs = formulaires_editer_objet_charger( |
|
| 58 | + 'rubrique', |
|
| 59 | + $id_rubrique, |
|
| 60 | + $id_parent, |
|
| 61 | + $lier_trad, |
|
| 62 | + $retour, |
|
| 63 | + $config_fonc, |
|
| 64 | + $row, |
|
| 65 | + $hidden |
|
| 66 | + ); |
|
| 67 | 67 | |
| 68 | - if ((int) $id_rubrique && !autoriser('modifier', 'rubrique', (int) $id_rubrique)) { |
|
| 69 | - $valeurs['editable'] = ''; |
|
| 70 | - } |
|
| 68 | + if ((int) $id_rubrique && !autoriser('modifier', 'rubrique', (int) $id_rubrique)) { |
|
| 69 | + $valeurs['editable'] = ''; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - return $valeurs; |
|
| 72 | + return $valeurs; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | * Configuration pour le formulaire |
| 82 | 82 | */ |
| 83 | 83 | function rubriques_edit_config(array $row): array { |
| 84 | - return [ |
|
| 85 | - 'lignes' => 8, |
|
| 86 | - 'langue' => $GLOBALS['spip_lang'], |
|
| 87 | - 'restreint' => !$GLOBALS['connect_toutes_rubriques'] |
|
| 88 | - ]; |
|
| 84 | + return [ |
|
| 85 | + 'lignes' => 8, |
|
| 86 | + 'langue' => $GLOBALS['spip_lang'], |
|
| 87 | + 'restreint' => !$GLOBALS['connect_toutes_rubriques'] |
|
| 88 | + ]; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -110,15 +110,15 @@ discard block |
||
| 110 | 110 | * Hash du formulaire |
| 111 | 111 | */ |
| 112 | 112 | function formulaires_editer_rubrique_identifier_dist( |
| 113 | - $id_rubrique = 'new', |
|
| 114 | - $id_parent = 0, |
|
| 115 | - $retour = '', |
|
| 116 | - $lier_trad = 0, |
|
| 117 | - $config_fonc = 'rubriques_edit_config', |
|
| 118 | - $row = [], |
|
| 119 | - $hidden = '' |
|
| 113 | + $id_rubrique = 'new', |
|
| 114 | + $id_parent = 0, |
|
| 115 | + $retour = '', |
|
| 116 | + $lier_trad = 0, |
|
| 117 | + $config_fonc = 'rubriques_edit_config', |
|
| 118 | + $row = [], |
|
| 119 | + $hidden = '' |
|
| 120 | 120 | ) { |
| 121 | - return serialize([(int) $id_rubrique, $lier_trad]); |
|
| 121 | + return serialize([(int) $id_rubrique, $lier_trad]); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -144,34 +144,34 @@ discard block |
||
| 144 | 144 | * Erreurs du formulaire |
| 145 | 145 | **/ |
| 146 | 146 | function formulaires_editer_rubrique_verifier_dist( |
| 147 | - $id_rubrique = 'new', |
|
| 148 | - $id_parent = 0, |
|
| 149 | - $retour = '', |
|
| 150 | - $lier_trad = 0, |
|
| 151 | - $config_fonc = 'rubriques_edit_config', |
|
| 152 | - $row = [], |
|
| 153 | - $hidden = '' |
|
| 147 | + $id_rubrique = 'new', |
|
| 148 | + $id_parent = 0, |
|
| 149 | + $retour = '', |
|
| 150 | + $lier_trad = 0, |
|
| 151 | + $config_fonc = 'rubriques_edit_config', |
|
| 152 | + $row = [], |
|
| 153 | + $hidden = '' |
|
| 154 | 154 | ) { |
| 155 | - // auto-renseigner le titre si il n'existe pas |
|
| 156 | - titre_automatique('titre', ['descriptif', 'texte']); |
|
| 157 | - // on ne demande pas le titre obligatoire : il sera rempli a la volee dans editer_rubrique si vide |
|
| 158 | - $erreurs = formulaires_editer_objet_verifier('rubrique', $id_rubrique, []); |
|
| 155 | + // auto-renseigner le titre si il n'existe pas |
|
| 156 | + titre_automatique('titre', ['descriptif', 'texte']); |
|
| 157 | + // on ne demande pas le titre obligatoire : il sera rempli a la volee dans editer_rubrique si vide |
|
| 158 | + $erreurs = formulaires_editer_objet_verifier('rubrique', $id_rubrique, []); |
|
| 159 | 159 | |
| 160 | - // s'assurer qu'on ne s'auto-designe pas comme parent ! |
|
| 161 | - if ( |
|
| 162 | - (int) $id_rubrique |
|
| 163 | - && empty($erreurs['id_parent']) |
|
| 164 | - && ($id_parent = _request('id_parent')) |
|
| 165 | - ) { |
|
| 166 | - include_spip('inc/rubriques'); |
|
| 167 | - $branche = calcul_branche_in($id_rubrique); |
|
| 168 | - $branche = explode(',', (string) $branche); |
|
| 169 | - if (in_array($id_parent, $branche)) { |
|
| 170 | - $erreurs['id_parent'] = _L('Impossible de déplacer une rubrique dans sa propre branche, on tourne en rond !'); |
|
| 171 | - } |
|
| 172 | - } |
|
| 160 | + // s'assurer qu'on ne s'auto-designe pas comme parent ! |
|
| 161 | + if ( |
|
| 162 | + (int) $id_rubrique |
|
| 163 | + && empty($erreurs['id_parent']) |
|
| 164 | + && ($id_parent = _request('id_parent')) |
|
| 165 | + ) { |
|
| 166 | + include_spip('inc/rubriques'); |
|
| 167 | + $branche = calcul_branche_in($id_rubrique); |
|
| 168 | + $branche = explode(',', (string) $branche); |
|
| 169 | + if (in_array($id_parent, $branche)) { |
|
| 170 | + $erreurs['id_parent'] = _L('Impossible de déplacer une rubrique dans sa propre branche, on tourne en rond !'); |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | - return $erreurs; |
|
| 174 | + return $erreurs; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -197,22 +197,22 @@ discard block |
||
| 197 | 197 | * Retour des traitements |
| 198 | 198 | **/ |
| 199 | 199 | function formulaires_editer_rubrique_traiter_dist( |
| 200 | - $id_rubrique = 'new', |
|
| 201 | - $id_parent = 0, |
|
| 202 | - $retour = '', |
|
| 203 | - $lier_trad = 0, |
|
| 204 | - $config_fonc = 'rubriques_edit_config', |
|
| 205 | - $row = [], |
|
| 206 | - $hidden = '' |
|
| 200 | + $id_rubrique = 'new', |
|
| 201 | + $id_parent = 0, |
|
| 202 | + $retour = '', |
|
| 203 | + $lier_trad = 0, |
|
| 204 | + $config_fonc = 'rubriques_edit_config', |
|
| 205 | + $row = [], |
|
| 206 | + $hidden = '' |
|
| 207 | 207 | ) { |
| 208 | - return formulaires_editer_objet_traiter( |
|
| 209 | - 'rubrique', |
|
| 210 | - $id_rubrique, |
|
| 211 | - $id_parent, |
|
| 212 | - $lier_trad, |
|
| 213 | - $retour, |
|
| 214 | - $config_fonc, |
|
| 215 | - $row, |
|
| 216 | - $hidden |
|
| 217 | - ); |
|
| 208 | + return formulaires_editer_objet_traiter( |
|
| 209 | + 'rubrique', |
|
| 210 | + $id_rubrique, |
|
| 211 | + $id_parent, |
|
| 212 | + $lier_trad, |
|
| 213 | + $retour, |
|
| 214 | + $config_fonc, |
|
| 215 | + $row, |
|
| 216 | + $hidden |
|
| 217 | + ); |
|
| 218 | 218 | } |
@@ -1,94 +1,94 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | function formulaires_configurer_ecran_connexion_data(): array { |
| 4 | - return [ |
|
| 5 | - 'couleur_defaut' => '#db1762', |
|
| 6 | - 'img_fond' => _DIR_IMG . 'spip_fond_login.jpg', |
|
| 7 | - ]; |
|
| 4 | + return [ |
|
| 5 | + 'couleur_defaut' => '#db1762', |
|
| 6 | + 'img_fond' => _DIR_IMG . 'spip_fond_login.jpg', |
|
| 7 | + ]; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | function formulaires_configurer_ecran_connexion_charger_dist() { |
| 11 | - include_spip('inc/config'); |
|
| 12 | - include_spip('inc/autoriser'); |
|
| 11 | + include_spip('inc/config'); |
|
| 12 | + include_spip('inc/autoriser'); |
|
| 13 | 13 | |
| 14 | - $data = formulaires_configurer_ecran_connexion_data(); |
|
| 14 | + $data = formulaires_configurer_ecran_connexion_data(); |
|
| 15 | 15 | |
| 16 | - $valeurs = [ |
|
| 17 | - 'couleur_login' => lire_config('couleur_login', $data['couleur_defaut']), |
|
| 18 | - 'couleur_defaut_login' => $data['couleur_defaut'], |
|
| 19 | - 'upload_image_fond_login' => '', |
|
| 20 | - ]; |
|
| 16 | + $valeurs = [ |
|
| 17 | + 'couleur_login' => lire_config('couleur_login', $data['couleur_defaut']), |
|
| 18 | + 'couleur_defaut_login' => $data['couleur_defaut'], |
|
| 19 | + 'upload_image_fond_login' => '', |
|
| 20 | + ]; |
|
| 21 | 21 | |
| 22 | - if (file_exists($data['img_fond'])) { |
|
| 23 | - $valeurs['src_img'] = $data['img_fond']; |
|
| 24 | - } |
|
| 22 | + if (file_exists($data['img_fond'])) { |
|
| 23 | + $valeurs['src_img'] = $data['img_fond']; |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - return $valeurs; |
|
| 26 | + return $valeurs; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | function formulaires_configurer_ecran_connexion_verifier_dist() { |
| 31 | - $erreurs = []; |
|
| 32 | - |
|
| 33 | - if (_request('supprimer_image_fond_login')) { |
|
| 34 | - // rien à tester |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - elseif (_request('supprimer_couleur_login')) { |
|
| 38 | - // rien à tester |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - elseif (!empty($_FILES['upload_image_fond_login'])) { |
|
| 42 | - $file = $_FILES['upload_image_fond_login']; |
|
| 43 | - include_spip('inc/documents'); |
|
| 44 | - $extension = pathinfo((string) $file['name'], PATHINFO_EXTENSION); |
|
| 45 | - $extension = corriger_extension(strtolower($extension)); |
|
| 46 | - if ($extension != 'jpg') { |
|
| 47 | - $erreurs['upload_image_fond_login'] = _T('erreur_type_fichier'); |
|
| 48 | - } |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - return $erreurs; |
|
| 31 | + $erreurs = []; |
|
| 32 | + |
|
| 33 | + if (_request('supprimer_image_fond_login')) { |
|
| 34 | + // rien à tester |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + elseif (_request('supprimer_couleur_login')) { |
|
| 38 | + // rien à tester |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + elseif (!empty($_FILES['upload_image_fond_login'])) { |
|
| 42 | + $file = $_FILES['upload_image_fond_login']; |
|
| 43 | + include_spip('inc/documents'); |
|
| 44 | + $extension = pathinfo((string) $file['name'], PATHINFO_EXTENSION); |
|
| 45 | + $extension = corriger_extension(strtolower($extension)); |
|
| 46 | + if ($extension != 'jpg') { |
|
| 47 | + $erreurs['upload_image_fond_login'] = _T('erreur_type_fichier'); |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + return $erreurs; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | function formulaires_configurer_ecran_connexion_traiter_dist() { |
| 56 | 56 | |
| 57 | - $retours = [ |
|
| 58 | - 'message_ok' => _T('config_info_enregistree'), |
|
| 59 | - 'editable' => true, |
|
| 60 | - ]; |
|
| 61 | - |
|
| 62 | - include_spip('inc/config'); |
|
| 63 | - $data = formulaires_configurer_ecran_connexion_data(); |
|
| 64 | - $dest = $data['img_fond']; |
|
| 65 | - |
|
| 66 | - if (_request('couleur_login')) { |
|
| 67 | - $color = _request('couleur_login'); |
|
| 68 | - if ($color === $data['couleur_defaut']) { |
|
| 69 | - effacer_config('couleur_login'); |
|
| 70 | - } else { |
|
| 71 | - ecrire_config('couleur_login', $color); |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - if (_request('supprimer_image_fond_login')) { |
|
| 76 | - @unlink($dest); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - elseif (_request('supprimer_couleur_login')) { |
|
| 80 | - effacer_config('couleur_login'); |
|
| 81 | - set_request('couleur_login', null); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - elseif (!empty($_FILES['upload_image_fond_login'])) { |
|
| 85 | - $file = $_FILES['upload_image_fond_login']; |
|
| 86 | - include_spip('inc/documents'); |
|
| 87 | - deplacer_fichier_upload($file['tmp_name'], $dest); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - include_spip('inc/invalideur'); |
|
| 91 | - suivre_invalideur('1'); # tout effacer |
|
| 92 | - |
|
| 93 | - return $retours; |
|
| 57 | + $retours = [ |
|
| 58 | + 'message_ok' => _T('config_info_enregistree'), |
|
| 59 | + 'editable' => true, |
|
| 60 | + ]; |
|
| 61 | + |
|
| 62 | + include_spip('inc/config'); |
|
| 63 | + $data = formulaires_configurer_ecran_connexion_data(); |
|
| 64 | + $dest = $data['img_fond']; |
|
| 65 | + |
|
| 66 | + if (_request('couleur_login')) { |
|
| 67 | + $color = _request('couleur_login'); |
|
| 68 | + if ($color === $data['couleur_defaut']) { |
|
| 69 | + effacer_config('couleur_login'); |
|
| 70 | + } else { |
|
| 71 | + ecrire_config('couleur_login', $color); |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + if (_request('supprimer_image_fond_login')) { |
|
| 76 | + @unlink($dest); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + elseif (_request('supprimer_couleur_login')) { |
|
| 80 | + effacer_config('couleur_login'); |
|
| 81 | + set_request('couleur_login', null); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + elseif (!empty($_FILES['upload_image_fond_login'])) { |
|
| 85 | + $file = $_FILES['upload_image_fond_login']; |
|
| 86 | + include_spip('inc/documents'); |
|
| 87 | + deplacer_fichier_upload($file['tmp_name'], $dest); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + include_spip('inc/invalideur'); |
|
| 91 | + suivre_invalideur('1'); # tout effacer |
|
| 92 | + |
|
| 93 | + return $retours; |
|
| 94 | 94 | } |
@@ -1,22 +1,22 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 4 | - return; |
|
| 4 | + return; |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | function trier_rss($texte) { |
| 8 | - if (preg_match_all(',<item.*</item>\s*?,Uims', (string) $texte, $matches, PREG_SET_ORDER)) { |
|
| 9 | - $placeholder = '<!--REINSERT-->'; |
|
| 10 | - $items = []; |
|
| 11 | - foreach ($matches as $match) { |
|
| 12 | - if (preg_match(',<dc:date>(.*)</dc:date>,Uims', $match[0], $r)) { |
|
| 13 | - $items[strtotime($r[1])] = trim($match[0]); |
|
| 14 | - $texte = str_replace($match[0], unique($placeholder), (string) $texte); |
|
| 15 | - } |
|
| 16 | - } |
|
| 17 | - krsort($items); |
|
| 18 | - $texte = str_replace($placeholder, implode("\n\t", $items) . "\n", (string) $texte); |
|
| 19 | - } |
|
| 8 | + if (preg_match_all(',<item.*</item>\s*?,Uims', (string) $texte, $matches, PREG_SET_ORDER)) { |
|
| 9 | + $placeholder = '<!--REINSERT-->'; |
|
| 10 | + $items = []; |
|
| 11 | + foreach ($matches as $match) { |
|
| 12 | + if (preg_match(',<dc:date>(.*)</dc:date>,Uims', $match[0], $r)) { |
|
| 13 | + $items[strtotime($r[1])] = trim($match[0]); |
|
| 14 | + $texte = str_replace($match[0], unique($placeholder), (string) $texte); |
|
| 15 | + } |
|
| 16 | + } |
|
| 17 | + krsort($items); |
|
| 18 | + $texte = str_replace($placeholder, implode("\n\t", $items) . "\n", (string) $texte); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - return $texte; |
|
| 21 | + return $texte; |
|
| 22 | 22 | } |
@@ -10,40 +10,40 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | function defaut_tri_defined($defaut) { |
| 17 | - if (!defined('_TRI_ARTICLES_RUBRIQUE')) { |
|
| 18 | - return $defaut; |
|
| 19 | - } |
|
| 17 | + if (!defined('_TRI_ARTICLES_RUBRIQUE')) { |
|
| 18 | + return $defaut; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - $sens = 1; |
|
| 22 | - $tri = trim((string) _TRI_ARTICLES_RUBRIQUE); |
|
| 23 | - $tri = explode(' ', $tri); |
|
| 24 | - if (strncasecmp(end($tri), 'DESC', 4) == 0) { |
|
| 25 | - $sens = -1; |
|
| 26 | - array_pop($tri); |
|
| 27 | - } elseif (strncasecmp(end($tri), 'ASC', 3) == 0) { |
|
| 28 | - $sens = 1; |
|
| 29 | - array_pop($tri); |
|
| 30 | - } |
|
| 31 | - $tri = implode(' ', $tri); |
|
| 32 | - $tri = [$tri => $sens]; |
|
| 33 | - foreach ($defaut as $n => $s) { |
|
| 34 | - if (!isset($tri[$n])) { |
|
| 35 | - $tri[$n] = $s; |
|
| 36 | - } |
|
| 37 | - } |
|
| 21 | + $sens = 1; |
|
| 22 | + $tri = trim((string) _TRI_ARTICLES_RUBRIQUE); |
|
| 23 | + $tri = explode(' ', $tri); |
|
| 24 | + if (strncasecmp(end($tri), 'DESC', 4) == 0) { |
|
| 25 | + $sens = -1; |
|
| 26 | + array_pop($tri); |
|
| 27 | + } elseif (strncasecmp(end($tri), 'ASC', 3) == 0) { |
|
| 28 | + $sens = 1; |
|
| 29 | + array_pop($tri); |
|
| 30 | + } |
|
| 31 | + $tri = implode(' ', $tri); |
|
| 32 | + $tri = [$tri => $sens]; |
|
| 33 | + foreach ($defaut as $n => $s) { |
|
| 34 | + if (!isset($tri[$n])) { |
|
| 35 | + $tri[$n] = $s; |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - return $tri; |
|
| 39 | + return $tri; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | function defaut_tri_par($par, $defaut) { |
| 43 | - if (!defined('_TRI_ARTICLES_RUBRIQUE')) { |
|
| 44 | - return $par; |
|
| 45 | - } |
|
| 46 | - $par = array_keys($defaut); |
|
| 43 | + if (!defined('_TRI_ARTICLES_RUBRIQUE')) { |
|
| 44 | + return $par; |
|
| 45 | + } |
|
| 46 | + $par = array_keys($defaut); |
|
| 47 | 47 | |
| 48 | - return reset($par); |
|
| 48 | + return reset($par); |
|
| 49 | 49 | } |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | if (defined('_TEST_DIRS')) { |
| 17 | - return; |
|
| 17 | + return; |
|
| 18 | 18 | } |
| 19 | 19 | define('_TEST_DIRS', '1'); |
| 20 | 20 | |
@@ -26,38 +26,38 @@ discard block |
||
| 26 | 26 | // Tente d'ecrire |
| 27 | 27 | // |
| 28 | 28 | function test_ecrire($my_dir) { |
| 29 | - static $chmod = 0; |
|
| 30 | - |
|
| 31 | - $ok = false; |
|
| 32 | - $script = @file_exists('spip_loader.php') ? 'spip_loader.php' : $_SERVER['PHP_SELF']; |
|
| 33 | - $self = basename((string) $script); |
|
| 34 | - $uid = @fileowner('.'); |
|
| 35 | - $uid2 = @fileowner($self); |
|
| 36 | - $gid = @filegroup('.'); |
|
| 37 | - $gid2 = @filegroup($self); |
|
| 38 | - $perms = @fileperms($self); |
|
| 39 | - |
|
| 40 | - // Comparer l'appartenance d'un fichier cree par PHP |
|
| 41 | - // avec celle du script et du repertoire courant |
|
| 42 | - if (!$chmod) { |
|
| 43 | - @rmdir('test'); |
|
| 44 | - spip_unlink('test'); // effacer au cas ou |
|
| 45 | - @touch('test'); |
|
| 46 | - if ($uid > 0 && $uid == $uid2 && @fileowner('test') == $uid) { |
|
| 47 | - $chmod = 0700; |
|
| 48 | - } else { |
|
| 49 | - $chmod = $gid > 0 && $gid == $gid2 && @filegroup('test') == $gid ? 0770 : 0777; |
|
| 50 | - } |
|
| 51 | - // Appliquer de plus les droits d'acces du script |
|
| 52 | - if ($perms > 0) { |
|
| 53 | - $perms = ($perms & 0777) | (($perms & 0444) >> 2); |
|
| 54 | - $chmod |= $perms; |
|
| 55 | - } |
|
| 56 | - spip_unlink('test'); |
|
| 57 | - } |
|
| 58 | - $ok = is_dir($my_dir) && is_writable($my_dir); |
|
| 59 | - |
|
| 60 | - return $ok ? $chmod : false; |
|
| 29 | + static $chmod = 0; |
|
| 30 | + |
|
| 31 | + $ok = false; |
|
| 32 | + $script = @file_exists('spip_loader.php') ? 'spip_loader.php' : $_SERVER['PHP_SELF']; |
|
| 33 | + $self = basename((string) $script); |
|
| 34 | + $uid = @fileowner('.'); |
|
| 35 | + $uid2 = @fileowner($self); |
|
| 36 | + $gid = @filegroup('.'); |
|
| 37 | + $gid2 = @filegroup($self); |
|
| 38 | + $perms = @fileperms($self); |
|
| 39 | + |
|
| 40 | + // Comparer l'appartenance d'un fichier cree par PHP |
|
| 41 | + // avec celle du script et du repertoire courant |
|
| 42 | + if (!$chmod) { |
|
| 43 | + @rmdir('test'); |
|
| 44 | + spip_unlink('test'); // effacer au cas ou |
|
| 45 | + @touch('test'); |
|
| 46 | + if ($uid > 0 && $uid == $uid2 && @fileowner('test') == $uid) { |
|
| 47 | + $chmod = 0700; |
|
| 48 | + } else { |
|
| 49 | + $chmod = $gid > 0 && $gid == $gid2 && @filegroup('test') == $gid ? 0770 : 0777; |
|
| 50 | + } |
|
| 51 | + // Appliquer de plus les droits d'acces du script |
|
| 52 | + if ($perms > 0) { |
|
| 53 | + $perms = ($perms & 0777) | (($perms & 0444) >> 2); |
|
| 54 | + $chmod |= $perms; |
|
| 55 | + } |
|
| 56 | + spip_unlink('test'); |
|
| 57 | + } |
|
| 58 | + $ok = is_dir($my_dir) && is_writable($my_dir); |
|
| 59 | + |
|
| 60 | + return $ok ? $chmod : false; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // |
@@ -67,84 +67,84 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | function install_etape_chmod_dist() { |
| 69 | 69 | |
| 70 | - $continuer = null; |
|
| 71 | - $test_dir = _request('test_dir'); |
|
| 72 | - $chmod = 0; |
|
| 73 | - |
|
| 74 | - if ($test_dir && !str_contains((string) $test_dir, '..')) { |
|
| 75 | - if (!str_ends_with((string) $test_dir, '/')) { |
|
| 76 | - $test_dir .= '/'; |
|
| 77 | - } |
|
| 78 | - if (!in_array($test_dir, $GLOBALS['test_dirs'])) { |
|
| 79 | - $GLOBALS['test_dirs'][] = _DIR_RACINE . $test_dir; |
|
| 80 | - } |
|
| 81 | - } else { |
|
| 82 | - if (!_FILE_CONNECT) { |
|
| 83 | - $GLOBALS['test_dirs'][] = _DIR_CONNECT; |
|
| 84 | - $GLOBALS['test_dirs'][] = _DIR_CHMOD; |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - $bad_dirs = []; |
|
| 89 | - $absent_dirs = []; |
|
| 90 | - |
|
| 91 | - foreach ($GLOBALS['test_dirs'] as $i => $my_dir) { |
|
| 92 | - $test = test_ecrire($my_dir); |
|
| 93 | - if (!$test) { |
|
| 94 | - $m = preg_replace(',^' . _DIR_RACINE . ',', '', (string) $my_dir); |
|
| 95 | - if (@file_exists($my_dir)) { |
|
| 96 | - $bad_dirs['<li>' . $m . '</li>'] = 1; |
|
| 97 | - } else { |
|
| 98 | - $absent_dirs['<li>' . $m . '</li>'] = 1; |
|
| 99 | - } |
|
| 100 | - } else { |
|
| 101 | - $chmod = max($chmod, $test); |
|
| 102 | - } |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - if ($bad_dirs || $absent_dirs) { |
|
| 106 | - if (!_FILE_CONNECT) { |
|
| 107 | - $titre = _T('dirs_preliminaire'); |
|
| 108 | - $continuer = ' ' . _T('dirs_commencer') . '.'; |
|
| 109 | - } else { |
|
| 110 | - $titre = _T('dirs_probleme_droits'); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - |
|
| 114 | - $res = "<div align='right'>" . menu_langues('var_lang_ecrire') . "</div>\n"; |
|
| 115 | - |
|
| 116 | - if ($bad_dirs) { |
|
| 117 | - $res .= |
|
| 118 | - _T( |
|
| 119 | - 'dirs_repertoires_suivants', |
|
| 120 | - ['bad_dirs' => implode("\n", array_keys($bad_dirs))] |
|
| 121 | - ) . |
|
| 122 | - '<b>' . _T('login_recharger') . '</b>.'; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - if ($absent_dirs) { |
|
| 126 | - $res .= |
|
| 127 | - _T( |
|
| 128 | - 'dirs_repertoires_absents', |
|
| 129 | - ['bad_dirs' => implode("\n", array_keys($absent_dirs))] |
|
| 130 | - ) . |
|
| 131 | - '<b>' . _T('login_recharger') . '</b>.'; |
|
| 132 | - } |
|
| 133 | - $res = '<p>' . $continuer . $res . aider('install0', true) . '</p>'; |
|
| 134 | - |
|
| 135 | - $t = _T('login_recharger'); |
|
| 136 | - $t = ($test_dir ? "<input type='hidden' name='test_dir' value='" . spip_htmlspecialchars($test_dir, ENT_QUOTES) . "' />" : |
|
| 137 | - '') |
|
| 138 | - . "<input type='hidden' name='etape' value='chmod' />" |
|
| 139 | - . "<div style='text-align: right'><input type='submit' value='" . attribut_html($t) . "' /></div>"; |
|
| 140 | - |
|
| 141 | - echo minipres($titre, $res . generer_form_ecrire('install', $t)); |
|
| 142 | - } else { |
|
| 143 | - $deja = (_FILE_CONNECT && analyse_fichier_connection(_FILE_CONNECT)); |
|
| 144 | - if (!$deja) { |
|
| 145 | - redirige_url_ecrire('install', 'etape=1&chmod=' . $chmod); |
|
| 146 | - } else { |
|
| 147 | - redirige_url_ecrire(); |
|
| 148 | - } |
|
| 149 | - } |
|
| 70 | + $continuer = null; |
|
| 71 | + $test_dir = _request('test_dir'); |
|
| 72 | + $chmod = 0; |
|
| 73 | + |
|
| 74 | + if ($test_dir && !str_contains((string) $test_dir, '..')) { |
|
| 75 | + if (!str_ends_with((string) $test_dir, '/')) { |
|
| 76 | + $test_dir .= '/'; |
|
| 77 | + } |
|
| 78 | + if (!in_array($test_dir, $GLOBALS['test_dirs'])) { |
|
| 79 | + $GLOBALS['test_dirs'][] = _DIR_RACINE . $test_dir; |
|
| 80 | + } |
|
| 81 | + } else { |
|
| 82 | + if (!_FILE_CONNECT) { |
|
| 83 | + $GLOBALS['test_dirs'][] = _DIR_CONNECT; |
|
| 84 | + $GLOBALS['test_dirs'][] = _DIR_CHMOD; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + $bad_dirs = []; |
|
| 89 | + $absent_dirs = []; |
|
| 90 | + |
|
| 91 | + foreach ($GLOBALS['test_dirs'] as $i => $my_dir) { |
|
| 92 | + $test = test_ecrire($my_dir); |
|
| 93 | + if (!$test) { |
|
| 94 | + $m = preg_replace(',^' . _DIR_RACINE . ',', '', (string) $my_dir); |
|
| 95 | + if (@file_exists($my_dir)) { |
|
| 96 | + $bad_dirs['<li>' . $m . '</li>'] = 1; |
|
| 97 | + } else { |
|
| 98 | + $absent_dirs['<li>' . $m . '</li>'] = 1; |
|
| 99 | + } |
|
| 100 | + } else { |
|
| 101 | + $chmod = max($chmod, $test); |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + if ($bad_dirs || $absent_dirs) { |
|
| 106 | + if (!_FILE_CONNECT) { |
|
| 107 | + $titre = _T('dirs_preliminaire'); |
|
| 108 | + $continuer = ' ' . _T('dirs_commencer') . '.'; |
|
| 109 | + } else { |
|
| 110 | + $titre = _T('dirs_probleme_droits'); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + |
|
| 114 | + $res = "<div align='right'>" . menu_langues('var_lang_ecrire') . "</div>\n"; |
|
| 115 | + |
|
| 116 | + if ($bad_dirs) { |
|
| 117 | + $res .= |
|
| 118 | + _T( |
|
| 119 | + 'dirs_repertoires_suivants', |
|
| 120 | + ['bad_dirs' => implode("\n", array_keys($bad_dirs))] |
|
| 121 | + ) . |
|
| 122 | + '<b>' . _T('login_recharger') . '</b>.'; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + if ($absent_dirs) { |
|
| 126 | + $res .= |
|
| 127 | + _T( |
|
| 128 | + 'dirs_repertoires_absents', |
|
| 129 | + ['bad_dirs' => implode("\n", array_keys($absent_dirs))] |
|
| 130 | + ) . |
|
| 131 | + '<b>' . _T('login_recharger') . '</b>.'; |
|
| 132 | + } |
|
| 133 | + $res = '<p>' . $continuer . $res . aider('install0', true) . '</p>'; |
|
| 134 | + |
|
| 135 | + $t = _T('login_recharger'); |
|
| 136 | + $t = ($test_dir ? "<input type='hidden' name='test_dir' value='" . spip_htmlspecialchars($test_dir, ENT_QUOTES) . "' />" : |
|
| 137 | + '') |
|
| 138 | + . "<input type='hidden' name='etape' value='chmod' />" |
|
| 139 | + . "<div style='text-align: right'><input type='submit' value='" . attribut_html($t) . "' /></div>"; |
|
| 140 | + |
|
| 141 | + echo minipres($titre, $res . generer_form_ecrire('install', $t)); |
|
| 142 | + } else { |
|
| 143 | + $deja = (_FILE_CONNECT && analyse_fichier_connection(_FILE_CONNECT)); |
|
| 144 | + if (!$deja) { |
|
| 145 | + redirige_url_ecrire('install', 'etape=1&chmod=' . $chmod); |
|
| 146 | + } else { |
|
| 147 | + redirige_url_ecrire(); |
|
| 148 | + } |
|
| 149 | + } |
|
| 150 | 150 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | include_spip('inc/charsets'); |
| 16 | 16 | |
@@ -26,90 +26,90 @@ discard block |
||
| 26 | 26 | * @return string |
| 27 | 27 | */ |
| 28 | 28 | function plugins_afficher_liste_dist( |
| 29 | - $url_page, |
|
| 30 | - $liste_plugins, |
|
| 31 | - $liste_plugins_checked, |
|
| 32 | - $liste_plugins_actifs, |
|
| 33 | - $dir_plugins = _DIR_PLUGINS, |
|
| 34 | - $afficher_un = 'afficher_plugin' |
|
| 29 | + $url_page, |
|
| 30 | + $liste_plugins, |
|
| 31 | + $liste_plugins_checked, |
|
| 32 | + $liste_plugins_actifs, |
|
| 33 | + $dir_plugins = _DIR_PLUGINS, |
|
| 34 | + $afficher_un = 'afficher_plugin' |
|
| 35 | 35 | ) { |
| 36 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 37 | - $ligne_plug = charger_fonction($afficher_un, 'plugins'); |
|
| 36 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 37 | + $ligne_plug = charger_fonction($afficher_un, 'plugins'); |
|
| 38 | 38 | |
| 39 | - $all_infos = $get_infos($liste_plugins, false, $dir_plugins); |
|
| 39 | + $all_infos = $get_infos($liste_plugins, false, $dir_plugins); |
|
| 40 | 40 | |
| 41 | - $all_infos = pipeline( |
|
| 42 | - 'filtrer_liste_plugins', |
|
| 43 | - [ |
|
| 44 | - 'args' => [ |
|
| 45 | - 'liste_plugins' => $liste_plugins, |
|
| 46 | - 'liste_plugins_checked' => $liste_plugins_checked, |
|
| 47 | - 'liste_plugins_actifs' => $liste_plugins_actifs, |
|
| 48 | - 'dir_plugins' => $dir_plugins |
|
| 49 | - ], |
|
| 50 | - 'data' => $all_infos |
|
| 51 | - ] |
|
| 52 | - ); |
|
| 41 | + $all_infos = pipeline( |
|
| 42 | + 'filtrer_liste_plugins', |
|
| 43 | + [ |
|
| 44 | + 'args' => [ |
|
| 45 | + 'liste_plugins' => $liste_plugins, |
|
| 46 | + 'liste_plugins_checked' => $liste_plugins_checked, |
|
| 47 | + 'liste_plugins_actifs' => $liste_plugins_actifs, |
|
| 48 | + 'dir_plugins' => $dir_plugins |
|
| 49 | + ], |
|
| 50 | + 'data' => $all_infos |
|
| 51 | + ] |
|
| 52 | + ); |
|
| 53 | 53 | |
| 54 | - $liste_plugins = array_flip($liste_plugins); |
|
| 55 | - foreach (array_keys($liste_plugins) as $chemin) { |
|
| 56 | - // des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte. |
|
| 57 | - if (isset($all_infos[$chemin])) { |
|
| 58 | - $liste_plugins[$chemin] = strtoupper(trim((string) typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom'])))))); |
|
| 59 | - } else { |
|
| 60 | - unset($liste_plugins[$chemin]); |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - asort($liste_plugins); |
|
| 64 | - $exposed = urldecode(_request('plugin') ?? ''); |
|
| 54 | + $liste_plugins = array_flip($liste_plugins); |
|
| 55 | + foreach (array_keys($liste_plugins) as $chemin) { |
|
| 56 | + // des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte. |
|
| 57 | + if (isset($all_infos[$chemin])) { |
|
| 58 | + $liste_plugins[$chemin] = strtoupper(trim((string) typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom'])))))); |
|
| 59 | + } else { |
|
| 60 | + unset($liste_plugins[$chemin]); |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + asort($liste_plugins); |
|
| 64 | + $exposed = urldecode(_request('plugin') ?? ''); |
|
| 65 | 65 | |
| 66 | - $block_par_lettre = false;//count($liste_plugins)>10; |
|
| 67 | - $fast_liste_plugins_actifs = []; |
|
| 68 | - $fast_liste_plugins_checked = []; |
|
| 69 | - if (is_array($liste_plugins_actifs)) { |
|
| 70 | - $fast_liste_plugins_actifs = array_flip($liste_plugins_actifs); |
|
| 71 | - } |
|
| 72 | - if (is_array($liste_plugins_checked)) { |
|
| 73 | - $fast_liste_plugins_checked = array_flip($liste_plugins_checked); |
|
| 74 | - } |
|
| 66 | + $block_par_lettre = false;//count($liste_plugins)>10; |
|
| 67 | + $fast_liste_plugins_actifs = []; |
|
| 68 | + $fast_liste_plugins_checked = []; |
|
| 69 | + if (is_array($liste_plugins_actifs)) { |
|
| 70 | + $fast_liste_plugins_actifs = array_flip($liste_plugins_actifs); |
|
| 71 | + } |
|
| 72 | + if (is_array($liste_plugins_checked)) { |
|
| 73 | + $fast_liste_plugins_checked = array_flip($liste_plugins_checked); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - $res = ''; |
|
| 77 | - $block = ''; |
|
| 78 | - $initiale = ''; |
|
| 79 | - $block_actif = false; |
|
| 80 | - foreach ($liste_plugins as $plug => $nom) { |
|
| 81 | - if (($i = substr($nom, 0, 1)) !== $initiale) { |
|
| 82 | - $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 83 | - $initiale = $i; |
|
| 84 | - $block = ''; |
|
| 85 | - $block_actif = false; |
|
| 86 | - } |
|
| 87 | - // le rep suivant |
|
| 88 | - $actif = isset($fast_liste_plugins_actifs[$plug]); |
|
| 89 | - $checked = isset($fast_liste_plugins_checked[$plug]); |
|
| 90 | - $block_actif |= $actif; |
|
| 91 | - $expose = ($exposed && ($exposed == $plug || $exposed === $dir_plugins . $plug || $exposed === substr( |
|
| 92 | - $dir_plugins, |
|
| 93 | - strlen(_DIR_RACINE) |
|
| 94 | - ) . $plug)); |
|
| 95 | - $block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, 'item', $dir_plugins) . "\n"; |
|
| 96 | - } |
|
| 97 | - $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 98 | - $class = basename($dir_plugins); |
|
| 76 | + $res = ''; |
|
| 77 | + $block = ''; |
|
| 78 | + $initiale = ''; |
|
| 79 | + $block_actif = false; |
|
| 80 | + foreach ($liste_plugins as $plug => $nom) { |
|
| 81 | + if (($i = substr($nom, 0, 1)) !== $initiale) { |
|
| 82 | + $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 83 | + $initiale = $i; |
|
| 84 | + $block = ''; |
|
| 85 | + $block_actif = false; |
|
| 86 | + } |
|
| 87 | + // le rep suivant |
|
| 88 | + $actif = isset($fast_liste_plugins_actifs[$plug]); |
|
| 89 | + $checked = isset($fast_liste_plugins_checked[$plug]); |
|
| 90 | + $block_actif |= $actif; |
|
| 91 | + $expose = ($exposed && ($exposed == $plug || $exposed === $dir_plugins . $plug || $exposed === substr( |
|
| 92 | + $dir_plugins, |
|
| 93 | + strlen(_DIR_RACINE) |
|
| 94 | + ) . $plug)); |
|
| 95 | + $block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, 'item', $dir_plugins) . "\n"; |
|
| 96 | + } |
|
| 97 | + $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 98 | + $class = basename($dir_plugins); |
|
| 99 | 99 | |
| 100 | - return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : ''; |
|
| 100 | + return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : ''; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | function affiche_block_initiale($initiale, $block, $block_actif) { |
| 105 | - if (strlen((string) $block)) { |
|
| 106 | - return "<li class='item'>" |
|
| 107 | - . bouton_block_depliable($initiale, (bool) $block_actif) |
|
| 108 | - . debut_block_depliable($block_actif) |
|
| 109 | - . "<ul>$block</ul>" |
|
| 110 | - . fin_block() |
|
| 111 | - . '</li>'; |
|
| 112 | - } |
|
| 105 | + if (strlen((string) $block)) { |
|
| 106 | + return "<li class='item'>" |
|
| 107 | + . bouton_block_depliable($initiale, (bool) $block_actif) |
|
| 108 | + . debut_block_depliable($block_actif) |
|
| 109 | + . "<ul>$block</ul>" |
|
| 110 | + . fin_block() |
|
| 111 | + . '</li>'; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - return ''; |
|
| 114 | + return ''; |
|
| 115 | 115 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | |
@@ -20,28 +20,28 @@ discard block |
||
| 20 | 20 | * @param array $arbre |
| 21 | 21 | */ |
| 22 | 22 | function plugins_extraire_pipelines_dist(&$arbre) { |
| 23 | - $pipes = null; |
|
| 24 | - $tag = null; |
|
| 25 | - $pipeline = []; |
|
| 26 | - if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) { |
|
| 27 | - foreach ($pipes as $tag => $p) { |
|
| 28 | - if (!is_array($p[0])) { |
|
| 29 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 30 | - $pipeline[] = $att; |
|
| 31 | - } else { |
|
| 32 | - foreach ($p as $pipe) { |
|
| 33 | - $att = []; |
|
| 34 | - if (is_array($pipe)) { |
|
| 35 | - foreach ($pipe as $k => $t) { |
|
| 36 | - $att[$k] = trim((string) end($t)); |
|
| 37 | - } |
|
| 38 | - } |
|
| 39 | - $pipeline[] = $att; |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - } |
|
| 43 | - unset($arbre[$tag]); |
|
| 44 | - } |
|
| 23 | + $pipes = null; |
|
| 24 | + $tag = null; |
|
| 25 | + $pipeline = []; |
|
| 26 | + if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) { |
|
| 27 | + foreach ($pipes as $tag => $p) { |
|
| 28 | + if (!is_array($p[0])) { |
|
| 29 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 30 | + $pipeline[] = $att; |
|
| 31 | + } else { |
|
| 32 | + foreach ($p as $pipe) { |
|
| 33 | + $att = []; |
|
| 34 | + if (is_array($pipe)) { |
|
| 35 | + foreach ($pipe as $k => $t) { |
|
| 36 | + $att[$k] = trim((string) end($t)); |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | + $pipeline[] = $att; |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + unset($arbre[$tag]); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - return $pipeline; |
|
| 46 | + return $pipeline; |
|
| 47 | 47 | } |
@@ -10,207 +10,207 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_spip('inc/xml'); |
| 17 | 17 | include_spip('inc/plugin'); |
| 18 | 18 | |
| 19 | 19 | function plugins_verifie_conformite_dist($plug, &$arbre, $dir_plugins = _DIR_PLUGINS) { |
| 20 | - $needs = null; |
|
| 21 | - $compat_spip = null; |
|
| 22 | - $uses = null; |
|
| 23 | - $paths = null; |
|
| 24 | - $trads = null; |
|
| 25 | - static $etats = ['dev', 'experimental', 'test', 'stable']; |
|
| 20 | + $needs = null; |
|
| 21 | + $compat_spip = null; |
|
| 22 | + $uses = null; |
|
| 23 | + $paths = null; |
|
| 24 | + $trads = null; |
|
| 25 | + static $etats = ['dev', 'experimental', 'test', 'stable']; |
|
| 26 | 26 | |
| 27 | - $matches = []; |
|
| 28 | - $silence = false; |
|
| 29 | - $p = null; |
|
| 30 | - // chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP |
|
| 31 | - if ($n = spip_xml_match_nodes(',^plugin(\s|$),', $arbre, $matches)) { |
|
| 32 | - // version de SPIP |
|
| 33 | - $vspip = $GLOBALS['spip_version_branche']; |
|
| 34 | - foreach ($matches as $tag => $sous) { |
|
| 35 | - [$tagname, $atts] = spip_xml_decompose_tag($tag); |
|
| 36 | - // On rajoute la condition sur $n : |
|
| 37 | - // -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait |
|
| 38 | - // un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise |
|
| 39 | - // de la meme facon. |
|
| 40 | - if ( |
|
| 41 | - $tagname == 'plugin' |
|
| 42 | - && is_array($sous) |
|
| 43 | - && (!isset($atts['spip']) || $n == 1 || plugin_version_compatible($atts['spip'], $vspip, 'spip')) |
|
| 44 | - ) { |
|
| 45 | - // on prend la derniere declaration avec ce nom |
|
| 46 | - $p = end($sous); |
|
| 47 | - $compat_spip = $atts['spip'] ?? ''; |
|
| 48 | - } |
|
| 49 | - } |
|
| 50 | - } |
|
| 51 | - if (is_null($p)) { |
|
| 52 | - $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 53 | - $silence = true; |
|
| 54 | - } else { |
|
| 55 | - $arbre = $p; |
|
| 56 | - } |
|
| 57 | - if (!is_array($arbre)) { |
|
| 58 | - $arbre = []; |
|
| 59 | - } |
|
| 60 | - // verification de la conformite du plugin avec quelques |
|
| 61 | - // precautions elementaires |
|
| 62 | - if (!isset($arbre['nom'])) { |
|
| 63 | - if (!$silence) { |
|
| 64 | - $arbre['erreur'][] = _T('erreur_plugin_nom_manquant'); |
|
| 65 | - } |
|
| 66 | - $arbre['nom'] = ['']; |
|
| 67 | - } |
|
| 68 | - if (!isset($arbre['version'])) { |
|
| 69 | - if (!$silence) { |
|
| 70 | - $arbre['erreur'][] = _T('erreur_plugin_version_manquant'); |
|
| 71 | - } |
|
| 72 | - $arbre['version'] = ['']; |
|
| 73 | - } |
|
| 74 | - if (!isset($arbre['prefix'])) { |
|
| 75 | - if (!$silence) { |
|
| 76 | - $arbre['erreur'][] = _T('erreur_plugin_prefix_manquant'); |
|
| 77 | - } |
|
| 78 | - $arbre['prefix'] = ['']; |
|
| 79 | - } else { |
|
| 80 | - $prefix = trim((string) end($arbre['prefix'])); |
|
| 81 | - if (strtoupper($prefix) == 'SPIP' && $plug != './') { |
|
| 82 | - $arbre['erreur'][] = _T('erreur_plugin_prefix_interdit'); |
|
| 83 | - } |
|
| 84 | - if (isset($arbre['etat'])) { |
|
| 85 | - $etat = trim((string) end($arbre['etat'])); |
|
| 86 | - if (!in_array($etat, $etats)) { |
|
| 87 | - $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - if (isset($arbre['options'])) { |
|
| 91 | - foreach ($arbre['options'] as $optfile) { |
|
| 92 | - $optfile = trim((string) $optfile); |
|
| 93 | - if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 94 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 95 | - } |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - if (isset($arbre['fonctions'])) { |
|
| 99 | - foreach ($arbre['fonctions'] as $optfile) { |
|
| 100 | - $optfile = trim((string) $optfile); |
|
| 101 | - if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 102 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - $fonctions = []; |
|
| 107 | - if (isset($arbre['fonctions'])) { |
|
| 108 | - $fonctions = $arbre['fonctions']; |
|
| 109 | - } |
|
| 110 | - $liste_methodes_reservees = [ |
|
| 111 | - '__construct', |
|
| 112 | - '__destruct', |
|
| 113 | - 'plugin', |
|
| 114 | - 'install', |
|
| 115 | - 'uninstall', |
|
| 116 | - strtolower($prefix) |
|
| 117 | - ]; |
|
| 27 | + $matches = []; |
|
| 28 | + $silence = false; |
|
| 29 | + $p = null; |
|
| 30 | + // chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP |
|
| 31 | + if ($n = spip_xml_match_nodes(',^plugin(\s|$),', $arbre, $matches)) { |
|
| 32 | + // version de SPIP |
|
| 33 | + $vspip = $GLOBALS['spip_version_branche']; |
|
| 34 | + foreach ($matches as $tag => $sous) { |
|
| 35 | + [$tagname, $atts] = spip_xml_decompose_tag($tag); |
|
| 36 | + // On rajoute la condition sur $n : |
|
| 37 | + // -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait |
|
| 38 | + // un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise |
|
| 39 | + // de la meme facon. |
|
| 40 | + if ( |
|
| 41 | + $tagname == 'plugin' |
|
| 42 | + && is_array($sous) |
|
| 43 | + && (!isset($atts['spip']) || $n == 1 || plugin_version_compatible($atts['spip'], $vspip, 'spip')) |
|
| 44 | + ) { |
|
| 45 | + // on prend la derniere declaration avec ce nom |
|
| 46 | + $p = end($sous); |
|
| 47 | + $compat_spip = $atts['spip'] ?? ''; |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + if (is_null($p)) { |
|
| 52 | + $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 53 | + $silence = true; |
|
| 54 | + } else { |
|
| 55 | + $arbre = $p; |
|
| 56 | + } |
|
| 57 | + if (!is_array($arbre)) { |
|
| 58 | + $arbre = []; |
|
| 59 | + } |
|
| 60 | + // verification de la conformite du plugin avec quelques |
|
| 61 | + // precautions elementaires |
|
| 62 | + if (!isset($arbre['nom'])) { |
|
| 63 | + if (!$silence) { |
|
| 64 | + $arbre['erreur'][] = _T('erreur_plugin_nom_manquant'); |
|
| 65 | + } |
|
| 66 | + $arbre['nom'] = ['']; |
|
| 67 | + } |
|
| 68 | + if (!isset($arbre['version'])) { |
|
| 69 | + if (!$silence) { |
|
| 70 | + $arbre['erreur'][] = _T('erreur_plugin_version_manquant'); |
|
| 71 | + } |
|
| 72 | + $arbre['version'] = ['']; |
|
| 73 | + } |
|
| 74 | + if (!isset($arbre['prefix'])) { |
|
| 75 | + if (!$silence) { |
|
| 76 | + $arbre['erreur'][] = _T('erreur_plugin_prefix_manquant'); |
|
| 77 | + } |
|
| 78 | + $arbre['prefix'] = ['']; |
|
| 79 | + } else { |
|
| 80 | + $prefix = trim((string) end($arbre['prefix'])); |
|
| 81 | + if (strtoupper($prefix) == 'SPIP' && $plug != './') { |
|
| 82 | + $arbre['erreur'][] = _T('erreur_plugin_prefix_interdit'); |
|
| 83 | + } |
|
| 84 | + if (isset($arbre['etat'])) { |
|
| 85 | + $etat = trim((string) end($arbre['etat'])); |
|
| 86 | + if (!in_array($etat, $etats)) { |
|
| 87 | + $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + if (isset($arbre['options'])) { |
|
| 91 | + foreach ($arbre['options'] as $optfile) { |
|
| 92 | + $optfile = trim((string) $optfile); |
|
| 93 | + if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 94 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + if (isset($arbre['fonctions'])) { |
|
| 99 | + foreach ($arbre['fonctions'] as $optfile) { |
|
| 100 | + $optfile = trim((string) $optfile); |
|
| 101 | + if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 102 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + $fonctions = []; |
|
| 107 | + if (isset($arbre['fonctions'])) { |
|
| 108 | + $fonctions = $arbre['fonctions']; |
|
| 109 | + } |
|
| 110 | + $liste_methodes_reservees = [ |
|
| 111 | + '__construct', |
|
| 112 | + '__destruct', |
|
| 113 | + 'plugin', |
|
| 114 | + 'install', |
|
| 115 | + 'uninstall', |
|
| 116 | + strtolower($prefix) |
|
| 117 | + ]; |
|
| 118 | 118 | |
| 119 | - $extraire_pipelines = charger_fonction('extraire_pipelines', 'plugins'); |
|
| 120 | - $arbre['pipeline'] = $extraire_pipelines($arbre); |
|
| 121 | - foreach ($arbre['pipeline'] as $pipe) { |
|
| 122 | - if (!isset($pipe['nom']) && !$silence) { |
|
| 123 | - $arbre['erreur'][] = _T('erreur_plugin_nom_pipeline_non_defini'); |
|
| 124 | - } |
|
| 125 | - $action = $pipe['action'] ?? $pipe['nom']; |
|
| 126 | - // verif que la methode a un nom autorise |
|
| 127 | - if (in_array(strtolower((string) $action), $liste_methodes_reservees) && !$silence) { |
|
| 128 | - $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 129 | - } |
|
| 130 | - if (isset($pipe['inclure'])) { |
|
| 131 | - $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 132 | - if (!@is_readable($inclure) && !$silence) { |
|
| 133 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - $necessite = []; |
|
| 138 | - $spip_trouve = false; |
|
| 139 | - if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) { |
|
| 140 | - foreach (array_keys($needs) as $tag) { |
|
| 141 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 142 | - if (!isset($att['id'])) { |
|
| 143 | - if (!$silence) { |
|
| 144 | - $arbre['erreur'][] = _T( |
|
| 145 | - 'erreur_plugin_attribut_balise_manquant', |
|
| 146 | - ['attribut' => 'id', 'balise' => $att] |
|
| 147 | - ); |
|
| 148 | - } |
|
| 149 | - } else { |
|
| 150 | - $necessite[] = $att; |
|
| 151 | - } |
|
| 152 | - if (strtolower((string) $att['id']) == 'spip') { |
|
| 153 | - $spip_trouve = true; |
|
| 154 | - } |
|
| 155 | - } |
|
| 156 | - } |
|
| 157 | - if ($compat_spip && !$spip_trouve) { |
|
| 158 | - $necessite[] = ['id' => 'spip', 'version' => $compat_spip]; |
|
| 159 | - } |
|
| 160 | - $arbre['necessite'] = $necessite; |
|
| 161 | - $utilise = []; |
|
| 162 | - if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) { |
|
| 163 | - foreach (array_keys($uses) as $tag) { |
|
| 164 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 165 | - if (!isset($att['id'])) { |
|
| 166 | - if (!$silence) { |
|
| 167 | - $arbre['erreur'][] = _T( |
|
| 168 | - 'erreur_plugin_attribut_balise_manquant', |
|
| 169 | - ['attribut' => 'id', 'balise' => $att] |
|
| 170 | - ); |
|
| 171 | - } |
|
| 172 | - } else { |
|
| 173 | - $utilise[] = $att; |
|
| 174 | - } |
|
| 175 | - } |
|
| 176 | - } |
|
| 177 | - $arbre['utilise'] = $utilise; |
|
| 178 | - $procure = []; |
|
| 179 | - if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) { |
|
| 180 | - foreach (array_keys($uses) as $tag) { |
|
| 181 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 182 | - $procure[] = $att; |
|
| 183 | - } |
|
| 184 | - } |
|
| 185 | - $arbre['procure'] = $procure; |
|
| 186 | - $path = []; |
|
| 187 | - if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) { |
|
| 188 | - foreach (array_keys($paths) as $tag) { |
|
| 189 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 190 | - $att['path'] = $att['dir']; // ancienne syntaxe |
|
| 191 | - $path[] = $att; |
|
| 192 | - } |
|
| 193 | - } else { |
|
| 194 | - $path = [['dir' => '']]; |
|
| 195 | - } // initialiser par defaut |
|
| 196 | - $arbre['path'] = $path; |
|
| 197 | - // exposer les noisettes |
|
| 198 | - if (isset($arbre['noisette'])) { |
|
| 199 | - foreach ($arbre['noisette'] as $k => $nut) { |
|
| 200 | - $nut = preg_replace(',[.]html$,uims', '', trim((string) $nut)); |
|
| 201 | - $arbre['noisette'][$k] = $nut; |
|
| 202 | - if (!@is_readable($dir_plugins . "$plug/$nut.html") && !$silence) { |
|
| 203 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 204 | - } |
|
| 205 | - } |
|
| 206 | - } |
|
| 207 | - $traduire = []; |
|
| 208 | - if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) { |
|
| 209 | - foreach (array_keys($trads) as $tag) { |
|
| 210 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 211 | - $traduire[] = $att; |
|
| 212 | - } |
|
| 213 | - } |
|
| 214 | - $arbre['traduire'] = $traduire; |
|
| 215 | - } |
|
| 119 | + $extraire_pipelines = charger_fonction('extraire_pipelines', 'plugins'); |
|
| 120 | + $arbre['pipeline'] = $extraire_pipelines($arbre); |
|
| 121 | + foreach ($arbre['pipeline'] as $pipe) { |
|
| 122 | + if (!isset($pipe['nom']) && !$silence) { |
|
| 123 | + $arbre['erreur'][] = _T('erreur_plugin_nom_pipeline_non_defini'); |
|
| 124 | + } |
|
| 125 | + $action = $pipe['action'] ?? $pipe['nom']; |
|
| 126 | + // verif que la methode a un nom autorise |
|
| 127 | + if (in_array(strtolower((string) $action), $liste_methodes_reservees) && !$silence) { |
|
| 128 | + $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 129 | + } |
|
| 130 | + if (isset($pipe['inclure'])) { |
|
| 131 | + $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 132 | + if (!@is_readable($inclure) && !$silence) { |
|
| 133 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + $necessite = []; |
|
| 138 | + $spip_trouve = false; |
|
| 139 | + if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) { |
|
| 140 | + foreach (array_keys($needs) as $tag) { |
|
| 141 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 142 | + if (!isset($att['id'])) { |
|
| 143 | + if (!$silence) { |
|
| 144 | + $arbre['erreur'][] = _T( |
|
| 145 | + 'erreur_plugin_attribut_balise_manquant', |
|
| 146 | + ['attribut' => 'id', 'balise' => $att] |
|
| 147 | + ); |
|
| 148 | + } |
|
| 149 | + } else { |
|
| 150 | + $necessite[] = $att; |
|
| 151 | + } |
|
| 152 | + if (strtolower((string) $att['id']) == 'spip') { |
|
| 153 | + $spip_trouve = true; |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + } |
|
| 157 | + if ($compat_spip && !$spip_trouve) { |
|
| 158 | + $necessite[] = ['id' => 'spip', 'version' => $compat_spip]; |
|
| 159 | + } |
|
| 160 | + $arbre['necessite'] = $necessite; |
|
| 161 | + $utilise = []; |
|
| 162 | + if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) { |
|
| 163 | + foreach (array_keys($uses) as $tag) { |
|
| 164 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 165 | + if (!isset($att['id'])) { |
|
| 166 | + if (!$silence) { |
|
| 167 | + $arbre['erreur'][] = _T( |
|
| 168 | + 'erreur_plugin_attribut_balise_manquant', |
|
| 169 | + ['attribut' => 'id', 'balise' => $att] |
|
| 170 | + ); |
|
| 171 | + } |
|
| 172 | + } else { |
|
| 173 | + $utilise[] = $att; |
|
| 174 | + } |
|
| 175 | + } |
|
| 176 | + } |
|
| 177 | + $arbre['utilise'] = $utilise; |
|
| 178 | + $procure = []; |
|
| 179 | + if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) { |
|
| 180 | + foreach (array_keys($uses) as $tag) { |
|
| 181 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 182 | + $procure[] = $att; |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | + $arbre['procure'] = $procure; |
|
| 186 | + $path = []; |
|
| 187 | + if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) { |
|
| 188 | + foreach (array_keys($paths) as $tag) { |
|
| 189 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 190 | + $att['path'] = $att['dir']; // ancienne syntaxe |
|
| 191 | + $path[] = $att; |
|
| 192 | + } |
|
| 193 | + } else { |
|
| 194 | + $path = [['dir' => '']]; |
|
| 195 | + } // initialiser par defaut |
|
| 196 | + $arbre['path'] = $path; |
|
| 197 | + // exposer les noisettes |
|
| 198 | + if (isset($arbre['noisette'])) { |
|
| 199 | + foreach ($arbre['noisette'] as $k => $nut) { |
|
| 200 | + $nut = preg_replace(',[.]html$,uims', '', trim((string) $nut)); |
|
| 201 | + $arbre['noisette'][$k] = $nut; |
|
| 202 | + if (!@is_readable($dir_plugins . "$plug/$nut.html") && !$silence) { |
|
| 203 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 204 | + } |
|
| 205 | + } |
|
| 206 | + } |
|
| 207 | + $traduire = []; |
|
| 208 | + if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) { |
|
| 209 | + foreach (array_keys($trads) as $tag) { |
|
| 210 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 211 | + $traduire[] = $att; |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | + $arbre['traduire'] = $traduire; |
|
| 215 | + } |
|
| 216 | 216 | } |