@@ -11,56 +11,56 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function formulaires_configurer_identite_charger_dist() { |
| 18 | - // travailler sur des meta fraiches |
|
| 19 | - include_spip('inc/meta'); |
|
| 20 | - lire_metas(); |
|
| 18 | + // travailler sur des meta fraiches |
|
| 19 | + include_spip('inc/meta'); |
|
| 20 | + lire_metas(); |
|
| 21 | 21 | |
| 22 | - $valeurs = []; |
|
| 23 | - foreach (['nom_site', 'adresse_site', 'slogan_site', 'descriptif_site', 'email_webmaster'] as $k) { |
|
| 24 | - $valeurs[$k] = $GLOBALS['meta'][$k] ?? ''; |
|
| 25 | - } |
|
| 22 | + $valeurs = []; |
|
| 23 | + foreach (['nom_site', 'adresse_site', 'slogan_site', 'descriptif_site', 'email_webmaster'] as $k) { |
|
| 24 | + $valeurs[$k] = $GLOBALS['meta'][$k] ?? ''; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - return $valeurs; |
|
| 27 | + return $valeurs; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | function formulaires_configurer_identite_verifier_dist() { |
| 31 | - $erreurs = []; |
|
| 31 | + $erreurs = []; |
|
| 32 | 32 | |
| 33 | - // adresse_site est obligatoire mais rempli automatiquement si absent ! |
|
| 34 | - foreach (['nom_site'/*,'adresse_site'*/] as $obli) { |
|
| 35 | - if (!_request($obli)) { |
|
| 36 | - $erreurs[$obli] = _T('info_obligatoire'); |
|
| 37 | - } |
|
| 38 | - } |
|
| 33 | + // adresse_site est obligatoire mais rempli automatiquement si absent ! |
|
| 34 | + foreach (['nom_site'/*,'adresse_site'*/] as $obli) { |
|
| 35 | + if (!_request($obli)) { |
|
| 36 | + $erreurs[$obli] = _T('info_obligatoire'); |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - if ($email = _request('email_webmaster') and !email_valide($email)) { |
|
| 41 | - $erreurs['email_webmaster'] = _T('info_email_invalide'); |
|
| 42 | - } |
|
| 40 | + if ($email = _request('email_webmaster') and !email_valide($email)) { |
|
| 41 | + $erreurs['email_webmaster'] = _T('info_email_invalide'); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - return $erreurs; |
|
| 44 | + return $erreurs; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | function formulaires_configurer_identite_traiter_dist() { |
| 48 | - include_spip('inc/config'); |
|
| 49 | - $adresse_site = $GLOBALS['meta']['adresse_site'] ?? ''; |
|
| 50 | - if (_request('adresse_site') != $adresse_site) { |
|
| 51 | - refuser_traiter_formulaire_ajax(); |
|
| 52 | - } |
|
| 48 | + include_spip('inc/config'); |
|
| 49 | + $adresse_site = $GLOBALS['meta']['adresse_site'] ?? ''; |
|
| 50 | + if (_request('adresse_site') != $adresse_site) { |
|
| 51 | + refuser_traiter_formulaire_ajax(); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - set_request('adresse_site', appliquer_adresse_site(_request('adresse_site'))); |
|
| 54 | + set_request('adresse_site', appliquer_adresse_site(_request('adresse_site'))); |
|
| 55 | 55 | |
| 56 | - include_spip('inc/meta'); |
|
| 57 | - foreach (['nom_site', 'slogan_site', 'descriptif_site', 'email_webmaster'] as $k) { |
|
| 58 | - ecrire_meta($k, _request($k)); |
|
| 59 | - } |
|
| 56 | + include_spip('inc/meta'); |
|
| 57 | + foreach (['nom_site', 'slogan_site', 'descriptif_site', 'email_webmaster'] as $k) { |
|
| 58 | + ecrire_meta($k, _request($k)); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - include_spip('inc/texte_mini'); |
|
| 62 | - $reload = texte_script(couper(_request('nom_site'), 35)); |
|
| 63 | - $reload = "<script type='text/javascript'>if (window.jQuery) jQuery('#bando_identite .nom_site_spip .nom').html('$reload');</script>"; |
|
| 61 | + include_spip('inc/texte_mini'); |
|
| 62 | + $reload = texte_script(couper(_request('nom_site'), 35)); |
|
| 63 | + $reload = "<script type='text/javascript'>if (window.jQuery) jQuery('#bando_identite .nom_site_spip .nom').html('$reload');</script>"; |
|
| 64 | 64 | |
| 65 | - return ['message_ok' => _T('config_info_enregistree') . $reload, 'editable' => true]; |
|
| 65 | + return ['message_ok' => _T('config_info_enregistree') . $reload, 'editable' => true]; |
|
| 66 | 66 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -45,136 +45,136 @@ discard block |
||
| 45 | 45 | **/ |
| 46 | 46 | function formulaires_dater_charger_dist($objet, $id_objet, $retour = '', $options = []) { |
| 47 | 47 | |
| 48 | - $jour = null; |
|
| 49 | - $mois = null; |
|
| 50 | - $annee = null; |
|
| 51 | - $heure = null; |
|
| 52 | - $minute = null; |
|
| 53 | - $objet = objet_type($objet); |
|
| 54 | - if (!$objet or !intval($id_objet)) { |
|
| 55 | - return false; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - if (!is_array($options)) { |
|
| 59 | - $options = unserialize($options); |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - $_id_objet = id_table_objet($objet); |
|
| 63 | - $table = table_objet($objet); |
|
| 64 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 65 | - $desc = $trouver_table($table); |
|
| 66 | - |
|
| 67 | - if (!$desc) { |
|
| 68 | - return false; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - $champ_date = $desc['date'] ?: 'date'; |
|
| 72 | - if (isset($options['champ_date']) and $options['champ_date']) { |
|
| 73 | - $champ_date = $options['champ_date']; |
|
| 74 | - } |
|
| 75 | - if (!isset($desc['field'][$champ_date])) { |
|
| 76 | - return false; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - $valeurs = [ |
|
| 80 | - 'objet' => $objet, |
|
| 81 | - 'id_objet' => $id_objet, |
|
| 82 | - 'id' => $id_objet, |
|
| 83 | - ]; |
|
| 84 | - |
|
| 85 | - |
|
| 86 | - $select = "$champ_date as date"; |
|
| 87 | - $champ_date_redac = 'date_redac'; |
|
| 88 | - if (isset($options['champ_date_redac']) and $options['champ_date_redac']) { |
|
| 89 | - $champ_date_redac = $options['champ_date_redac']; |
|
| 90 | - } |
|
| 91 | - if (isset($desc['field'][$champ_date_redac])) { |
|
| 92 | - $select .= ",$champ_date_redac as date_redac"; |
|
| 93 | - } |
|
| 94 | - if (isset($desc['field']['statut'])) { |
|
| 95 | - $select .= ',statut'; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - |
|
| 99 | - $row = sql_fetsel($select, $desc['table'], "$_id_objet=" . intval($id_objet)); |
|
| 100 | - $statut = $row['statut'] ?? 'publie'; // pas de statut => publie |
|
| 101 | - |
|
| 102 | - $valeurs['editable'] = autoriser('dater', $objet, $id_objet, null, ['statut' => $statut]); |
|
| 103 | - |
|
| 104 | - $possedeDateRedac = false; |
|
| 105 | - |
|
| 106 | - if ( |
|
| 107 | - isset($row['date_redac']) and |
|
| 108 | - $regs = recup_date($row['date_redac'], false) |
|
| 109 | - ) { |
|
| 110 | - $annee_redac = $regs[0]; |
|
| 111 | - $mois_redac = $regs[1]; |
|
| 112 | - $jour_redac = $regs[2]; |
|
| 113 | - $heure_redac = $regs[3]; |
|
| 114 | - $minute_redac = $regs[4]; |
|
| 115 | - $possedeDateRedac = true; |
|
| 116 | - // attention : les vrai dates de l'annee 1 sont stockee avec +9000 => 9001 |
|
| 117 | - // mais reviennent ici en annee 1 par recup_date |
|
| 118 | - // on verifie donc que le intval($row['date_redac']) qui ressort l'annee |
|
| 119 | - // est bien lui aussi <=1 : dans ce cas c'est une date sql 'nulle' ou presque, selon |
|
| 120 | - // le gestionnnaire sql utilise (0001-01-01 pour PG par exemple) |
|
| 121 | - if (intval($row['date_redac']) <= 1 and ($annee_redac <= 1) and ($mois_redac <= 1) and ($jour_redac <= 1)) { |
|
| 122 | - $possedeDateRedac = false; |
|
| 123 | - } |
|
| 124 | - } else { |
|
| 125 | - $annee_redac = $mois_redac = $jour_redac = $heure_redac = $minute_redac = 0; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - if ($regs = recup_date($row['date'], false)) { |
|
| 129 | - $annee = $regs[0]; |
|
| 130 | - $mois = $regs[1]; |
|
| 131 | - $jour = $regs[2]; |
|
| 132 | - $heure = $regs[3]; |
|
| 133 | - $minute = $regs[4]; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - // attention, si la variable s'appelle date ou date_redac, le compilo va |
|
| 137 | - // la normaliser, ce qu'on ne veut pas ici. |
|
| 138 | - $valeurs['afficher_date_redac'] = ($possedeDateRedac ? $row['date_redac'] : ''); |
|
| 139 | - $valeurs['date_redac_jour'] = dater_formater_saisie_jour($jour_redac, $mois_redac, $annee_redac); |
|
| 140 | - $valeurs['date_redac_heure'] = "$heure_redac:$minute_redac"; |
|
| 141 | - |
|
| 142 | - $valeurs['afficher_date'] = $row['date']; |
|
| 143 | - $valeurs['date_jour'] = dater_formater_saisie_jour($jour, $mois, $annee); |
|
| 144 | - $valeurs['date_heure'] = "$heure:$minute"; |
|
| 145 | - |
|
| 146 | - $valeurs['sans_redac'] = !$possedeDateRedac; |
|
| 147 | - |
|
| 148 | - if (isset($options['date_redac'])) { |
|
| 149 | - $valeurs['_editer_date_anterieure'] = $options['date_redac']; |
|
| 150 | - } else { |
|
| 151 | - $valeurs['_editer_date_anterieure'] = ($objet == 'article' and ($GLOBALS['meta']['articles_redac'] != 'non' or $possedeDateRedac)); |
|
| 152 | - } |
|
| 153 | - $valeurs['_label_date'] = (($statut == 'publie') ? |
|
| 154 | - _T('texte_date_publication_objet') : _T('texte_date_creation_objet')); |
|
| 155 | - if (isset($options['label_date']) and $options['label_date']) { |
|
| 156 | - $valeurs['_label_date'] = $options['label_date']; |
|
| 157 | - } |
|
| 158 | - if (isset($options['label_date_redac']) and $options['label_date_redac']) { |
|
| 159 | - $valeurs['_label_date_redac'] = $options['label_date_redac']; |
|
| 160 | - } |
|
| 161 | - if (isset($options['texte_sans_date_redac']) and $options['texte_sans_date_redac']) { |
|
| 162 | - $valeurs['_texte_sans_date_redac'] = $options['texte_sans_date_redac']; |
|
| 163 | - } |
|
| 164 | - if (isset($options['class']) and $options['class']) { |
|
| 165 | - $valeurs['_class'] = $options['class']; |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - $valeurs['_saisie_en_cours'] = (_request('_saisie_en_cours') !== null or _request('date_jour') !== null); |
|
| 169 | - |
|
| 170 | - // cas ou l'on ne peut pas dater mais on peut modifier la date de redac anterieure |
|
| 171 | - // https://core.spip.net/issues/3494 |
|
| 172 | - $valeurs['_editer_date'] = $valeurs['editable']; |
|
| 173 | - if ($valeurs['_editer_date_anterieure'] and !$valeurs['editable']) { |
|
| 174 | - $valeurs['editable'] = autoriser('modifier', $objet, $id_objet); |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - return $valeurs; |
|
| 48 | + $jour = null; |
|
| 49 | + $mois = null; |
|
| 50 | + $annee = null; |
|
| 51 | + $heure = null; |
|
| 52 | + $minute = null; |
|
| 53 | + $objet = objet_type($objet); |
|
| 54 | + if (!$objet or !intval($id_objet)) { |
|
| 55 | + return false; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + if (!is_array($options)) { |
|
| 59 | + $options = unserialize($options); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + $_id_objet = id_table_objet($objet); |
|
| 63 | + $table = table_objet($objet); |
|
| 64 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 65 | + $desc = $trouver_table($table); |
|
| 66 | + |
|
| 67 | + if (!$desc) { |
|
| 68 | + return false; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + $champ_date = $desc['date'] ?: 'date'; |
|
| 72 | + if (isset($options['champ_date']) and $options['champ_date']) { |
|
| 73 | + $champ_date = $options['champ_date']; |
|
| 74 | + } |
|
| 75 | + if (!isset($desc['field'][$champ_date])) { |
|
| 76 | + return false; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + $valeurs = [ |
|
| 80 | + 'objet' => $objet, |
|
| 81 | + 'id_objet' => $id_objet, |
|
| 82 | + 'id' => $id_objet, |
|
| 83 | + ]; |
|
| 84 | + |
|
| 85 | + |
|
| 86 | + $select = "$champ_date as date"; |
|
| 87 | + $champ_date_redac = 'date_redac'; |
|
| 88 | + if (isset($options['champ_date_redac']) and $options['champ_date_redac']) { |
|
| 89 | + $champ_date_redac = $options['champ_date_redac']; |
|
| 90 | + } |
|
| 91 | + if (isset($desc['field'][$champ_date_redac])) { |
|
| 92 | + $select .= ",$champ_date_redac as date_redac"; |
|
| 93 | + } |
|
| 94 | + if (isset($desc['field']['statut'])) { |
|
| 95 | + $select .= ',statut'; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + |
|
| 99 | + $row = sql_fetsel($select, $desc['table'], "$_id_objet=" . intval($id_objet)); |
|
| 100 | + $statut = $row['statut'] ?? 'publie'; // pas de statut => publie |
|
| 101 | + |
|
| 102 | + $valeurs['editable'] = autoriser('dater', $objet, $id_objet, null, ['statut' => $statut]); |
|
| 103 | + |
|
| 104 | + $possedeDateRedac = false; |
|
| 105 | + |
|
| 106 | + if ( |
|
| 107 | + isset($row['date_redac']) and |
|
| 108 | + $regs = recup_date($row['date_redac'], false) |
|
| 109 | + ) { |
|
| 110 | + $annee_redac = $regs[0]; |
|
| 111 | + $mois_redac = $regs[1]; |
|
| 112 | + $jour_redac = $regs[2]; |
|
| 113 | + $heure_redac = $regs[3]; |
|
| 114 | + $minute_redac = $regs[4]; |
|
| 115 | + $possedeDateRedac = true; |
|
| 116 | + // attention : les vrai dates de l'annee 1 sont stockee avec +9000 => 9001 |
|
| 117 | + // mais reviennent ici en annee 1 par recup_date |
|
| 118 | + // on verifie donc que le intval($row['date_redac']) qui ressort l'annee |
|
| 119 | + // est bien lui aussi <=1 : dans ce cas c'est une date sql 'nulle' ou presque, selon |
|
| 120 | + // le gestionnnaire sql utilise (0001-01-01 pour PG par exemple) |
|
| 121 | + if (intval($row['date_redac']) <= 1 and ($annee_redac <= 1) and ($mois_redac <= 1) and ($jour_redac <= 1)) { |
|
| 122 | + $possedeDateRedac = false; |
|
| 123 | + } |
|
| 124 | + } else { |
|
| 125 | + $annee_redac = $mois_redac = $jour_redac = $heure_redac = $minute_redac = 0; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + if ($regs = recup_date($row['date'], false)) { |
|
| 129 | + $annee = $regs[0]; |
|
| 130 | + $mois = $regs[1]; |
|
| 131 | + $jour = $regs[2]; |
|
| 132 | + $heure = $regs[3]; |
|
| 133 | + $minute = $regs[4]; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + // attention, si la variable s'appelle date ou date_redac, le compilo va |
|
| 137 | + // la normaliser, ce qu'on ne veut pas ici. |
|
| 138 | + $valeurs['afficher_date_redac'] = ($possedeDateRedac ? $row['date_redac'] : ''); |
|
| 139 | + $valeurs['date_redac_jour'] = dater_formater_saisie_jour($jour_redac, $mois_redac, $annee_redac); |
|
| 140 | + $valeurs['date_redac_heure'] = "$heure_redac:$minute_redac"; |
|
| 141 | + |
|
| 142 | + $valeurs['afficher_date'] = $row['date']; |
|
| 143 | + $valeurs['date_jour'] = dater_formater_saisie_jour($jour, $mois, $annee); |
|
| 144 | + $valeurs['date_heure'] = "$heure:$minute"; |
|
| 145 | + |
|
| 146 | + $valeurs['sans_redac'] = !$possedeDateRedac; |
|
| 147 | + |
|
| 148 | + if (isset($options['date_redac'])) { |
|
| 149 | + $valeurs['_editer_date_anterieure'] = $options['date_redac']; |
|
| 150 | + } else { |
|
| 151 | + $valeurs['_editer_date_anterieure'] = ($objet == 'article' and ($GLOBALS['meta']['articles_redac'] != 'non' or $possedeDateRedac)); |
|
| 152 | + } |
|
| 153 | + $valeurs['_label_date'] = (($statut == 'publie') ? |
|
| 154 | + _T('texte_date_publication_objet') : _T('texte_date_creation_objet')); |
|
| 155 | + if (isset($options['label_date']) and $options['label_date']) { |
|
| 156 | + $valeurs['_label_date'] = $options['label_date']; |
|
| 157 | + } |
|
| 158 | + if (isset($options['label_date_redac']) and $options['label_date_redac']) { |
|
| 159 | + $valeurs['_label_date_redac'] = $options['label_date_redac']; |
|
| 160 | + } |
|
| 161 | + if (isset($options['texte_sans_date_redac']) and $options['texte_sans_date_redac']) { |
|
| 162 | + $valeurs['_texte_sans_date_redac'] = $options['texte_sans_date_redac']; |
|
| 163 | + } |
|
| 164 | + if (isset($options['class']) and $options['class']) { |
|
| 165 | + $valeurs['_class'] = $options['class']; |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + $valeurs['_saisie_en_cours'] = (_request('_saisie_en_cours') !== null or _request('date_jour') !== null); |
|
| 169 | + |
|
| 170 | + // cas ou l'on ne peut pas dater mais on peut modifier la date de redac anterieure |
|
| 171 | + // https://core.spip.net/issues/3494 |
|
| 172 | + $valeurs['_editer_date'] = $valeurs['editable']; |
|
| 173 | + if ($valeurs['_editer_date_anterieure'] and !$valeurs['editable']) { |
|
| 174 | + $valeurs['editable'] = autoriser('modifier', $objet, $id_objet); |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + return $valeurs; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -192,20 +192,20 @@ discard block |
||
| 192 | 192 | * Date formatée tel que `02/10/2012` |
| 193 | 193 | **/ |
| 194 | 194 | function dater_formater_saisie_jour($jour, $mois, $annee, $sep = '/') { |
| 195 | - $annee = str_pad($annee, 4, '0', STR_PAD_LEFT); |
|
| 196 | - if (intval($jour)) { |
|
| 197 | - $jour = str_pad($jour, 2, '0', STR_PAD_LEFT); |
|
| 198 | - $mois = str_pad($mois, 2, '0', STR_PAD_LEFT); |
|
| 195 | + $annee = str_pad($annee, 4, '0', STR_PAD_LEFT); |
|
| 196 | + if (intval($jour)) { |
|
| 197 | + $jour = str_pad($jour, 2, '0', STR_PAD_LEFT); |
|
| 198 | + $mois = str_pad($mois, 2, '0', STR_PAD_LEFT); |
|
| 199 | 199 | |
| 200 | - return "$jour$sep$mois$sep$annee"; |
|
| 201 | - } |
|
| 202 | - if (intval($mois)) { |
|
| 203 | - $mois = str_pad($mois, 2, '0', STR_PAD_LEFT); |
|
| 200 | + return "$jour$sep$mois$sep$annee"; |
|
| 201 | + } |
|
| 202 | + if (intval($mois)) { |
|
| 203 | + $mois = str_pad($mois, 2, '0', STR_PAD_LEFT); |
|
| 204 | 204 | |
| 205 | - return "$mois$sep$annee"; |
|
| 206 | - } |
|
| 205 | + return "$mois$sep$annee"; |
|
| 206 | + } |
|
| 207 | 207 | |
| 208 | - return $annee; |
|
| 208 | + return $annee; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * Hash du formulaire |
| 225 | 225 | **/ |
| 226 | 226 | function formulaires_dater_identifier_dist($objet, $id_objet, $retour = '', $options = []) { |
| 227 | - return serialize([$objet, $id_objet]); |
|
| 227 | + return serialize([$objet, $id_objet]); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
@@ -242,30 +242,30 @@ discard block |
||
| 242 | 242 | * Tableau des erreurs |
| 243 | 243 | */ |
| 244 | 244 | function formulaires_dater_verifier_dist($objet, $id_objet, $retour = '', $options = []) { |
| 245 | - $erreurs = []; |
|
| 246 | - |
|
| 247 | - // ouvrir le formulaire en edition ? |
|
| 248 | - if (_request('_saisie_en_cours')) { |
|
| 249 | - $erreurs['message_erreur'] = ''; |
|
| 250 | - |
|
| 251 | - return $erreurs; |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - if (_request('changer')) { |
|
| 255 | - foreach (['date', 'date_redac'] as $k) { |
|
| 256 | - if ($v = _request($k . '_jour') and !dater_recuperer_date_saisie($v, $k)) { |
|
| 257 | - $erreurs[$k] = _T('format_date_incorrecte'); |
|
| 258 | - } elseif ($v = _request($k . '_heure') and !dater_recuperer_heure_saisie($v)) { |
|
| 259 | - $erreurs[$k] = _T('format_heure_incorrecte'); |
|
| 260 | - } |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - if (!_request('date_jour')) { |
|
| 264 | - $erreurs['date'] = _T('info_obligatoire'); |
|
| 265 | - } |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - return $erreurs; |
|
| 245 | + $erreurs = []; |
|
| 246 | + |
|
| 247 | + // ouvrir le formulaire en edition ? |
|
| 248 | + if (_request('_saisie_en_cours')) { |
|
| 249 | + $erreurs['message_erreur'] = ''; |
|
| 250 | + |
|
| 251 | + return $erreurs; |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + if (_request('changer')) { |
|
| 255 | + foreach (['date', 'date_redac'] as $k) { |
|
| 256 | + if ($v = _request($k . '_jour') and !dater_recuperer_date_saisie($v, $k)) { |
|
| 257 | + $erreurs[$k] = _T('format_date_incorrecte'); |
|
| 258 | + } elseif ($v = _request($k . '_heure') and !dater_recuperer_heure_saisie($v)) { |
|
| 259 | + $erreurs[$k] = _T('format_heure_incorrecte'); |
|
| 260 | + } |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + if (!_request('date_jour')) { |
|
| 264 | + $erreurs['date'] = _T('info_obligatoire'); |
|
| 265 | + } |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + return $erreurs; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -283,79 +283,79 @@ discard block |
||
| 283 | 283 | * Retours des traitements |
| 284 | 284 | */ |
| 285 | 285 | function formulaires_dater_traiter_dist($objet, $id_objet, $retour = '', $options = []) { |
| 286 | - $res = ['editable' => ' ']; |
|
| 287 | - |
|
| 288 | - if (_request('changer')) { |
|
| 289 | - $table = table_objet($objet); |
|
| 290 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 291 | - $desc = $trouver_table($table); |
|
| 292 | - |
|
| 293 | - if (!$desc) { |
|
| 294 | - return ['message_erreur' => _L('erreur')]; |
|
| 295 | - } #impossible en principe |
|
| 296 | - |
|
| 297 | - $champ_date = $desc['date'] ?: 'date'; |
|
| 298 | - if (isset($options['champ_date']) and $options['champ_date']) { |
|
| 299 | - $champ_date = $options['champ_date']; |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - $set = []; |
|
| 303 | - |
|
| 304 | - $charger = charger_fonction('charger', 'formulaires/dater/'); |
|
| 305 | - $v = $charger($objet, $id_objet, $retour, $options); |
|
| 306 | - |
|
| 307 | - if ($v['_editer_date']) { |
|
| 308 | - if (!$d = dater_recuperer_date_saisie(_request('date_jour'))) { |
|
| 309 | - $d = [date('Y'), date('m'), date('d')]; |
|
| 310 | - } |
|
| 311 | - if (!$h = dater_recuperer_heure_saisie(_request('date_heure'))) { |
|
| 312 | - $h = [0, 0]; |
|
| 313 | - } |
|
| 314 | - |
|
| 315 | - $set[$champ_date] = sql_format_date($d[0], $d[1], $d[2], $h[0], $h[1]); |
|
| 316 | - } |
|
| 317 | - |
|
| 318 | - $champ_date_redac = 'date_redac'; |
|
| 319 | - if (isset($options['champ_date_redac']) and $options['champ_date_redac']) { |
|
| 320 | - $champ_date_redac = $options['champ_date_redac']; |
|
| 321 | - } |
|
| 322 | - if (isset($desc['field'][$champ_date_redac]) and $v['_editer_date_anterieure']) { |
|
| 323 | - if (!_request('date_redac_jour') or _request('sans_redac')) { |
|
| 324 | - $set[$champ_date_redac] = sql_format_date(0, 0, 0, 0, 0, 0); |
|
| 325 | - } else { |
|
| 326 | - if (!$d = dater_recuperer_date_saisie(_request('date_redac_jour'), 'date_redac')) { |
|
| 327 | - $d = [date('Y'), date('m'), date('d')]; |
|
| 328 | - } |
|
| 329 | - if (!$h = dater_recuperer_heure_saisie(_request('date_redac_heure'))) { |
|
| 330 | - $h = [0, 0]; |
|
| 331 | - } |
|
| 332 | - $set[$champ_date_redac] = sql_format_date($d[0], $d[1], $d[2], $h[0], $h[1]); |
|
| 333 | - } |
|
| 334 | - } |
|
| 335 | - |
|
| 336 | - if (count($set)) { |
|
| 337 | - $publie_avant = objet_test_si_publie($objet, $id_objet); |
|
| 338 | - include_spip('action/editer_objet'); |
|
| 339 | - objet_modifier($objet, $id_objet, $set); |
|
| 340 | - $publie_apres = objet_test_si_publie($objet, $id_objet); |
|
| 341 | - if ($publie_avant !== $publie_apres) { |
|
| 342 | - // on refuse ajax pour forcer le rechargement de la page ici |
|
| 343 | - // on refera traiter une 2eme fois, mais c'est sans consequence |
|
| 344 | - refuser_traiter_formulaire_ajax(); |
|
| 345 | - } |
|
| 346 | - } |
|
| 347 | - } |
|
| 348 | - |
|
| 349 | - if ($retour) { |
|
| 350 | - $res['redirect'] = $retour; |
|
| 351 | - } |
|
| 352 | - |
|
| 353 | - set_request('date_jour'); |
|
| 354 | - set_request('date_redac_jour'); |
|
| 355 | - set_request('date_heure'); |
|
| 356 | - set_request('date_redac_heure'); |
|
| 357 | - |
|
| 358 | - return $res; |
|
| 286 | + $res = ['editable' => ' ']; |
|
| 287 | + |
|
| 288 | + if (_request('changer')) { |
|
| 289 | + $table = table_objet($objet); |
|
| 290 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 291 | + $desc = $trouver_table($table); |
|
| 292 | + |
|
| 293 | + if (!$desc) { |
|
| 294 | + return ['message_erreur' => _L('erreur')]; |
|
| 295 | + } #impossible en principe |
|
| 296 | + |
|
| 297 | + $champ_date = $desc['date'] ?: 'date'; |
|
| 298 | + if (isset($options['champ_date']) and $options['champ_date']) { |
|
| 299 | + $champ_date = $options['champ_date']; |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + $set = []; |
|
| 303 | + |
|
| 304 | + $charger = charger_fonction('charger', 'formulaires/dater/'); |
|
| 305 | + $v = $charger($objet, $id_objet, $retour, $options); |
|
| 306 | + |
|
| 307 | + if ($v['_editer_date']) { |
|
| 308 | + if (!$d = dater_recuperer_date_saisie(_request('date_jour'))) { |
|
| 309 | + $d = [date('Y'), date('m'), date('d')]; |
|
| 310 | + } |
|
| 311 | + if (!$h = dater_recuperer_heure_saisie(_request('date_heure'))) { |
|
| 312 | + $h = [0, 0]; |
|
| 313 | + } |
|
| 314 | + |
|
| 315 | + $set[$champ_date] = sql_format_date($d[0], $d[1], $d[2], $h[0], $h[1]); |
|
| 316 | + } |
|
| 317 | + |
|
| 318 | + $champ_date_redac = 'date_redac'; |
|
| 319 | + if (isset($options['champ_date_redac']) and $options['champ_date_redac']) { |
|
| 320 | + $champ_date_redac = $options['champ_date_redac']; |
|
| 321 | + } |
|
| 322 | + if (isset($desc['field'][$champ_date_redac]) and $v['_editer_date_anterieure']) { |
|
| 323 | + if (!_request('date_redac_jour') or _request('sans_redac')) { |
|
| 324 | + $set[$champ_date_redac] = sql_format_date(0, 0, 0, 0, 0, 0); |
|
| 325 | + } else { |
|
| 326 | + if (!$d = dater_recuperer_date_saisie(_request('date_redac_jour'), 'date_redac')) { |
|
| 327 | + $d = [date('Y'), date('m'), date('d')]; |
|
| 328 | + } |
|
| 329 | + if (!$h = dater_recuperer_heure_saisie(_request('date_redac_heure'))) { |
|
| 330 | + $h = [0, 0]; |
|
| 331 | + } |
|
| 332 | + $set[$champ_date_redac] = sql_format_date($d[0], $d[1], $d[2], $h[0], $h[1]); |
|
| 333 | + } |
|
| 334 | + } |
|
| 335 | + |
|
| 336 | + if (count($set)) { |
|
| 337 | + $publie_avant = objet_test_si_publie($objet, $id_objet); |
|
| 338 | + include_spip('action/editer_objet'); |
|
| 339 | + objet_modifier($objet, $id_objet, $set); |
|
| 340 | + $publie_apres = objet_test_si_publie($objet, $id_objet); |
|
| 341 | + if ($publie_avant !== $publie_apres) { |
|
| 342 | + // on refuse ajax pour forcer le rechargement de la page ici |
|
| 343 | + // on refera traiter une 2eme fois, mais c'est sans consequence |
|
| 344 | + refuser_traiter_formulaire_ajax(); |
|
| 345 | + } |
|
| 346 | + } |
|
| 347 | + } |
|
| 348 | + |
|
| 349 | + if ($retour) { |
|
| 350 | + $res['redirect'] = $retour; |
|
| 351 | + } |
|
| 352 | + |
|
| 353 | + set_request('date_jour'); |
|
| 354 | + set_request('date_redac_jour'); |
|
| 355 | + set_request('date_heure'); |
|
| 356 | + set_request('date_redac_heure'); |
|
| 357 | + |
|
| 358 | + return $res; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /** |
@@ -366,24 +366,24 @@ discard block |
||
| 366 | 366 | * @return array|string Chaîne vide si date invalide, tableau (année, mois, jour) sinon. |
| 367 | 367 | */ |
| 368 | 368 | function dater_recuperer_date_saisie($post, $quoi = 'date') { |
| 369 | - if (!preg_match('#^(?:(?:([0-9]{1,2})[/-])?([0-9]{1,2})[/-])?([0-9]{4}|[0-9]{1,2})#', $post, $regs)) { |
|
| 370 | - return ''; |
|
| 371 | - } |
|
| 372 | - if ($quoi == 'date_redac') { |
|
| 373 | - if ($regs[3] <> '' and $regs[3] < 1001) { |
|
| 374 | - $regs[3] += 9000; |
|
| 375 | - } |
|
| 376 | - |
|
| 377 | - return [$regs[3], $regs[2], $regs[1]]; |
|
| 378 | - } else { |
|
| 379 | - if ( |
|
| 380 | - checkdate(intval($regs[2]), intval($regs[1]), intval($regs[3])) |
|
| 381 | - and $t = mktime(0, 0, 0, $regs[2], $regs[1], $regs[3]) |
|
| 382 | - ) { |
|
| 383 | - return [date('Y', $t), date('m', $t), date('d', $t)]; |
|
| 384 | - } |
|
| 385 | - return ''; |
|
| 386 | - } |
|
| 369 | + if (!preg_match('#^(?:(?:([0-9]{1,2})[/-])?([0-9]{1,2})[/-])?([0-9]{4}|[0-9]{1,2})#', $post, $regs)) { |
|
| 370 | + return ''; |
|
| 371 | + } |
|
| 372 | + if ($quoi == 'date_redac') { |
|
| 373 | + if ($regs[3] <> '' and $regs[3] < 1001) { |
|
| 374 | + $regs[3] += 9000; |
|
| 375 | + } |
|
| 376 | + |
|
| 377 | + return [$regs[3], $regs[2], $regs[1]]; |
|
| 378 | + } else { |
|
| 379 | + if ( |
|
| 380 | + checkdate(intval($regs[2]), intval($regs[1]), intval($regs[3])) |
|
| 381 | + and $t = mktime(0, 0, 0, $regs[2], $regs[1], $regs[3]) |
|
| 382 | + ) { |
|
| 383 | + return [date('Y', $t), date('m', $t), date('d', $t)]; |
|
| 384 | + } |
|
| 385 | + return ''; |
|
| 386 | + } |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | /** |
@@ -393,12 +393,12 @@ discard block |
||
| 393 | 393 | * @return array |
| 394 | 394 | */ |
| 395 | 395 | function dater_recuperer_heure_saisie($post) { |
| 396 | - if (!preg_match('#([0-9]{1,2})(?:[h:](?:([0-9]{1,2}))?)?#', $post, $regs)) { |
|
| 397 | - return ''; |
|
| 398 | - } |
|
| 399 | - if ($regs[1] > 23 or $regs[2] > 59) { |
|
| 400 | - return ''; |
|
| 401 | - } |
|
| 402 | - |
|
| 403 | - return [$regs[1], $regs[2]]; |
|
| 396 | + if (!preg_match('#([0-9]{1,2})(?:[h:](?:([0-9]{1,2}))?)?#', $post, $regs)) { |
|
| 397 | + return ''; |
|
| 398 | + } |
|
| 399 | + if ($regs[1] > 23 or $regs[2] > 59) { |
|
| 400 | + return ''; |
|
| 401 | + } |
|
| 402 | + |
|
| 403 | + return [$regs[1], $regs[2]]; |
|
| 404 | 404 | } |
@@ -11,53 +11,53 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function formulaires_configurer_multilinguisme_charger_dist() { |
| 18 | - $valeurs = []; |
|
| 19 | - $valeurs['multi_secteurs'] = $GLOBALS['meta']['multi_secteurs']; |
|
| 20 | - foreach (['multi_objets', 'gerer_trad_objets'] as $m) { |
|
| 21 | - $valeurs[$m] = explode(',', $GLOBALS['meta'][$m] ?? ''); |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - if ( |
|
| 25 | - is_countable($valeurs['multi_objets']) ? count($valeurs['multi_objets']) : 0 |
|
| 26 | - or count(explode(',', $GLOBALS['meta']['langues_utilisees'])) > 1 |
|
| 27 | - ) { |
|
| 28 | - $selection = (is_null(_request('multi_objets')) ? |
|
| 29 | - explode(',', $GLOBALS['meta']['langues_multilingue']) : _request('langues_auth')); |
|
| 30 | - $valeurs['_langues'] = saisie_langues_utiles('langues_auth', $selection ?: []); |
|
| 31 | - $valeurs['_nb_langues_selection'] = is_countable($selection) ? count($selection) : 0; |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - return $valeurs; |
|
| 18 | + $valeurs = []; |
|
| 19 | + $valeurs['multi_secteurs'] = $GLOBALS['meta']['multi_secteurs']; |
|
| 20 | + foreach (['multi_objets', 'gerer_trad_objets'] as $m) { |
|
| 21 | + $valeurs[$m] = explode(',', $GLOBALS['meta'][$m] ?? ''); |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + if ( |
|
| 25 | + is_countable($valeurs['multi_objets']) ? count($valeurs['multi_objets']) : 0 |
|
| 26 | + or count(explode(',', $GLOBALS['meta']['langues_utilisees'])) > 1 |
|
| 27 | + ) { |
|
| 28 | + $selection = (is_null(_request('multi_objets')) ? |
|
| 29 | + explode(',', $GLOBALS['meta']['langues_multilingue']) : _request('langues_auth')); |
|
| 30 | + $valeurs['_langues'] = saisie_langues_utiles('langues_auth', $selection ?: []); |
|
| 31 | + $valeurs['_nb_langues_selection'] = is_countable($selection) ? count($selection) : 0; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + return $valeurs; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | function formulaires_configurer_multilinguisme_traiter_dist() { |
| 39 | - $res = ['editable' => true]; |
|
| 40 | - // un checkbox seul de name X non coche n'est pas poste. |
|
| 41 | - // on verifie le champ X_check qui indique que la checkbox etait presente dans le formulaire. |
|
| 42 | - foreach (['multi_secteurs'] as $m) { |
|
| 43 | - if (!is_null(_request($m . '_check'))) { |
|
| 44 | - ecrire_meta($m, _request($m) ? 'oui' : 'non'); |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - foreach (['multi_objets', 'gerer_trad_objets'] as $m) { |
|
| 48 | - if (!is_null($v = _request($m))) { |
|
| 49 | - // join et enlever la valeur vide '' |
|
| 50 | - ecrire_meta($m, implode(',', array_diff($v, ['']))); |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - if ($i = _request('langues_auth') and is_array($i)) { |
|
| 55 | - $i = array_unique(array_merge($i, explode(',', $GLOBALS['meta']['langues_utilisees']))); |
|
| 56 | - ecrire_meta('langues_multilingue', implode(',', $i)); |
|
| 57 | - } |
|
| 58 | - $res['message_ok'] = _T('config_info_enregistree'); |
|
| 59 | - |
|
| 60 | - return $res; |
|
| 39 | + $res = ['editable' => true]; |
|
| 40 | + // un checkbox seul de name X non coche n'est pas poste. |
|
| 41 | + // on verifie le champ X_check qui indique que la checkbox etait presente dans le formulaire. |
|
| 42 | + foreach (['multi_secteurs'] as $m) { |
|
| 43 | + if (!is_null(_request($m . '_check'))) { |
|
| 44 | + ecrire_meta($m, _request($m) ? 'oui' : 'non'); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + foreach (['multi_objets', 'gerer_trad_objets'] as $m) { |
|
| 48 | + if (!is_null($v = _request($m))) { |
|
| 49 | + // join et enlever la valeur vide '' |
|
| 50 | + ecrire_meta($m, implode(',', array_diff($v, ['']))); |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + if ($i = _request('langues_auth') and is_array($i)) { |
|
| 55 | + $i = array_unique(array_merge($i, explode(',', $GLOBALS['meta']['langues_utilisees']))); |
|
| 56 | + ecrire_meta('langues_multilingue', implode(',', $i)); |
|
| 57 | + } |
|
| 58 | + $res['message_ok'] = _T('config_info_enregistree'); |
|
| 59 | + |
|
| 60 | + return $res; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @return string |
| 68 | 68 | */ |
| 69 | 69 | function table_supporte_lang($table_sql) { |
| 70 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 71 | - $desc = $trouver_table($table_sql); |
|
| 72 | - if (!$desc or !isset($desc['field']['lang'])) { |
|
| 73 | - return ''; |
|
| 74 | - } |
|
| 70 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 71 | + $desc = $trouver_table($table_sql); |
|
| 72 | + if (!$desc or !isset($desc['field']['lang'])) { |
|
| 73 | + return ''; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - return ' '; |
|
| 76 | + return ' '; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -83,67 +83,67 @@ discard block |
||
| 83 | 83 | * @return string |
| 84 | 84 | */ |
| 85 | 85 | function table_supporte_trad($table_sql) { |
| 86 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 87 | - $desc = $trouver_table($table_sql); |
|
| 88 | - if (!$desc or !isset($desc['field']['id_trad'])) { |
|
| 89 | - return ''; |
|
| 90 | - } |
|
| 86 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 87 | + $desc = $trouver_table($table_sql); |
|
| 88 | + if (!$desc or !isset($desc['field']['id_trad'])) { |
|
| 89 | + return ''; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - return ' '; |
|
| 92 | + return ' '; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | function saisie_langues_utiles($name, $selection) { |
| 97 | - include_spip('inc/lang_liste'); |
|
| 98 | - $langues = $GLOBALS['codes_langues']; |
|
| 99 | - |
|
| 100 | - $langues_installees = explode(',', $GLOBALS['meta']['langues_proposees']); |
|
| 101 | - $langues_trad = array_flip($langues_installees); |
|
| 102 | - |
|
| 103 | - $langues_bloquees = explode(',', $GLOBALS['meta']['langues_utilisees']); |
|
| 104 | - |
|
| 105 | - $res = ''; |
|
| 106 | - |
|
| 107 | - $i = 0; |
|
| 108 | - foreach ($langues_bloquees as $code_langue) { |
|
| 109 | - $nom_langue = $langues[$code_langue]; |
|
| 110 | - $res .= "<li class='choix " |
|
| 111 | - . alterner(++$i, 'odd', 'even') |
|
| 112 | - . (isset($langues_trad[$code_langue]) ? ' traduite' : '') |
|
| 113 | - . "'>" |
|
| 114 | - . "<input type='hidden' name='{$name}[]' value='$code_langue'>" // necessaire ... |
|
| 115 | - . "<input type='checkbox' name='{$name}[]' id='{$name}_$code_langue' value='$code_langue' checked='checked' disabled='disabled' />" |
|
| 116 | - . "<label for='{$name}_$code_langue'>" . $nom_langue . " <span class='code_langue'>[$code_langue]</span></label>" |
|
| 117 | - . '</li>'; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - if ($res) { |
|
| 121 | - $res = "<ul id='langues_bloquees'>" . $res . "</ul><div class='nettoyeur'></div>"; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - $res .= "<ul id='langues_proposees'>"; |
|
| 125 | - |
|
| 126 | - $i = 0; |
|
| 127 | - $langues_bloquees = array_flip($langues_bloquees); |
|
| 128 | - foreach ($langues as $code_langue => $nom_langue) { |
|
| 129 | - if (!isset($langues_bloquees[$code_langue])) { |
|
| 130 | - $checked = (in_array($code_langue, $selection) ? ' checked="checked"' : ''); |
|
| 131 | - $res .= "<li class='choix " |
|
| 132 | - . alterner(++$i, 'odd', 'even') |
|
| 133 | - . (isset($langues_trad[$code_langue]) ? ' traduite' : '') |
|
| 134 | - . "'>" |
|
| 135 | - . "<input type='checkbox' name='{$name}[]' id='{$name}_$code_langue' value='$code_langue'" |
|
| 136 | - . $checked |
|
| 137 | - . '/>' |
|
| 138 | - . "<label for='{$name}_$code_langue'" |
|
| 139 | - . ($checked ? " class='on'" : '') |
|
| 140 | - . '>' |
|
| 141 | - . $nom_langue . " <span class='code_langue'>[$code_langue]</span></label>" |
|
| 142 | - . '</li>'; |
|
| 143 | - } |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - $res .= "</ul><div class='nettoyeur'></div>"; |
|
| 147 | - |
|
| 148 | - return $res; |
|
| 97 | + include_spip('inc/lang_liste'); |
|
| 98 | + $langues = $GLOBALS['codes_langues']; |
|
| 99 | + |
|
| 100 | + $langues_installees = explode(',', $GLOBALS['meta']['langues_proposees']); |
|
| 101 | + $langues_trad = array_flip($langues_installees); |
|
| 102 | + |
|
| 103 | + $langues_bloquees = explode(',', $GLOBALS['meta']['langues_utilisees']); |
|
| 104 | + |
|
| 105 | + $res = ''; |
|
| 106 | + |
|
| 107 | + $i = 0; |
|
| 108 | + foreach ($langues_bloquees as $code_langue) { |
|
| 109 | + $nom_langue = $langues[$code_langue]; |
|
| 110 | + $res .= "<li class='choix " |
|
| 111 | + . alterner(++$i, 'odd', 'even') |
|
| 112 | + . (isset($langues_trad[$code_langue]) ? ' traduite' : '') |
|
| 113 | + . "'>" |
|
| 114 | + . "<input type='hidden' name='{$name}[]' value='$code_langue'>" // necessaire ... |
|
| 115 | + . "<input type='checkbox' name='{$name}[]' id='{$name}_$code_langue' value='$code_langue' checked='checked' disabled='disabled' />" |
|
| 116 | + . "<label for='{$name}_$code_langue'>" . $nom_langue . " <span class='code_langue'>[$code_langue]</span></label>" |
|
| 117 | + . '</li>'; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + if ($res) { |
|
| 121 | + $res = "<ul id='langues_bloquees'>" . $res . "</ul><div class='nettoyeur'></div>"; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + $res .= "<ul id='langues_proposees'>"; |
|
| 125 | + |
|
| 126 | + $i = 0; |
|
| 127 | + $langues_bloquees = array_flip($langues_bloquees); |
|
| 128 | + foreach ($langues as $code_langue => $nom_langue) { |
|
| 129 | + if (!isset($langues_bloquees[$code_langue])) { |
|
| 130 | + $checked = (in_array($code_langue, $selection) ? ' checked="checked"' : ''); |
|
| 131 | + $res .= "<li class='choix " |
|
| 132 | + . alterner(++$i, 'odd', 'even') |
|
| 133 | + . (isset($langues_trad[$code_langue]) ? ' traduite' : '') |
|
| 134 | + . "'>" |
|
| 135 | + . "<input type='checkbox' name='{$name}[]' id='{$name}_$code_langue' value='$code_langue'" |
|
| 136 | + . $checked |
|
| 137 | + . '/>' |
|
| 138 | + . "<label for='{$name}_$code_langue'" |
|
| 139 | + . ($checked ? " class='on'" : '') |
|
| 140 | + . '>' |
|
| 141 | + . $nom_langue . " <span class='code_langue'>[$code_langue]</span></label>" |
|
| 142 | + . '</li>'; |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + $res .= "</ul><div class='nettoyeur'></div>"; |
|
| 147 | + |
|
| 148 | + return $res; |
|
| 149 | 149 | } |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/rechercher'); |
| 24 | 24 | if (!defined('_DELAI_CACHE_resultats')) { |
| 25 | - define('_DELAI_CACHE_resultats', 600); |
|
| 25 | + define('_DELAI_CACHE_resultats', 600); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -49,129 +49,129 @@ discard block |
||
| 49 | 49 | * @return array |
| 50 | 50 | */ |
| 51 | 51 | function inc_prepare_recherche_dist( |
| 52 | - $recherche, |
|
| 53 | - $table = 'articles', |
|
| 54 | - $cond = false, |
|
| 55 | - $serveur = '', |
|
| 56 | - $modificateurs = [], |
|
| 57 | - $primary = '' |
|
| 52 | + $recherche, |
|
| 53 | + $table = 'articles', |
|
| 54 | + $cond = false, |
|
| 55 | + $serveur = '', |
|
| 56 | + $modificateurs = [], |
|
| 57 | + $primary = '' |
|
| 58 | 58 | ) { |
| 59 | - $where = null; |
|
| 60 | - $rows = null; |
|
| 61 | - static $cache = []; |
|
| 62 | - $delai_fraicheur = min( |
|
| 63 | - \_DELAI_CACHE_resultats, |
|
| 64 | - time() - ($GLOBALS['meta']['derniere_modif'] ?? 0) |
|
| 65 | - ); |
|
| 66 | - |
|
| 67 | - // si recherche n'est pas dans le contexte, on va prendre en globals |
|
| 68 | - // ca permet de faire des inclure simple. |
|
| 69 | - if (!isset($recherche) and isset($GLOBALS['recherche'])) { |
|
| 70 | - $recherche = $GLOBALS['recherche']; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - // traiter le cas {recherche?} |
|
| 74 | - if ($cond and !strlen($recherche)) { |
|
| 75 | - return [ |
|
| 76 | - '0 as points' /* as points */, /* where */ |
|
| 77 | - '' |
|
| 78 | - ]; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - |
|
| 82 | - $rechercher = false; |
|
| 83 | - |
|
| 84 | - $where_resultat_recent = sql_date_proche('maj', (0 - ($delai_fraicheur + 100)), ' SECOND'); |
|
| 85 | - if (!isset($cache[$serveur][$table][$recherche])) { |
|
| 86 | - $hash_serv = ($serveur ? substr(md5($serveur), 0, 16) : ''); |
|
| 87 | - $hash = substr(md5($recherche . $table), 0, 16); |
|
| 88 | - $where = "(resultats.recherche='$hash' AND resultats.table_objet=" . sql_quote($table) . " AND resultats.serveur='$hash_serv')"; |
|
| 89 | - $row = sql_fetsel( |
|
| 90 | - 'recherche', |
|
| 91 | - 'spip_resultats AS resultats', |
|
| 92 | - $where . " AND $where_resultat_recent", |
|
| 93 | - '', |
|
| 94 | - '', |
|
| 95 | - '0,1' |
|
| 96 | - ); |
|
| 97 | - if ( |
|
| 98 | - !$row |
|
| 99 | - or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') |
|
| 100 | - ) { |
|
| 101 | - $rechercher = true; |
|
| 102 | - } |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - // si on n'a pas encore traite les donnees dans une boucle precedente |
|
| 106 | - if ($rechercher) { |
|
| 107 | - //$tables = liste_des_champs(); |
|
| 108 | - $x = objet_type($table); |
|
| 109 | - $points = recherche_en_base( |
|
| 110 | - $recherche, |
|
| 111 | - $x, |
|
| 112 | - [ |
|
| 113 | - 'score' => true, |
|
| 114 | - 'toutvoir' => true, |
|
| 115 | - 'jointures' => true |
|
| 116 | - ], |
|
| 117 | - $serveur |
|
| 118 | - ); |
|
| 119 | - // pas de résultat, pas de point |
|
| 120 | - $points = $points[$x] ?? []; |
|
| 121 | - |
|
| 122 | - // permettre aux plugins de modifier le resultat |
|
| 123 | - $points = pipeline('prepare_recherche', [ |
|
| 124 | - 'args' => [ |
|
| 125 | - 'type' => $x, |
|
| 126 | - 'recherche' => $recherche, |
|
| 127 | - 'serveur' => $serveur, |
|
| 128 | - 'modificateurs' => $modificateurs |
|
| 129 | - ], |
|
| 130 | - 'data' => $points |
|
| 131 | - ]); |
|
| 132 | - |
|
| 133 | - // supprimer les anciens resultats de cette recherche |
|
| 134 | - // et les resultats trop vieux avec une marge |
|
| 135 | - // pas de AS resultats dans un delete (mysql) |
|
| 136 | - $whered = str_replace( |
|
| 137 | - ['resultats.recherche', 'resultats.table_objet', 'resultats.serveur'], |
|
| 138 | - ['recherche', 'table_objet', 'serveur'], |
|
| 139 | - $where |
|
| 140 | - ); |
|
| 141 | - |
|
| 142 | - sql_delete( |
|
| 143 | - 'spip_resultats', |
|
| 144 | - "NOT($where_resultat_recent) OR ($whered)" |
|
| 145 | - ); |
|
| 146 | - |
|
| 147 | - // inserer les resultats dans la table de cache des resultats |
|
| 148 | - if (is_countable($points) ? count($points) : 0) { |
|
| 149 | - $tab_couples = []; |
|
| 150 | - foreach ($points as $id => $p) { |
|
| 151 | - $tab_couples[] = [ |
|
| 152 | - 'recherche' => $hash, |
|
| 153 | - 'id' => $id, |
|
| 154 | - 'points' => $p['score'], |
|
| 155 | - 'table_objet' => $table, |
|
| 156 | - 'serveur' => $hash_serv, |
|
| 157 | - ]; |
|
| 158 | - } |
|
| 159 | - sql_insertq_multi('spip_resultats', $tab_couples, []); |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - if (!isset($cache[$serveur][$table][$recherche])) { |
|
| 164 | - if (!$serveur) { |
|
| 165 | - $cache[$serveur][$table][$recherche] = ['resultats.points AS points', $where]; |
|
| 166 | - } else { |
|
| 167 | - if (sql_countsel('spip_resultats as resultats', $where)) { |
|
| 168 | - $rows = sql_allfetsel('resultats.id,resultats.points', 'spip_resultats as resultats', $where); |
|
| 169 | - } |
|
| 170 | - $cache[$serveur][$table][$recherche] = generer_select_where_explicites($table, $primary, $rows, $serveur); |
|
| 171 | - } |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - return $cache[$serveur][$table][$recherche]; |
|
| 59 | + $where = null; |
|
| 60 | + $rows = null; |
|
| 61 | + static $cache = []; |
|
| 62 | + $delai_fraicheur = min( |
|
| 63 | + \_DELAI_CACHE_resultats, |
|
| 64 | + time() - ($GLOBALS['meta']['derniere_modif'] ?? 0) |
|
| 65 | + ); |
|
| 66 | + |
|
| 67 | + // si recherche n'est pas dans le contexte, on va prendre en globals |
|
| 68 | + // ca permet de faire des inclure simple. |
|
| 69 | + if (!isset($recherche) and isset($GLOBALS['recherche'])) { |
|
| 70 | + $recherche = $GLOBALS['recherche']; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + // traiter le cas {recherche?} |
|
| 74 | + if ($cond and !strlen($recherche)) { |
|
| 75 | + return [ |
|
| 76 | + '0 as points' /* as points */, /* where */ |
|
| 77 | + '' |
|
| 78 | + ]; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + |
|
| 82 | + $rechercher = false; |
|
| 83 | + |
|
| 84 | + $where_resultat_recent = sql_date_proche('maj', (0 - ($delai_fraicheur + 100)), ' SECOND'); |
|
| 85 | + if (!isset($cache[$serveur][$table][$recherche])) { |
|
| 86 | + $hash_serv = ($serveur ? substr(md5($serveur), 0, 16) : ''); |
|
| 87 | + $hash = substr(md5($recherche . $table), 0, 16); |
|
| 88 | + $where = "(resultats.recherche='$hash' AND resultats.table_objet=" . sql_quote($table) . " AND resultats.serveur='$hash_serv')"; |
|
| 89 | + $row = sql_fetsel( |
|
| 90 | + 'recherche', |
|
| 91 | + 'spip_resultats AS resultats', |
|
| 92 | + $where . " AND $where_resultat_recent", |
|
| 93 | + '', |
|
| 94 | + '', |
|
| 95 | + '0,1' |
|
| 96 | + ); |
|
| 97 | + if ( |
|
| 98 | + !$row |
|
| 99 | + or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') |
|
| 100 | + ) { |
|
| 101 | + $rechercher = true; |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + // si on n'a pas encore traite les donnees dans une boucle precedente |
|
| 106 | + if ($rechercher) { |
|
| 107 | + //$tables = liste_des_champs(); |
|
| 108 | + $x = objet_type($table); |
|
| 109 | + $points = recherche_en_base( |
|
| 110 | + $recherche, |
|
| 111 | + $x, |
|
| 112 | + [ |
|
| 113 | + 'score' => true, |
|
| 114 | + 'toutvoir' => true, |
|
| 115 | + 'jointures' => true |
|
| 116 | + ], |
|
| 117 | + $serveur |
|
| 118 | + ); |
|
| 119 | + // pas de résultat, pas de point |
|
| 120 | + $points = $points[$x] ?? []; |
|
| 121 | + |
|
| 122 | + // permettre aux plugins de modifier le resultat |
|
| 123 | + $points = pipeline('prepare_recherche', [ |
|
| 124 | + 'args' => [ |
|
| 125 | + 'type' => $x, |
|
| 126 | + 'recherche' => $recherche, |
|
| 127 | + 'serveur' => $serveur, |
|
| 128 | + 'modificateurs' => $modificateurs |
|
| 129 | + ], |
|
| 130 | + 'data' => $points |
|
| 131 | + ]); |
|
| 132 | + |
|
| 133 | + // supprimer les anciens resultats de cette recherche |
|
| 134 | + // et les resultats trop vieux avec une marge |
|
| 135 | + // pas de AS resultats dans un delete (mysql) |
|
| 136 | + $whered = str_replace( |
|
| 137 | + ['resultats.recherche', 'resultats.table_objet', 'resultats.serveur'], |
|
| 138 | + ['recherche', 'table_objet', 'serveur'], |
|
| 139 | + $where |
|
| 140 | + ); |
|
| 141 | + |
|
| 142 | + sql_delete( |
|
| 143 | + 'spip_resultats', |
|
| 144 | + "NOT($where_resultat_recent) OR ($whered)" |
|
| 145 | + ); |
|
| 146 | + |
|
| 147 | + // inserer les resultats dans la table de cache des resultats |
|
| 148 | + if (is_countable($points) ? count($points) : 0) { |
|
| 149 | + $tab_couples = []; |
|
| 150 | + foreach ($points as $id => $p) { |
|
| 151 | + $tab_couples[] = [ |
|
| 152 | + 'recherche' => $hash, |
|
| 153 | + 'id' => $id, |
|
| 154 | + 'points' => $p['score'], |
|
| 155 | + 'table_objet' => $table, |
|
| 156 | + 'serveur' => $hash_serv, |
|
| 157 | + ]; |
|
| 158 | + } |
|
| 159 | + sql_insertq_multi('spip_resultats', $tab_couples, []); |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + if (!isset($cache[$serveur][$table][$recherche])) { |
|
| 164 | + if (!$serveur) { |
|
| 165 | + $cache[$serveur][$table][$recherche] = ['resultats.points AS points', $where]; |
|
| 166 | + } else { |
|
| 167 | + if (sql_countsel('spip_resultats as resultats', $where)) { |
|
| 168 | + $rows = sql_allfetsel('resultats.id,resultats.points', 'spip_resultats as resultats', $where); |
|
| 169 | + } |
|
| 170 | + $cache[$serveur][$table][$recherche] = generer_select_where_explicites($table, $primary, $rows, $serveur); |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + return $cache[$serveur][$table][$recherche]; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
@@ -187,22 +187,22 @@ discard block |
||
| 187 | 187 | * @return array |
| 188 | 188 | */ |
| 189 | 189 | function generer_select_where_explicites($table, $primary, $rows, $serveur) { |
| 190 | - # calculer le {id_article IN()} et le {... as points} |
|
| 191 | - if (!count($rows)) { |
|
| 192 | - return ["''", '0=1']; |
|
| 193 | - } else { |
|
| 194 | - $listes_ids = []; |
|
| 195 | - $select = '0'; |
|
| 196 | - foreach ($rows as $r) { |
|
| 197 | - $listes_ids[$r['points']][] = $r['id']; |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - foreach ($listes_ids as $p => $ids) { |
|
| 201 | - $select .= "+$p*(" . |
|
| 202 | - sql_in("$table.$primary", $ids, '', $serveur) |
|
| 203 | - . ') '; |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - return ["$select AS points ", sql_in("$table.$primary", array_map('reset', $rows), '', $serveur)]; |
|
| 207 | - } |
|
| 190 | + # calculer le {id_article IN()} et le {... as points} |
|
| 191 | + if (!count($rows)) { |
|
| 192 | + return ["''", '0=1']; |
|
| 193 | + } else { |
|
| 194 | + $listes_ids = []; |
|
| 195 | + $select = '0'; |
|
| 196 | + foreach ($rows as $r) { |
|
| 197 | + $listes_ids[$r['points']][] = $r['id']; |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + foreach ($listes_ids as $p => $ids) { |
|
| 201 | + $select .= "+$p*(" . |
|
| 202 | + sql_in("$table.$primary", $ids, '', $serveur) |
|
| 203 | + . ') '; |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + return ["$select AS points ", sql_in("$table.$primary", array_map('reset', $rows), '', $serveur)]; |
|
| 207 | + } |
|
| 208 | 208 | } |
@@ -11,53 +11,53 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Fonction appelee par divers pipelines |
| 18 | 18 | function notifications_instituerarticle_dist($quoi, $id_article, $options) { |
| 19 | 19 | |
| 20 | - // ne devrait jamais se produire |
|
| 21 | - if ($options['statut'] == $options['statut_ancien']) { |
|
| 22 | - spip_log('statut inchange', 'notifications'); |
|
| 23 | - |
|
| 24 | - return; |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - include_spip('inc/texte'); |
|
| 28 | - |
|
| 29 | - $modele = ''; |
|
| 30 | - if ($options['statut'] == 'publie') { |
|
| 31 | - if ( |
|
| 32 | - $GLOBALS['meta']['post_dates'] == 'non' |
|
| 33 | - and strtotime($options['date']) > time() |
|
| 34 | - ) { |
|
| 35 | - $modele = 'notifications/article_valide'; |
|
| 36 | - } else { |
|
| 37 | - $modele = 'notifications/article_publie'; |
|
| 38 | - } |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - if ($options['statut'] == 'prop' and $options['statut_ancien'] != 'publie') { |
|
| 42 | - $modele = 'notifications/article_propose'; |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - if ($modele) { |
|
| 46 | - $destinataires = []; |
|
| 47 | - if ($GLOBALS['meta']['suivi_edito'] == 'oui') { |
|
| 48 | - $destinataires = explode(',', $GLOBALS['meta']['adresse_suivi']); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - |
|
| 52 | - $destinataires = pipeline( |
|
| 53 | - 'notifications_destinataires', |
|
| 54 | - [ |
|
| 55 | - 'args' => ['quoi' => $quoi, 'id' => $id_article, 'options' => $options], |
|
| 56 | - 'data' => $destinataires |
|
| 57 | - ] |
|
| 58 | - ); |
|
| 59 | - |
|
| 60 | - $texte = email_notification_article($id_article, $modele); |
|
| 61 | - notifications_envoyer_mails($destinataires, $texte); |
|
| 62 | - } |
|
| 20 | + // ne devrait jamais se produire |
|
| 21 | + if ($options['statut'] == $options['statut_ancien']) { |
|
| 22 | + spip_log('statut inchange', 'notifications'); |
|
| 23 | + |
|
| 24 | + return; |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + include_spip('inc/texte'); |
|
| 28 | + |
|
| 29 | + $modele = ''; |
|
| 30 | + if ($options['statut'] == 'publie') { |
|
| 31 | + if ( |
|
| 32 | + $GLOBALS['meta']['post_dates'] == 'non' |
|
| 33 | + and strtotime($options['date']) > time() |
|
| 34 | + ) { |
|
| 35 | + $modele = 'notifications/article_valide'; |
|
| 36 | + } else { |
|
| 37 | + $modele = 'notifications/article_publie'; |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + if ($options['statut'] == 'prop' and $options['statut_ancien'] != 'publie') { |
|
| 42 | + $modele = 'notifications/article_propose'; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + if ($modele) { |
|
| 46 | + $destinataires = []; |
|
| 47 | + if ($GLOBALS['meta']['suivi_edito'] == 'oui') { |
|
| 48 | + $destinataires = explode(',', $GLOBALS['meta']['adresse_suivi']); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + |
|
| 52 | + $destinataires = pipeline( |
|
| 53 | + 'notifications_destinataires', |
|
| 54 | + [ |
|
| 55 | + 'args' => ['quoi' => $quoi, 'id' => $id_article, 'options' => $options], |
|
| 56 | + 'data' => $destinataires |
|
| 57 | + ] |
|
| 58 | + ); |
|
| 59 | + |
|
| 60 | + $texte = email_notification_article($id_article, $modele); |
|
| 61 | + notifications_envoyer_mails($destinataires, $texte); |
|
| 62 | + } |
|
| 63 | 63 | } |
@@ -11,110 +11,110 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function plugins_afficher_repertoires_dist($url_page, $liste_plugins, $liste_plugins_actifs) { |
| 18 | - $ligne_plug = charger_fonction('afficher_plugin', 'plugins'); |
|
| 19 | - $racine = basename(_DIR_PLUGINS); |
|
| 20 | - $init_dir = $current_dir = ''; |
|
| 21 | - // liste des repertoires deplies : construit en remontant l'arbo de chaque plugin actif |
|
| 22 | - // des qu'un path est deja note deplie on s'arrete |
|
| 23 | - $deplie = [$racine => true]; |
|
| 24 | - $fast_liste_plugins_actifs = []; |
|
| 25 | - foreach ($liste_plugins_actifs as $key => $plug) { |
|
| 26 | - $chemin_plug = chemin_plug($racine, $plug); |
|
| 27 | - $fast_liste_plugins_actifs[$chemin_plug] = true; |
|
| 28 | - $dir = dirname($chemin_plug); |
|
| 29 | - $maxiter = 100; |
|
| 30 | - while (strlen($dir) && !isset($deplie[$dir]) && $dir != $racine && $maxiter-- > 0) { |
|
| 31 | - $deplie[$dir] = true; |
|
| 32 | - $dir = dirname($dir); |
|
| 33 | - } |
|
| 34 | - } |
|
| 18 | + $ligne_plug = charger_fonction('afficher_plugin', 'plugins'); |
|
| 19 | + $racine = basename(_DIR_PLUGINS); |
|
| 20 | + $init_dir = $current_dir = ''; |
|
| 21 | + // liste des repertoires deplies : construit en remontant l'arbo de chaque plugin actif |
|
| 22 | + // des qu'un path est deja note deplie on s'arrete |
|
| 23 | + $deplie = [$racine => true]; |
|
| 24 | + $fast_liste_plugins_actifs = []; |
|
| 25 | + foreach ($liste_plugins_actifs as $key => $plug) { |
|
| 26 | + $chemin_plug = chemin_plug($racine, $plug); |
|
| 27 | + $fast_liste_plugins_actifs[$chemin_plug] = true; |
|
| 28 | + $dir = dirname($chemin_plug); |
|
| 29 | + $maxiter = 100; |
|
| 30 | + while (strlen($dir) && !isset($deplie[$dir]) && $dir != $racine && $maxiter-- > 0) { |
|
| 31 | + $deplie[$dir] = true; |
|
| 32 | + $dir = dirname($dir); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - // index repertoires --> plugin |
|
| 37 | - $dir_index = []; |
|
| 38 | - foreach ($liste_plugins as $key => $plug) { |
|
| 39 | - $liste_plugins[$key] = chemin_plug($racine, $plug); |
|
| 40 | - $dir_index[dirname($liste_plugins[$key])][] = $key; |
|
| 41 | - } |
|
| 36 | + // index repertoires --> plugin |
|
| 37 | + $dir_index = []; |
|
| 38 | + foreach ($liste_plugins as $key => $plug) { |
|
| 39 | + $liste_plugins[$key] = chemin_plug($racine, $plug); |
|
| 40 | + $dir_index[dirname($liste_plugins[$key])][] = $key; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $visible = @isset($deplie[$current_dir]); |
|
| 44 | - $maxiter = 1000; |
|
| 43 | + $visible = @isset($deplie[$current_dir]); |
|
| 44 | + $maxiter = 1000; |
|
| 45 | 45 | |
| 46 | - $res = ''; |
|
| 47 | - while ((is_countable($liste_plugins) ? count($liste_plugins) : 0) && $maxiter--) { |
|
| 48 | - // le rep suivant |
|
| 49 | - $dir = dirname(reset($liste_plugins)); |
|
| 50 | - if ($dir != $current_dir) { |
|
| 51 | - $res .= tree_open_close_dir($current_dir, $dir, $deplie); |
|
| 52 | - } |
|
| 46 | + $res = ''; |
|
| 47 | + while ((is_countable($liste_plugins) ? count($liste_plugins) : 0) && $maxiter--) { |
|
| 48 | + // le rep suivant |
|
| 49 | + $dir = dirname(reset($liste_plugins)); |
|
| 50 | + if ($dir != $current_dir) { |
|
| 51 | + $res .= tree_open_close_dir($current_dir, $dir, $deplie); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - // d'abord tous les plugins du rep courant |
|
| 55 | - if (isset($dir_index[$current_dir])) { |
|
| 56 | - foreach ($dir_index[$current_dir] as $key) { |
|
| 57 | - $plug = $liste_plugins[$key]; |
|
| 58 | - $actif = @isset($fast_liste_plugins_actifs[$plug]); |
|
| 59 | - $id = substr(md5($plug), 0, 16); |
|
| 60 | - $res .= $ligne_plug( |
|
| 61 | - $url_page, |
|
| 62 | - str_replace(_DIR_PLUGINS, '', _DIR_RACINE . $plug), |
|
| 63 | - $actif, |
|
| 64 | - 'menu-entree' |
|
| 65 | - ) . "\n"; |
|
| 66 | - unset($liste_plugins[$key]); |
|
| 67 | - } |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - $res .= tree_open_close_dir($current_dir, $init_dir, true); |
|
| 54 | + // d'abord tous les plugins du rep courant |
|
| 55 | + if (isset($dir_index[$current_dir])) { |
|
| 56 | + foreach ($dir_index[$current_dir] as $key) { |
|
| 57 | + $plug = $liste_plugins[$key]; |
|
| 58 | + $actif = @isset($fast_liste_plugins_actifs[$plug]); |
|
| 59 | + $id = substr(md5($plug), 0, 16); |
|
| 60 | + $res .= $ligne_plug( |
|
| 61 | + $url_page, |
|
| 62 | + str_replace(_DIR_PLUGINS, '', _DIR_RACINE . $plug), |
|
| 63 | + $actif, |
|
| 64 | + 'menu-entree' |
|
| 65 | + ) . "\n"; |
|
| 66 | + unset($liste_plugins[$key]); |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + $res .= tree_open_close_dir($current_dir, $init_dir, true); |
|
| 71 | 71 | |
| 72 | - return "<ul class='menu-liste plugins'>" |
|
| 73 | - . $res |
|
| 74 | - . '</ul>'; |
|
| 72 | + return "<ul class='menu-liste plugins'>" |
|
| 73 | + . $res |
|
| 74 | + . '</ul>'; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | // vraiment n'importe quoi la gestion des chemins des plugins |
| 79 | 79 | // une fonction pour aider... |
| 80 | 80 | function chemin_plug($racine, $plug) { |
| 81 | - return preg_replace(',[^/]+/\.\./,', '', "$racine/$plug"); |
|
| 81 | + return preg_replace(',[^/]+/\.\./,', '', "$racine/$plug"); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | function tree_open_close_dir(&$current, $target, $deplie = []) { |
| 85 | - if ($current == $target) { |
|
| 86 | - return ''; |
|
| 87 | - } |
|
| 88 | - $tcur = explode('/', $current); |
|
| 89 | - $ttarg = explode('/', $target); |
|
| 90 | - $tcom = []; |
|
| 91 | - $output = ''; |
|
| 92 | - // la partie commune |
|
| 93 | - while (reset($tcur) == reset($ttarg)) { |
|
| 94 | - $tcom[] = array_shift($tcur); |
|
| 95 | - array_shift($ttarg); |
|
| 96 | - } |
|
| 97 | - // fermer les repertoires courant jusqu'au point de fork |
|
| 98 | - while ($close = array_pop($tcur)) { |
|
| 99 | - $output .= "</ul>\n"; |
|
| 100 | - $output .= fin_block(); |
|
| 101 | - $output .= "</li>\n"; |
|
| 102 | - } |
|
| 103 | - $chemin = ''; |
|
| 104 | - if (count($tcom)) { |
|
| 105 | - $chemin .= implode('/', $tcom) . '/'; |
|
| 106 | - } |
|
| 107 | - // ouvrir les repertoires jusqu'a la cible |
|
| 108 | - while ($open = array_shift($ttarg)) { |
|
| 109 | - $visible = @isset($deplie[$chemin . $open]); |
|
| 110 | - $chemin .= $open . '/'; |
|
| 111 | - $output .= '<li>'; |
|
| 112 | - $output .= bouton_block_depliable($chemin, $visible); |
|
| 113 | - $output .= debut_block_depliable($visible); |
|
| 85 | + if ($current == $target) { |
|
| 86 | + return ''; |
|
| 87 | + } |
|
| 88 | + $tcur = explode('/', $current); |
|
| 89 | + $ttarg = explode('/', $target); |
|
| 90 | + $tcom = []; |
|
| 91 | + $output = ''; |
|
| 92 | + // la partie commune |
|
| 93 | + while (reset($tcur) == reset($ttarg)) { |
|
| 94 | + $tcom[] = array_shift($tcur); |
|
| 95 | + array_shift($ttarg); |
|
| 96 | + } |
|
| 97 | + // fermer les repertoires courant jusqu'au point de fork |
|
| 98 | + while ($close = array_pop($tcur)) { |
|
| 99 | + $output .= "</ul>\n"; |
|
| 100 | + $output .= fin_block(); |
|
| 101 | + $output .= "</li>\n"; |
|
| 102 | + } |
|
| 103 | + $chemin = ''; |
|
| 104 | + if (count($tcom)) { |
|
| 105 | + $chemin .= implode('/', $tcom) . '/'; |
|
| 106 | + } |
|
| 107 | + // ouvrir les repertoires jusqu'a la cible |
|
| 108 | + while ($open = array_shift($ttarg)) { |
|
| 109 | + $visible = @isset($deplie[$chemin . $open]); |
|
| 110 | + $chemin .= $open . '/'; |
|
| 111 | + $output .= '<li>'; |
|
| 112 | + $output .= bouton_block_depliable($chemin, $visible); |
|
| 113 | + $output .= debut_block_depliable($visible); |
|
| 114 | 114 | |
| 115 | - $output .= "<ul>\n"; |
|
| 116 | - } |
|
| 117 | - $current = $target; |
|
| 115 | + $output .= "<ul>\n"; |
|
| 116 | + } |
|
| 117 | + $current = $target; |
|
| 118 | 118 | |
| 119 | - return $output; |
|
| 119 | + return $output; |
|
| 120 | 120 | } |
@@ -11,225 +11,225 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/xml'); |
| 18 | 18 | include_spip('inc/plugin'); |
| 19 | 19 | |
| 20 | 20 | function plugins_verifie_conformite_dist($plug, &$arbre, $dir_plugins = _DIR_PLUGINS) { |
| 21 | - $needs = null; |
|
| 22 | - $compat_spip = null; |
|
| 23 | - $uses = null; |
|
| 24 | - $paths = null; |
|
| 25 | - $trads = null; |
|
| 26 | - static $etats = ['dev', 'experimental', 'test', 'stable']; |
|
| 21 | + $needs = null; |
|
| 22 | + $compat_spip = null; |
|
| 23 | + $uses = null; |
|
| 24 | + $paths = null; |
|
| 25 | + $trads = null; |
|
| 26 | + static $etats = ['dev', 'experimental', 'test', 'stable']; |
|
| 27 | 27 | |
| 28 | - $matches = []; |
|
| 29 | - $silence = false; |
|
| 30 | - $p = null; |
|
| 31 | - // chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP |
|
| 32 | - if ($n = spip_xml_match_nodes(',^plugin(\s|$),', $arbre, $matches)) { |
|
| 33 | - // version de SPIP |
|
| 34 | - $vspip = $GLOBALS['spip_version_branche']; |
|
| 35 | - foreach ($matches as $tag => $sous) { |
|
| 36 | - [$tagname, $atts] = spip_xml_decompose_tag($tag); |
|
| 37 | - if ($tagname == 'plugin' and is_array($sous)) { |
|
| 38 | - // On rajoute la condition sur $n : |
|
| 39 | - // -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait |
|
| 40 | - // un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise |
|
| 41 | - // de la meme facon. |
|
| 42 | - if ( |
|
| 43 | - !isset($atts['spip']) |
|
| 44 | - or $n == 1 |
|
| 45 | - or plugin_version_compatible($atts['spip'], $vspip, 'spip') |
|
| 46 | - ) { |
|
| 47 | - // on prend la derniere declaration avec ce nom |
|
| 48 | - $p = end($sous); |
|
| 49 | - $compat_spip = $atts['spip'] ?? ''; |
|
| 50 | - } |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - if (is_null($p)) { |
|
| 55 | - $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 56 | - $silence = true; |
|
| 57 | - } else { |
|
| 58 | - $arbre = $p; |
|
| 59 | - } |
|
| 60 | - if (!is_array($arbre)) { |
|
| 61 | - $arbre = []; |
|
| 62 | - } |
|
| 63 | - // verification de la conformite du plugin avec quelques |
|
| 64 | - // precautions elementaires |
|
| 65 | - if (!isset($arbre['nom'])) { |
|
| 66 | - if (!$silence) { |
|
| 67 | - $arbre['erreur'][] = _T('erreur_plugin_nom_manquant'); |
|
| 68 | - } |
|
| 69 | - $arbre['nom'] = ['']; |
|
| 70 | - } |
|
| 71 | - if (!isset($arbre['version'])) { |
|
| 72 | - if (!$silence) { |
|
| 73 | - $arbre['erreur'][] = _T('erreur_plugin_version_manquant'); |
|
| 74 | - } |
|
| 75 | - $arbre['version'] = ['']; |
|
| 76 | - } |
|
| 77 | - if (!isset($arbre['prefix'])) { |
|
| 78 | - if (!$silence) { |
|
| 79 | - $arbre['erreur'][] = _T('erreur_plugin_prefix_manquant'); |
|
| 80 | - } |
|
| 81 | - $arbre['prefix'] = ['']; |
|
| 82 | - } else { |
|
| 83 | - $prefix = trim(end($arbre['prefix'])); |
|
| 84 | - if (strtoupper($prefix) == 'SPIP' and $plug != './') { |
|
| 85 | - $arbre['erreur'][] = _T('erreur_plugin_prefix_interdit'); |
|
| 86 | - } |
|
| 87 | - if (isset($arbre['etat'])) { |
|
| 88 | - $etat = trim(end($arbre['etat'])); |
|
| 89 | - if (!in_array($etat, $etats)) { |
|
| 90 | - $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 91 | - } |
|
| 92 | - } |
|
| 93 | - if (isset($arbre['options'])) { |
|
| 94 | - foreach ($arbre['options'] as $optfile) { |
|
| 95 | - $optfile = trim($optfile); |
|
| 96 | - if (!@is_readable($dir_plugins . "$plug/$optfile")) { |
|
| 97 | - if (!$silence) { |
|
| 98 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - } |
|
| 103 | - if (isset($arbre['fonctions'])) { |
|
| 104 | - foreach ($arbre['fonctions'] as $optfile) { |
|
| 105 | - $optfile = trim($optfile); |
|
| 106 | - if (!@is_readable($dir_plugins . "$plug/$optfile")) { |
|
| 107 | - if (!$silence) { |
|
| 108 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 109 | - } |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - } |
|
| 113 | - $fonctions = []; |
|
| 114 | - if (isset($arbre['fonctions'])) { |
|
| 115 | - $fonctions = $arbre['fonctions']; |
|
| 116 | - } |
|
| 117 | - $liste_methodes_reservees = [ |
|
| 118 | - '__construct', |
|
| 119 | - '__destruct', |
|
| 120 | - 'plugin', |
|
| 121 | - 'install', |
|
| 122 | - 'uninstall', |
|
| 123 | - strtolower($prefix) |
|
| 124 | - ]; |
|
| 28 | + $matches = []; |
|
| 29 | + $silence = false; |
|
| 30 | + $p = null; |
|
| 31 | + // chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP |
|
| 32 | + if ($n = spip_xml_match_nodes(',^plugin(\s|$),', $arbre, $matches)) { |
|
| 33 | + // version de SPIP |
|
| 34 | + $vspip = $GLOBALS['spip_version_branche']; |
|
| 35 | + foreach ($matches as $tag => $sous) { |
|
| 36 | + [$tagname, $atts] = spip_xml_decompose_tag($tag); |
|
| 37 | + if ($tagname == 'plugin' and is_array($sous)) { |
|
| 38 | + // On rajoute la condition sur $n : |
|
| 39 | + // -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait |
|
| 40 | + // un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise |
|
| 41 | + // de la meme facon. |
|
| 42 | + if ( |
|
| 43 | + !isset($atts['spip']) |
|
| 44 | + or $n == 1 |
|
| 45 | + or plugin_version_compatible($atts['spip'], $vspip, 'spip') |
|
| 46 | + ) { |
|
| 47 | + // on prend la derniere declaration avec ce nom |
|
| 48 | + $p = end($sous); |
|
| 49 | + $compat_spip = $atts['spip'] ?? ''; |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + if (is_null($p)) { |
|
| 55 | + $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 56 | + $silence = true; |
|
| 57 | + } else { |
|
| 58 | + $arbre = $p; |
|
| 59 | + } |
|
| 60 | + if (!is_array($arbre)) { |
|
| 61 | + $arbre = []; |
|
| 62 | + } |
|
| 63 | + // verification de la conformite du plugin avec quelques |
|
| 64 | + // precautions elementaires |
|
| 65 | + if (!isset($arbre['nom'])) { |
|
| 66 | + if (!$silence) { |
|
| 67 | + $arbre['erreur'][] = _T('erreur_plugin_nom_manquant'); |
|
| 68 | + } |
|
| 69 | + $arbre['nom'] = ['']; |
|
| 70 | + } |
|
| 71 | + if (!isset($arbre['version'])) { |
|
| 72 | + if (!$silence) { |
|
| 73 | + $arbre['erreur'][] = _T('erreur_plugin_version_manquant'); |
|
| 74 | + } |
|
| 75 | + $arbre['version'] = ['']; |
|
| 76 | + } |
|
| 77 | + if (!isset($arbre['prefix'])) { |
|
| 78 | + if (!$silence) { |
|
| 79 | + $arbre['erreur'][] = _T('erreur_plugin_prefix_manquant'); |
|
| 80 | + } |
|
| 81 | + $arbre['prefix'] = ['']; |
|
| 82 | + } else { |
|
| 83 | + $prefix = trim(end($arbre['prefix'])); |
|
| 84 | + if (strtoupper($prefix) == 'SPIP' and $plug != './') { |
|
| 85 | + $arbre['erreur'][] = _T('erreur_plugin_prefix_interdit'); |
|
| 86 | + } |
|
| 87 | + if (isset($arbre['etat'])) { |
|
| 88 | + $etat = trim(end($arbre['etat'])); |
|
| 89 | + if (!in_array($etat, $etats)) { |
|
| 90 | + $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | + if (isset($arbre['options'])) { |
|
| 94 | + foreach ($arbre['options'] as $optfile) { |
|
| 95 | + $optfile = trim($optfile); |
|
| 96 | + if (!@is_readable($dir_plugins . "$plug/$optfile")) { |
|
| 97 | + if (!$silence) { |
|
| 98 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | + if (isset($arbre['fonctions'])) { |
|
| 104 | + foreach ($arbre['fonctions'] as $optfile) { |
|
| 105 | + $optfile = trim($optfile); |
|
| 106 | + if (!@is_readable($dir_plugins . "$plug/$optfile")) { |
|
| 107 | + if (!$silence) { |
|
| 108 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | + $fonctions = []; |
|
| 114 | + if (isset($arbre['fonctions'])) { |
|
| 115 | + $fonctions = $arbre['fonctions']; |
|
| 116 | + } |
|
| 117 | + $liste_methodes_reservees = [ |
|
| 118 | + '__construct', |
|
| 119 | + '__destruct', |
|
| 120 | + 'plugin', |
|
| 121 | + 'install', |
|
| 122 | + 'uninstall', |
|
| 123 | + strtolower($prefix) |
|
| 124 | + ]; |
|
| 125 | 125 | |
| 126 | - $extraire_pipelines = charger_fonction('extraire_pipelines', 'plugins'); |
|
| 127 | - $arbre['pipeline'] = $extraire_pipelines($arbre); |
|
| 128 | - foreach ($arbre['pipeline'] as $pipe) { |
|
| 129 | - if (!isset($pipe['nom'])) { |
|
| 130 | - if (!$silence) { |
|
| 131 | - $arbre['erreur'][] = _T('erreur_plugin_nom_pipeline_non_defini'); |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - if (isset($pipe['action'])) { |
|
| 135 | - $action = $pipe['action']; |
|
| 136 | - } else { |
|
| 137 | - $action = $pipe['nom']; |
|
| 138 | - } |
|
| 139 | - // verif que la methode a un nom autorise |
|
| 140 | - if (in_array(strtolower($action), $liste_methodes_reservees)) { |
|
| 141 | - if (!$silence) { |
|
| 142 | - $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 143 | - } |
|
| 144 | - } |
|
| 145 | - if (isset($pipe['inclure'])) { |
|
| 146 | - $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 147 | - if (!@is_readable($inclure)) { |
|
| 148 | - if (!$silence) { |
|
| 149 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - } |
|
| 154 | - $necessite = []; |
|
| 155 | - $spip_trouve = false; |
|
| 156 | - if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) { |
|
| 157 | - foreach (array_keys($needs) as $tag) { |
|
| 158 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 159 | - if (!isset($att['id'])) { |
|
| 160 | - if (!$silence) { |
|
| 161 | - $arbre['erreur'][] = _T( |
|
| 162 | - 'erreur_plugin_attribut_balise_manquant', |
|
| 163 | - ['attribut' => 'id', 'balise' => $att] |
|
| 164 | - ); |
|
| 165 | - } |
|
| 166 | - } else { |
|
| 167 | - $necessite[] = $att; |
|
| 168 | - } |
|
| 169 | - if (strtolower($att['id']) == 'spip') { |
|
| 170 | - $spip_trouve = true; |
|
| 171 | - } |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - if ($compat_spip and !$spip_trouve) { |
|
| 175 | - $necessite[] = ['id' => 'spip', 'version' => $compat_spip]; |
|
| 176 | - } |
|
| 177 | - $arbre['necessite'] = $necessite; |
|
| 178 | - $utilise = []; |
|
| 179 | - if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) { |
|
| 180 | - foreach (array_keys($uses) as $tag) { |
|
| 181 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 182 | - if (!isset($att['id'])) { |
|
| 183 | - if (!$silence) { |
|
| 184 | - $arbre['erreur'][] = _T( |
|
| 185 | - 'erreur_plugin_attribut_balise_manquant', |
|
| 186 | - ['attribut' => 'id', 'balise' => $att] |
|
| 187 | - ); |
|
| 188 | - } |
|
| 189 | - } else { |
|
| 190 | - $utilise[] = $att; |
|
| 191 | - } |
|
| 192 | - } |
|
| 193 | - } |
|
| 194 | - $arbre['utilise'] = $utilise; |
|
| 195 | - $procure = []; |
|
| 196 | - if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) { |
|
| 197 | - foreach (array_keys($uses) as $tag) { |
|
| 198 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 199 | - $procure[] = $att; |
|
| 200 | - } |
|
| 201 | - } |
|
| 202 | - $arbre['procure'] = $procure; |
|
| 203 | - $path = []; |
|
| 204 | - if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) { |
|
| 205 | - foreach (array_keys($paths) as $tag) { |
|
| 206 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 207 | - $att['path'] = $att['dir']; // ancienne syntaxe |
|
| 208 | - $path[] = $att; |
|
| 209 | - } |
|
| 210 | - } else { |
|
| 211 | - $path = [['dir' => '']]; |
|
| 212 | - } // initialiser par defaut |
|
| 213 | - $arbre['path'] = $path; |
|
| 214 | - // exposer les noisettes |
|
| 215 | - if (isset($arbre['noisette'])) { |
|
| 216 | - foreach ($arbre['noisette'] as $k => $nut) { |
|
| 217 | - $nut = preg_replace(',[.]html$,uims', '', trim($nut)); |
|
| 218 | - $arbre['noisette'][$k] = $nut; |
|
| 219 | - if (!@is_readable($dir_plugins . "$plug/$nut.html")) { |
|
| 220 | - if (!$silence) { |
|
| 221 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 222 | - } |
|
| 223 | - } |
|
| 224 | - } |
|
| 225 | - } |
|
| 226 | - $traduire = []; |
|
| 227 | - if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) { |
|
| 228 | - foreach (array_keys($trads) as $tag) { |
|
| 229 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 230 | - $traduire[] = $att; |
|
| 231 | - } |
|
| 232 | - } |
|
| 233 | - $arbre['traduire'] = $traduire; |
|
| 234 | - } |
|
| 126 | + $extraire_pipelines = charger_fonction('extraire_pipelines', 'plugins'); |
|
| 127 | + $arbre['pipeline'] = $extraire_pipelines($arbre); |
|
| 128 | + foreach ($arbre['pipeline'] as $pipe) { |
|
| 129 | + if (!isset($pipe['nom'])) { |
|
| 130 | + if (!$silence) { |
|
| 131 | + $arbre['erreur'][] = _T('erreur_plugin_nom_pipeline_non_defini'); |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + if (isset($pipe['action'])) { |
|
| 135 | + $action = $pipe['action']; |
|
| 136 | + } else { |
|
| 137 | + $action = $pipe['nom']; |
|
| 138 | + } |
|
| 139 | + // verif que la methode a un nom autorise |
|
| 140 | + if (in_array(strtolower($action), $liste_methodes_reservees)) { |
|
| 141 | + if (!$silence) { |
|
| 142 | + $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | + if (isset($pipe['inclure'])) { |
|
| 146 | + $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 147 | + if (!@is_readable($inclure)) { |
|
| 148 | + if (!$silence) { |
|
| 149 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | + $necessite = []; |
|
| 155 | + $spip_trouve = false; |
|
| 156 | + if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) { |
|
| 157 | + foreach (array_keys($needs) as $tag) { |
|
| 158 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 159 | + if (!isset($att['id'])) { |
|
| 160 | + if (!$silence) { |
|
| 161 | + $arbre['erreur'][] = _T( |
|
| 162 | + 'erreur_plugin_attribut_balise_manquant', |
|
| 163 | + ['attribut' => 'id', 'balise' => $att] |
|
| 164 | + ); |
|
| 165 | + } |
|
| 166 | + } else { |
|
| 167 | + $necessite[] = $att; |
|
| 168 | + } |
|
| 169 | + if (strtolower($att['id']) == 'spip') { |
|
| 170 | + $spip_trouve = true; |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + if ($compat_spip and !$spip_trouve) { |
|
| 175 | + $necessite[] = ['id' => 'spip', 'version' => $compat_spip]; |
|
| 176 | + } |
|
| 177 | + $arbre['necessite'] = $necessite; |
|
| 178 | + $utilise = []; |
|
| 179 | + if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) { |
|
| 180 | + foreach (array_keys($uses) as $tag) { |
|
| 181 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 182 | + if (!isset($att['id'])) { |
|
| 183 | + if (!$silence) { |
|
| 184 | + $arbre['erreur'][] = _T( |
|
| 185 | + 'erreur_plugin_attribut_balise_manquant', |
|
| 186 | + ['attribut' => 'id', 'balise' => $att] |
|
| 187 | + ); |
|
| 188 | + } |
|
| 189 | + } else { |
|
| 190 | + $utilise[] = $att; |
|
| 191 | + } |
|
| 192 | + } |
|
| 193 | + } |
|
| 194 | + $arbre['utilise'] = $utilise; |
|
| 195 | + $procure = []; |
|
| 196 | + if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) { |
|
| 197 | + foreach (array_keys($uses) as $tag) { |
|
| 198 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 199 | + $procure[] = $att; |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | + $arbre['procure'] = $procure; |
|
| 203 | + $path = []; |
|
| 204 | + if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) { |
|
| 205 | + foreach (array_keys($paths) as $tag) { |
|
| 206 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 207 | + $att['path'] = $att['dir']; // ancienne syntaxe |
|
| 208 | + $path[] = $att; |
|
| 209 | + } |
|
| 210 | + } else { |
|
| 211 | + $path = [['dir' => '']]; |
|
| 212 | + } // initialiser par defaut |
|
| 213 | + $arbre['path'] = $path; |
|
| 214 | + // exposer les noisettes |
|
| 215 | + if (isset($arbre['noisette'])) { |
|
| 216 | + foreach ($arbre['noisette'] as $k => $nut) { |
|
| 217 | + $nut = preg_replace(',[.]html$,uims', '', trim($nut)); |
|
| 218 | + $arbre['noisette'][$k] = $nut; |
|
| 219 | + if (!@is_readable($dir_plugins . "$plug/$nut.html")) { |
|
| 220 | + if (!$silence) { |
|
| 221 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 222 | + } |
|
| 223 | + } |
|
| 224 | + } |
|
| 225 | + } |
|
| 226 | + $traduire = []; |
|
| 227 | + if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) { |
|
| 228 | + foreach (array_keys($trads) as $tag) { |
|
| 229 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 230 | + $traduire[] = $att; |
|
| 231 | + } |
|
| 232 | + } |
|
| 233 | + $arbre['traduire'] = $traduire; |
|
| 234 | + } |
|
| 235 | 235 | } |
@@ -11,61 +11,61 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | include_spip('inc/charsets'); |
| 17 | 17 | include_spip('inc/texte'); |
| 18 | 18 | include_spip('plugins/afficher_plugin'); |
| 19 | 19 | |
| 20 | 20 | function plugins_afficher_nom_plugin_dist( |
| 21 | - $url_page, |
|
| 22 | - $plug_file, |
|
| 23 | - $checked, |
|
| 24 | - $actif, |
|
| 25 | - $expose = false, |
|
| 26 | - $class_li = 'item', |
|
| 27 | - $dir_plugins = _DIR_PLUGINS |
|
| 21 | + $url_page, |
|
| 22 | + $plug_file, |
|
| 23 | + $checked, |
|
| 24 | + $actif, |
|
| 25 | + $expose = false, |
|
| 26 | + $class_li = 'item', |
|
| 27 | + $dir_plugins = _DIR_PLUGINS |
|
| 28 | 28 | ) { |
| 29 | - static $id_input = 0; |
|
| 30 | - static $versions = []; |
|
| 29 | + static $id_input = 0; |
|
| 30 | + static $versions = []; |
|
| 31 | 31 | |
| 32 | - $erreur = false; |
|
| 33 | - $s = ''; |
|
| 32 | + $erreur = false; |
|
| 33 | + $s = ''; |
|
| 34 | 34 | |
| 35 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 36 | - $info = $get_infos($plug_file, false, $dir_plugins); |
|
| 35 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 36 | + $info = $get_infos($plug_file, false, $dir_plugins); |
|
| 37 | 37 | |
| 38 | - // numerotons les occurences d'un meme prefix |
|
| 39 | - $versions[$info['prefix']] = isset($versions[$info['prefix']]) ? $versions[$info['prefix']] + 1 : ''; |
|
| 40 | - $id = $info['prefix'] . $versions[$info['prefix']]; |
|
| 38 | + // numerotons les occurences d'un meme prefix |
|
| 39 | + $versions[$info['prefix']] = isset($versions[$info['prefix']]) ? $versions[$info['prefix']] + 1 : ''; |
|
| 40 | + $id = $info['prefix'] . $versions[$info['prefix']]; |
|
| 41 | 41 | |
| 42 | - $class = $class_li; |
|
| 43 | - $class .= $actif ? ' actif' : ''; |
|
| 44 | - $class .= $expose ? ' on' : ''; |
|
| 45 | - $erreur = isset($info['erreur']); |
|
| 46 | - if ($erreur) { |
|
| 47 | - $class .= ' error'; |
|
| 48 | - } |
|
| 49 | - $s .= "<li id='$id' class='$class'>"; |
|
| 42 | + $class = $class_li; |
|
| 43 | + $class .= $actif ? ' actif' : ''; |
|
| 44 | + $class .= $expose ? ' on' : ''; |
|
| 45 | + $erreur = isset($info['erreur']); |
|
| 46 | + if ($erreur) { |
|
| 47 | + $class .= ' error'; |
|
| 48 | + } |
|
| 49 | + $s .= "<li id='$id' class='$class'>"; |
|
| 50 | 50 | |
| 51 | - // Cartouche Resume |
|
| 52 | - $s .= "<div class='resume'>"; |
|
| 51 | + // Cartouche Resume |
|
| 52 | + $s .= "<div class='resume'>"; |
|
| 53 | 53 | |
| 54 | - $prefix = $info['prefix']; |
|
| 55 | - $dir = "$dir_plugins$plug_file/lang/$prefix"; |
|
| 56 | - $desc = plugin_propre($info['description'], $dir); |
|
| 57 | - $url_stat = parametre_url($url_page, 'plugin', $dir_plugins . $plug_file); |
|
| 54 | + $prefix = $info['prefix']; |
|
| 55 | + $dir = "$dir_plugins$plug_file/lang/$prefix"; |
|
| 56 | + $desc = plugin_propre($info['description'], $dir); |
|
| 57 | + $url_stat = parametre_url($url_page, 'plugin', $dir_plugins . $plug_file); |
|
| 58 | 58 | |
| 59 | - $s .= "<strong class='nom'>" . typo($info['nom']) . '</strong>'; |
|
| 60 | - $s .= " <span class='version'>" . $info['version'] . '</span>'; |
|
| 61 | - $s .= " <span class='etat'> - " . plugin_etat_en_clair($info['etat']) . '</span>'; |
|
| 62 | - $s .= '</div>'; |
|
| 59 | + $s .= "<strong class='nom'>" . typo($info['nom']) . '</strong>'; |
|
| 60 | + $s .= " <span class='version'>" . $info['version'] . '</span>'; |
|
| 61 | + $s .= " <span class='etat'> - " . plugin_etat_en_clair($info['etat']) . '</span>'; |
|
| 62 | + $s .= '</div>'; |
|
| 63 | 63 | |
| 64 | - if ($erreur) { |
|
| 65 | - $s .= "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>'; |
|
| 66 | - } |
|
| 64 | + if ($erreur) { |
|
| 65 | + $s .= "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>'; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - $s .= '</li>'; |
|
| 68 | + $s .= '</li>'; |
|
| 69 | 69 | |
| 70 | - return $s; |
|
| 70 | + return $s; |
|
| 71 | 71 | } |
@@ -11,112 +11,112 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/texte'); |
| 18 | 18 | |
| 19 | 19 | function inc_plonger_dist($id_rubrique, $idom = '', $list = [], $col = 1, $exclu = 0, $do = 'aff') { |
| 20 | 20 | |
| 21 | - if ($list) { |
|
| 22 | - $id_rubrique = $list[$col - 1]; |
|
| 23 | - } |
|
| 21 | + if ($list) { |
|
| 22 | + $id_rubrique = $list[$col - 1]; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - $ret = ''; |
|
| 25 | + $ret = ''; |
|
| 26 | 26 | |
| 27 | - # recherche les filles et petites-filles de la rubrique donnee |
|
| 28 | - # en excluant une eventuelle rubrique interdite (par exemple, lorsqu'on |
|
| 29 | - # deplace une rubrique, on peut la deplacer partout a partir de la |
|
| 30 | - # racine... sauf vers elle-meme ou sa propre branche) |
|
| 31 | - $ordre = []; |
|
| 32 | - $rub = []; |
|
| 27 | + # recherche les filles et petites-filles de la rubrique donnee |
|
| 28 | + # en excluant une eventuelle rubrique interdite (par exemple, lorsqu'on |
|
| 29 | + # deplace une rubrique, on peut la deplacer partout a partir de la |
|
| 30 | + # racine... sauf vers elle-meme ou sa propre branche) |
|
| 31 | + $ordre = []; |
|
| 32 | + $rub = []; |
|
| 33 | 33 | |
| 34 | - $res = sql_select( |
|
| 35 | - 'rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie, rub2.id_rubrique AS id_enfant', |
|
| 36 | - 'spip_rubriques AS rub1 LEFT JOIN spip_rubriques AS rub2 ON (rub1.id_rubrique = rub2.id_parent)', |
|
| 37 | - 'rub1.id_parent = ' . sql_quote($id_rubrique) . ' |
|
| 34 | + $res = sql_select( |
|
| 35 | + 'rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie, rub2.id_rubrique AS id_enfant', |
|
| 36 | + 'spip_rubriques AS rub1 LEFT JOIN spip_rubriques AS rub2 ON (rub1.id_rubrique = rub2.id_parent)', |
|
| 37 | + 'rub1.id_parent = ' . sql_quote($id_rubrique) . ' |
|
| 38 | 38 | AND rub1.id_rubrique!=' . sql_quote($exclu) . ' |
| 39 | 39 | AND (rub2.id_rubrique IS NULL OR rub2.id_rubrique!=' . sql_quote($exclu) . ')', |
| 40 | - '', |
|
| 41 | - '0+rub1.titre,rub1.titre' |
|
| 42 | - ); |
|
| 40 | + '', |
|
| 41 | + '0+rub1.titre,rub1.titre' |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | - while ($row = sql_fetch($res)) { |
|
| 45 | - if (autoriser('voir', 'rubrique', $row['id_rubrique'])) { |
|
| 46 | - $rub[$row['id_rubrique']]['enfants'] = $row['id_enfant']; |
|
| 47 | - if ($row['id_parent'] == $id_rubrique) { |
|
| 48 | - $t = trim(typo(supprimer_numero($row['titre']))); |
|
| 49 | - if ($row['langue_choisie'] != 'oui') { |
|
| 50 | - $t .= ' <small title="' |
|
| 51 | - . traduire_nom_langue($row['lang']) |
|
| 52 | - . '">[' . $row['lang'] . ']</small>'; |
|
| 53 | - } |
|
| 54 | - $ordre[$row['id_rubrique']] = $t; |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - } |
|
| 58 | - $next = $list[$col] ?? 0; |
|
| 59 | - if ($ordre) { |
|
| 60 | - $rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=" . ($col + 1)); |
|
| 61 | - $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id="); |
|
| 62 | - $args = "'$idom',this,$col,'" . $GLOBALS['spip_lang_left'] . "','$info',event"; |
|
| 44 | + while ($row = sql_fetch($res)) { |
|
| 45 | + if (autoriser('voir', 'rubrique', $row['id_rubrique'])) { |
|
| 46 | + $rub[$row['id_rubrique']]['enfants'] = $row['id_enfant']; |
|
| 47 | + if ($row['id_parent'] == $id_rubrique) { |
|
| 48 | + $t = trim(typo(supprimer_numero($row['titre']))); |
|
| 49 | + if ($row['langue_choisie'] != 'oui') { |
|
| 50 | + $t .= ' <small title="' |
|
| 51 | + . traduire_nom_langue($row['lang']) |
|
| 52 | + . '">[' . $row['lang'] . ']</small>'; |
|
| 53 | + } |
|
| 54 | + $ordre[$row['id_rubrique']] = $t; |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | + $next = $list[$col] ?? 0; |
|
| 59 | + if ($ordre) { |
|
| 60 | + $rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=" . ($col + 1)); |
|
| 61 | + $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id="); |
|
| 62 | + $args = "'$idom',this,$col,'" . $GLOBALS['spip_lang_left'] . "','$info',event"; |
|
| 63 | 63 | |
| 64 | - foreach ($ordre as $id => $titrebrut) { |
|
| 65 | - $titre = supprimer_numero($titrebrut); |
|
| 64 | + foreach ($ordre as $id => $titrebrut) { |
|
| 65 | + $titre = supprimer_numero($titrebrut); |
|
| 66 | 66 | |
| 67 | - $classe1 = 'petit-item ' . ($id_rubrique ? 'petite-rubrique' : 'petit-secteur'); |
|
| 68 | - if (isset($rub[$id]['enfants'])) { |
|
| 69 | - $classe2 = " class='rub-ouverte'"; |
|
| 70 | - $url = "\nhref='$rec&id=$id'"; |
|
| 71 | - } else { |
|
| 72 | - $classe2 = $url = ''; |
|
| 73 | - $url = "\nhref='javascript:void(0)'"; |
|
| 74 | - } |
|
| 67 | + $classe1 = 'petit-item ' . ($id_rubrique ? 'petite-rubrique' : 'petit-secteur'); |
|
| 68 | + if (isset($rub[$id]['enfants'])) { |
|
| 69 | + $classe2 = " class='rub-ouverte'"; |
|
| 70 | + $url = "\nhref='$rec&id=$id'"; |
|
| 71 | + } else { |
|
| 72 | + $classe2 = $url = ''; |
|
| 73 | + $url = "\nhref='javascript:void(0)'"; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - $js_func = $do . '_selection_titre'; |
|
| 77 | - $click = "\nonclick=\"changerhighlight(this.parentNode.parentNode.parentNode);\nreturn " |
|
| 78 | - . (!is_array($list) ? ' false' |
|
| 79 | - : "aff_selection_provisoire($id,$args)") |
|
| 76 | + $js_func = $do . '_selection_titre'; |
|
| 77 | + $click = "\nonclick=\"changerhighlight(this.parentNode.parentNode.parentNode);\nreturn " |
|
| 78 | + . (!is_array($list) ? ' false' |
|
| 79 | + : "aff_selection_provisoire($id,$args)") |
|
| 80 | 80 | # ce lien provoque la selection (directe) de la rubrique cliquee |
| 81 | 81 | # et l'affichage de son titre dans le bandeau |
| 82 | - . "\"\nondblclick=\"" |
|
| 83 | - . "$js_func(this." |
|
| 84 | - . 'firstChild.nodeValue,' |
|
| 85 | - . $id |
|
| 86 | - . ",'selection_rubrique','id_parent');" |
|
| 87 | - . "\nreturn aff_selection_provisoire($id,$args);" |
|
| 88 | - . '"'; |
|
| 82 | + . "\"\nondblclick=\"" |
|
| 83 | + . "$js_func(this." |
|
| 84 | + . 'firstChild.nodeValue,' |
|
| 85 | + . $id |
|
| 86 | + . ",'selection_rubrique','id_parent');" |
|
| 87 | + . "\nreturn aff_selection_provisoire($id,$args);" |
|
| 88 | + . '"'; |
|
| 89 | 89 | |
| 90 | - $ret .= "<div class='" |
|
| 91 | - . (($id == $next) ? 'item on' : 'item') |
|
| 92 | - . "'><div class='" |
|
| 93 | - . $classe1 |
|
| 94 | - . "'><div$classe2><a" |
|
| 95 | - . $url |
|
| 96 | - . $click |
|
| 97 | - . '>' |
|
| 98 | - . $titre |
|
| 99 | - . '</a></div></div></div>'; |
|
| 100 | - } |
|
| 101 | - } |
|
| 90 | + $ret .= "<div class='" |
|
| 91 | + . (($id == $next) ? 'item on' : 'item') |
|
| 92 | + . "'><div class='" |
|
| 93 | + . $classe1 |
|
| 94 | + . "'><div$classe2><a" |
|
| 95 | + . $url |
|
| 96 | + . $click |
|
| 97 | + . '>' |
|
| 98 | + . $titre |
|
| 99 | + . '</a></div></div></div>'; |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - $idom2 = $idom . '_col_' . ($col + 1); |
|
| 104 | - $left = ($col * 250); |
|
| 103 | + $idom2 = $idom . '_col_' . ($col + 1); |
|
| 104 | + $left = ($col * 250); |
|
| 105 | 105 | |
| 106 | - return http_img_pack( |
|
| 107 | - 'loader.svg', |
|
| 108 | - '', |
|
| 109 | - "class='loader' style='visibility: hidden; position: absolute; " . $GLOBALS['spip_lang_left'] . ': ' |
|
| 110 | - . ($left - 30) |
|
| 111 | - . "px; top: 2px; z-index: 2;' id='img_$idom2'" |
|
| 112 | - ) |
|
| 113 | - . "<div style='width: 250px; height: 100%; overflow: auto; position: absolute; top: 0px; " . $GLOBALS['spip_lang_left'] . ': ' |
|
| 114 | - . ($left - 250) |
|
| 115 | - . "px;'>" |
|
| 116 | - . $ret |
|
| 117 | - . "\n</div>\n<div id='$idom2'>" |
|
| 118 | - . ($next |
|
| 119 | - ? inc_plonger_dist($id_rubrique, $idom, $list, $col + 1, $exclu) |
|
| 120 | - : '') |
|
| 121 | - . "\n</div>"; |
|
| 106 | + return http_img_pack( |
|
| 107 | + 'loader.svg', |
|
| 108 | + '', |
|
| 109 | + "class='loader' style='visibility: hidden; position: absolute; " . $GLOBALS['spip_lang_left'] . ': ' |
|
| 110 | + . ($left - 30) |
|
| 111 | + . "px; top: 2px; z-index: 2;' id='img_$idom2'" |
|
| 112 | + ) |
|
| 113 | + . "<div style='width: 250px; height: 100%; overflow: auto; position: absolute; top: 0px; " . $GLOBALS['spip_lang_left'] . ': ' |
|
| 114 | + . ($left - 250) |
|
| 115 | + . "px;'>" |
|
| 116 | + . $ret |
|
| 117 | + . "\n</div>\n<div id='$idom2'>" |
|
| 118 | + . ($next |
|
| 119 | + ? inc_plonger_dist($id_rubrique, $idom, $list, $col + 1, $exclu) |
|
| 120 | + : '') |
|
| 121 | + . "\n</div>"; |
|
| 122 | 122 | } |