@@ -4,579 +4,579 @@ discard block |
||
| 4 | 4 | // ** ne pas modifier le fichier ** |
| 5 | 5 | |
| 6 | 6 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 7 | - return; |
|
| 7 | + return; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $GLOBALS[$GLOBALS['idx_lang']] = array( |
| 11 | 11 | |
| 12 | - // A |
|
| 13 | - 'access_interface_graphique' => 'Distreiñ d’an etrefas grafek klok', # Gwelloc'h e vije ober gant etrefas evit treiñ interface; heñveldra, grafek zo kalz komprenusoc'h eget kevregañ. Dreist-holl e vez komprenet gant an holl hag en implij emañ gant kalz a dud |
|
| 14 | - 'access_mode_texte' => 'diskouez an etrefas testenn eeun', |
|
| 15 | - 'admin_debug' => 'dizreinañ', |
|
| 16 | - 'admin_modifier_article' => 'Kemmañ ar pennad-mañ', |
|
| 17 | - 'admin_modifier_auteur' => 'Kemmañ ar skridaozer-mañ', |
|
| 18 | - 'admin_modifier_breve' => 'Kemmañ ar berrskrid-mañ', |
|
| 19 | - 'admin_modifier_mot' => 'Kemmañ ar ger-stur-mañ', |
|
| 20 | - 'admin_modifier_rubrique' => 'Kemmañ ar rubrikenn-mañ', |
|
| 21 | - 'admin_recalculer' => 'Hizivaat ar bajenn', |
|
| 22 | - 'afficher_calendrier' => 'Diskouez an deiziater', |
|
| 23 | - 'afficher_trad' => 'diskouez an troidigezhioù', |
|
| 24 | - 'alerte_maj_impossible' => '<b>Diwallit !</b> N’eus ket tu da hizivaat an diaz SQL etrezek ar stumm @version@, marteze abalamour d’ur gudenn aotre evit kemmañ an diaz titouroù. Mar plij kit e darempred gant ho herberc’hier.', |
|
| 25 | - 'alerte_modif_info_concourante' => 'DIWALLIT : Kemmet eo bet an titour-mañ en ul lec’h all. Setu an talvoud nevez :', |
|
| 26 | - 'analyse_xml' => 'Dielfennañ XML', |
|
| 27 | - 'annuler' => 'Nullañ', |
|
| 28 | - 'antispam_champ_vide' => 'Na lakait netra amañ :', |
|
| 29 | - 'articles_recents' => 'Pennadoù nevesañ', |
|
| 30 | - 'avis_1_erreur_saisie' => 'Ur fazi ho peus graet en ur skrivañ. Gwiriit ho testenn mar plij.', |
|
| 31 | - 'avis_archive_incorrect' => 'N’eo ket ar restr diell ur restr SPIP', |
|
| 32 | - 'avis_archive_invalide' => 'N’eo ket reizh ar restr diell', |
|
| 33 | - 'avis_attention' => 'DIWALLIT !', |
|
| 34 | - 'avis_champ_incorrect_type_objet' => 'Anv maezienn direizh @name@ evit un draezenn a seurt @type@', |
|
| 35 | - 'avis_colonne_inexistante' => 'N’eus ket eus ar bann @col@', |
|
| 36 | - 'avis_erreur' => 'Fazi: gwelet amañ a-is', |
|
| 37 | - 'avis_erreur_connexion' => 'Fazi kevreañ', |
|
| 38 | - 'avis_erreur_cookie' => 'kudenn toupin', |
|
| 39 | - 'avis_erreur_fonction_contexte' => 'Fazi programmiñ. Arabat d’an arc’hwel-mañ bezañ galvet er gendestenn-mañ.', |
|
| 40 | - 'avis_erreur_mysql' => 'Fazi SQL', |
|
| 41 | - 'avis_erreur_sauvegarde' => 'Fazi er savete (@type@ @id_objet@) !', |
|
| 42 | - 'avis_erreur_visiteur' => 'N’eus ket tu da dizhout al lodenn brevez', |
|
| 43 | - 'avis_nb_erreurs_saisie' => 'Bez ez eus @nb@ fazi en ho skrid. Gwiriit ho testenn mar plij.', |
|
| 12 | + // A |
|
| 13 | + 'access_interface_graphique' => 'Distreiñ d’an etrefas grafek klok', # Gwelloc'h e vije ober gant etrefas evit treiñ interface; heñveldra, grafek zo kalz komprenusoc'h eget kevregañ. Dreist-holl e vez komprenet gant an holl hag en implij emañ gant kalz a dud |
|
| 14 | + 'access_mode_texte' => 'diskouez an etrefas testenn eeun', |
|
| 15 | + 'admin_debug' => 'dizreinañ', |
|
| 16 | + 'admin_modifier_article' => 'Kemmañ ar pennad-mañ', |
|
| 17 | + 'admin_modifier_auteur' => 'Kemmañ ar skridaozer-mañ', |
|
| 18 | + 'admin_modifier_breve' => 'Kemmañ ar berrskrid-mañ', |
|
| 19 | + 'admin_modifier_mot' => 'Kemmañ ar ger-stur-mañ', |
|
| 20 | + 'admin_modifier_rubrique' => 'Kemmañ ar rubrikenn-mañ', |
|
| 21 | + 'admin_recalculer' => 'Hizivaat ar bajenn', |
|
| 22 | + 'afficher_calendrier' => 'Diskouez an deiziater', |
|
| 23 | + 'afficher_trad' => 'diskouez an troidigezhioù', |
|
| 24 | + 'alerte_maj_impossible' => '<b>Diwallit !</b> N’eus ket tu da hizivaat an diaz SQL etrezek ar stumm @version@, marteze abalamour d’ur gudenn aotre evit kemmañ an diaz titouroù. Mar plij kit e darempred gant ho herberc’hier.', |
|
| 25 | + 'alerte_modif_info_concourante' => 'DIWALLIT : Kemmet eo bet an titour-mañ en ul lec’h all. Setu an talvoud nevez :', |
|
| 26 | + 'analyse_xml' => 'Dielfennañ XML', |
|
| 27 | + 'annuler' => 'Nullañ', |
|
| 28 | + 'antispam_champ_vide' => 'Na lakait netra amañ :', |
|
| 29 | + 'articles_recents' => 'Pennadoù nevesañ', |
|
| 30 | + 'avis_1_erreur_saisie' => 'Ur fazi ho peus graet en ur skrivañ. Gwiriit ho testenn mar plij.', |
|
| 31 | + 'avis_archive_incorrect' => 'N’eo ket ar restr diell ur restr SPIP', |
|
| 32 | + 'avis_archive_invalide' => 'N’eo ket reizh ar restr diell', |
|
| 33 | + 'avis_attention' => 'DIWALLIT !', |
|
| 34 | + 'avis_champ_incorrect_type_objet' => 'Anv maezienn direizh @name@ evit un draezenn a seurt @type@', |
|
| 35 | + 'avis_colonne_inexistante' => 'N’eus ket eus ar bann @col@', |
|
| 36 | + 'avis_erreur' => 'Fazi: gwelet amañ a-is', |
|
| 37 | + 'avis_erreur_connexion' => 'Fazi kevreañ', |
|
| 38 | + 'avis_erreur_cookie' => 'kudenn toupin', |
|
| 39 | + 'avis_erreur_fonction_contexte' => 'Fazi programmiñ. Arabat d’an arc’hwel-mañ bezañ galvet er gendestenn-mañ.', |
|
| 40 | + 'avis_erreur_mysql' => 'Fazi SQL', |
|
| 41 | + 'avis_erreur_sauvegarde' => 'Fazi er savete (@type@ @id_objet@) !', |
|
| 42 | + 'avis_erreur_visiteur' => 'N’eus ket tu da dizhout al lodenn brevez', |
|
| 43 | + 'avis_nb_erreurs_saisie' => 'Bez ez eus @nb@ fazi en ho skrid. Gwiriit ho testenn mar plij.', |
|
| 44 | 44 | |
| 45 | - // B |
|
| 46 | - 'barre_a_accent_grave' => 'Ouzhpennañ un A (pennlizherenn) gant un tired-boud warnañ', |
|
| 47 | - 'barre_aide' => 'Implijit ar berradennoù tipografek evit pinvidikaat ar pajennaozañ', |
|
| 48 | - 'barre_e_accent_aigu' => 'Ouzhpennañ un E (pennlizherenn) gant un tired-lemm warnañ', |
|
| 49 | - 'barre_eo' => 'Ouzhpennañ un E en ’O’ (munud)', |
|
| 50 | - 'barre_eo_maj' => 'Ouzhpennañ un E en O (pennlizherenn)', |
|
| 51 | - 'barre_euro' => 'Ouzhpennañ an arouezenn €', |
|
| 52 | - 'barre_gras' => 'Lakaat e {{druz}}', |
|
| 53 | - 'barre_guillemets' => 'Gronnañ gant « krochedigoù »', |
|
| 54 | - 'barre_guillemets_simples' => 'Gronnañ gant krochedigoù a eil live', |
|
| 55 | - 'barre_intertitre' => 'Lakaat da {{{etretitl}}}', |
|
| 56 | - 'barre_italic' => 'Lakaat en {italek}', |
|
| 57 | - 'barre_lien' => 'Treiñ e [liamm gourskrid->http://...]', |
|
| 58 | - 'barre_lien_input' => 'Merkit chomlec’h ho liamm (gallout a rit reiñ ar chomlec’h a-stumm gant http://www.forzhpetra/com pe reiñ niverenn ur pennad eus al lec’hienn-mañ).', |
|
| 59 | - 'barre_note' => 'Lakaat da [[Notenn traoñ-pajenn]]', |
|
| 60 | - 'barre_paragraphe' => 'Krouiñ ur rannbennad', |
|
| 61 | - 'barre_quote' => '<quote>Menegiñ ur gemennadenn</quote>', |
|
| 62 | - 'bouton_changer' => 'Kemmañ', |
|
| 63 | - 'bouton_chercher' => 'Klask', |
|
| 64 | - 'bouton_choisir' => 'Dibab', |
|
| 65 | - 'bouton_deplacer' => 'Dilec’hiañ ', |
|
| 66 | - 'bouton_download' => 'Pellgargañ', |
|
| 67 | - 'bouton_enregistrer' => 'Enrollañ', |
|
| 68 | - 'bouton_radio_desactiver_messagerie_interne' => 'Diweredekaat ar postelerezh diabarzh', |
|
| 69 | - 'bouton_radio_envoi_annonces' => 'Kas ar c’hemennoù embann', |
|
| 70 | - 'bouton_radio_non_envoi_annonces' => 'Chom hep kas kemennoù', |
|
| 71 | - 'bouton_radio_non_envoi_liste_nouveautes' => 'Chom hep kas roll an nevezinti', |
|
| 72 | - 'bouton_recharger_page' => 'adkargañ ar bajenn-mañ', |
|
| 73 | - 'bouton_telecharger' => 'Pellgargañ', |
|
| 74 | - 'bouton_upload' => 'Pellgas', |
|
| 75 | - 'bouton_valider' => 'Kadarnaat', |
|
| 45 | + // B |
|
| 46 | + 'barre_a_accent_grave' => 'Ouzhpennañ un A (pennlizherenn) gant un tired-boud warnañ', |
|
| 47 | + 'barre_aide' => 'Implijit ar berradennoù tipografek evit pinvidikaat ar pajennaozañ', |
|
| 48 | + 'barre_e_accent_aigu' => 'Ouzhpennañ un E (pennlizherenn) gant un tired-lemm warnañ', |
|
| 49 | + 'barre_eo' => 'Ouzhpennañ un E en ’O’ (munud)', |
|
| 50 | + 'barre_eo_maj' => 'Ouzhpennañ un E en O (pennlizherenn)', |
|
| 51 | + 'barre_euro' => 'Ouzhpennañ an arouezenn €', |
|
| 52 | + 'barre_gras' => 'Lakaat e {{druz}}', |
|
| 53 | + 'barre_guillemets' => 'Gronnañ gant « krochedigoù »', |
|
| 54 | + 'barre_guillemets_simples' => 'Gronnañ gant krochedigoù a eil live', |
|
| 55 | + 'barre_intertitre' => 'Lakaat da {{{etretitl}}}', |
|
| 56 | + 'barre_italic' => 'Lakaat en {italek}', |
|
| 57 | + 'barre_lien' => 'Treiñ e [liamm gourskrid->http://...]', |
|
| 58 | + 'barre_lien_input' => 'Merkit chomlec’h ho liamm (gallout a rit reiñ ar chomlec’h a-stumm gant http://www.forzhpetra/com pe reiñ niverenn ur pennad eus al lec’hienn-mañ).', |
|
| 59 | + 'barre_note' => 'Lakaat da [[Notenn traoñ-pajenn]]', |
|
| 60 | + 'barre_paragraphe' => 'Krouiñ ur rannbennad', |
|
| 61 | + 'barre_quote' => '<quote>Menegiñ ur gemennadenn</quote>', |
|
| 62 | + 'bouton_changer' => 'Kemmañ', |
|
| 63 | + 'bouton_chercher' => 'Klask', |
|
| 64 | + 'bouton_choisir' => 'Dibab', |
|
| 65 | + 'bouton_deplacer' => 'Dilec’hiañ ', |
|
| 66 | + 'bouton_download' => 'Pellgargañ', |
|
| 67 | + 'bouton_enregistrer' => 'Enrollañ', |
|
| 68 | + 'bouton_radio_desactiver_messagerie_interne' => 'Diweredekaat ar postelerezh diabarzh', |
|
| 69 | + 'bouton_radio_envoi_annonces' => 'Kas ar c’hemennoù embann', |
|
| 70 | + 'bouton_radio_non_envoi_annonces' => 'Chom hep kas kemennoù', |
|
| 71 | + 'bouton_radio_non_envoi_liste_nouveautes' => 'Chom hep kas roll an nevezinti', |
|
| 72 | + 'bouton_recharger_page' => 'adkargañ ar bajenn-mañ', |
|
| 73 | + 'bouton_telecharger' => 'Pellgargañ', |
|
| 74 | + 'bouton_upload' => 'Pellgas', |
|
| 75 | + 'bouton_valider' => 'Kadarnaat', |
|
| 76 | 76 | |
| 77 | - // C |
|
| 78 | - 'cal_apresmidi' => 'endervezh', |
|
| 79 | - 'cal_jour_entier' => 'devezh a-bezh', |
|
| 80 | - 'cal_matin' => 'beure', |
|
| 81 | - 'cal_par_jour' => 'deiziataer deiz-ha-deiz', |
|
| 82 | - 'cal_par_mois' => 'deiziataer miz-ha-miz', |
|
| 83 | - 'cal_par_semaine' => 'deiziataer sizhun-ha-sizhun', |
|
| 84 | - 'choix_couleur_interface' => 'liv', |
|
| 85 | - 'choix_interface' => 'dibab an etrefas', |
|
| 86 | - 'colonne' => 'Bann', |
|
| 87 | - 'confirm_changer_statut' => 'Diwallit, goulennet hoc’h eus ma vo kemmet statud an elfenn-mañ. Ha mennet oc’h da genderc’hel ?', |
|
| 88 | - 'correcte' => 'reizh', |
|
| 77 | + // C |
|
| 78 | + 'cal_apresmidi' => 'endervezh', |
|
| 79 | + 'cal_jour_entier' => 'devezh a-bezh', |
|
| 80 | + 'cal_matin' => 'beure', |
|
| 81 | + 'cal_par_jour' => 'deiziataer deiz-ha-deiz', |
|
| 82 | + 'cal_par_mois' => 'deiziataer miz-ha-miz', |
|
| 83 | + 'cal_par_semaine' => 'deiziataer sizhun-ha-sizhun', |
|
| 84 | + 'choix_couleur_interface' => 'liv', |
|
| 85 | + 'choix_interface' => 'dibab an etrefas', |
|
| 86 | + 'colonne' => 'Bann', |
|
| 87 | + 'confirm_changer_statut' => 'Diwallit, goulennet hoc’h eus ma vo kemmet statud an elfenn-mañ. Ha mennet oc’h da genderc’hel ?', |
|
| 88 | + 'correcte' => 'reizh', |
|
| 89 | 89 | |
| 90 | - // D |
|
| 91 | - 'date_aujourdhui' => 'hiziv', |
|
| 92 | - 'date_avant_jc' => 'kent J.K.', |
|
| 93 | - 'date_dans' => 'a-benn @delai@', |
|
| 94 | - 'date_de_mois_1' => '@j@ @nommois@', |
|
| 95 | - 'date_de_mois_10' => '@j@ @nommois@', |
|
| 96 | - 'date_de_mois_11' => '@j@ @nommois@', |
|
| 97 | - 'date_de_mois_12' => '@j@ @nommois@', |
|
| 98 | - 'date_de_mois_2' => '@j@ @nommois@', |
|
| 99 | - 'date_de_mois_3' => '@j@ @nommois@', |
|
| 100 | - 'date_de_mois_4' => '@j@ @nommois@', |
|
| 101 | - 'date_de_mois_5' => '@j@ @nommois@', |
|
| 102 | - 'date_de_mois_6' => '@j@ @nommois@', |
|
| 103 | - 'date_de_mois_7' => '@j@ @nommois@', |
|
| 104 | - 'date_de_mois_8' => '@j@ @nommois@', |
|
| 105 | - 'date_de_mois_9' => '@j@ @nommois@', |
|
| 106 | - 'date_demain' => 'warc’hoazh', |
|
| 107 | - 'date_fmt_heures_minutes' => '@h@eur@m@munut', |
|
| 108 | - 'date_fmt_heures_minutes_court' => '@h@h@m@', |
|
| 109 | - 'date_fmt_jour' => '@nomjour@ @jour@', |
|
| 110 | - 'date_fmt_jour_heure' => '@jour@ da @heure@', |
|
| 111 | - 'date_fmt_jour_heure_debut_fin' => '@jour@ adalek @heure_debut@ betek @heure_fin@', |
|
| 112 | - 'date_fmt_jour_heure_debut_fin_abbr' => '@dtstart@@jour@ adalek @heure_debut@@dtabbr@ betek @dtend@@heure_fin@@dtabbr@', |
|
| 113 | - 'date_fmt_jour_mois' => '@jour@ a viz @nommois@', |
|
| 114 | - 'date_fmt_jour_mois_annee' => '@jour@ a viz @nommois@ @annee@', |
|
| 115 | - 'date_fmt_mois_annee' => '@nommois@ @annee@', |
|
| 116 | - 'date_fmt_nomjour' => '@nomjour@ @date@', |
|
| 117 | - 'date_fmt_nomjour_date' => '@nomjour@ @date@', |
|
| 118 | - 'date_fmt_periode' => 'Adalek @date_debut@ betek @date_fin@', |
|
| 119 | - 'date_fmt_periode_abbr' => 'Adalek @dtart@@date_debut@@dtabbr@ betek @dtend@@date_fin@@dtabbr@', |
|
| 120 | - 'date_fmt_periode_from' => 'Adalek', |
|
| 121 | - 'date_fmt_periode_to' => 'betek', |
|
| 122 | - 'date_fmt_saison_annee' => '@saison@ @annee@', |
|
| 123 | - 'date_heures' => 'eur', |
|
| 124 | - 'date_hier' => 'dec’h', |
|
| 125 | - 'date_il_y_a' => '@delai@ zo', |
|
| 126 | - 'date_jnum1' => '1añ', |
|
| 127 | - 'date_jnum10' => '10', |
|
| 128 | - 'date_jnum11' => '11', |
|
| 129 | - 'date_jnum12' => '12', |
|
| 130 | - 'date_jnum13' => '13', |
|
| 131 | - 'date_jnum14' => '14', |
|
| 132 | - 'date_jnum15' => '15', |
|
| 133 | - 'date_jnum16' => '16', |
|
| 134 | - 'date_jnum17' => '17', |
|
| 135 | - 'date_jnum18' => '18', |
|
| 136 | - 'date_jnum19' => '19', |
|
| 137 | - 'date_jnum2' => 'eil', |
|
| 138 | - 'date_jnum20' => '20', |
|
| 139 | - 'date_jnum21' => '21', |
|
| 140 | - 'date_jnum22' => '22', |
|
| 141 | - 'date_jnum23' => '23', |
|
| 142 | - 'date_jnum24' => '24', |
|
| 143 | - 'date_jnum25' => '25', |
|
| 144 | - 'date_jnum26' => '26', |
|
| 145 | - 'date_jnum27' => '27', |
|
| 146 | - 'date_jnum28' => '28', |
|
| 147 | - 'date_jnum29' => '29', |
|
| 148 | - 'date_jnum3' => '3', |
|
| 149 | - 'date_jnum30' => '30', |
|
| 150 | - 'date_jnum31' => '31', |
|
| 151 | - 'date_jnum4' => '4', |
|
| 152 | - 'date_jnum5' => '5', |
|
| 153 | - 'date_jnum6' => '6', |
|
| 154 | - 'date_jnum7' => '7', |
|
| 155 | - 'date_jnum8' => '8', |
|
| 156 | - 'date_jnum9' => '9', |
|
| 157 | - 'date_jour_1' => 'Sul', |
|
| 158 | - 'date_jour_1_abbr' => 'Sul', |
|
| 159 | - 'date_jour_1_initiale' => 'S.', |
|
| 160 | - 'date_jour_2' => 'Lun', |
|
| 161 | - 'date_jour_2_abbr' => 'Lun', |
|
| 162 | - 'date_jour_2_initiale' => 'L.', |
|
| 163 | - 'date_jour_3' => 'Meurzh', |
|
| 164 | - 'date_jour_3_abbr' => 'Meu.', |
|
| 165 | - 'date_jour_3_initiale' => 'M.', |
|
| 166 | - 'date_jour_4' => 'Merc’her', |
|
| 167 | - 'date_jour_4_abbr' => 'Mer.', |
|
| 168 | - 'date_jour_4_initiale' => 'M.', |
|
| 169 | - 'date_jour_5' => 'Yaou', |
|
| 170 | - 'date_jour_5_abbr' => 'Yaou', |
|
| 171 | - 'date_jour_5_initiale' => 'Y.', |
|
| 172 | - 'date_jour_6' => 'Gwener', |
|
| 173 | - 'date_jour_6_abbr' => 'Gwe.', |
|
| 174 | - 'date_jour_6_initiale' => 'Gw.', |
|
| 175 | - 'date_jour_7' => 'Sadorn', |
|
| 176 | - 'date_jour_7_abbr' => 'Sad.', |
|
| 177 | - 'date_jour_7_initiale' => 'S.', |
|
| 178 | - 'date_jours' => 'deiz', |
|
| 179 | - 'date_minutes' => 'munut', |
|
| 180 | - 'date_mois' => 'miz', |
|
| 181 | - 'date_mois_1' => 'Genver', |
|
| 182 | - 'date_mois_10' => 'Here', |
|
| 183 | - 'date_mois_10_abbr' => 'here.', |
|
| 184 | - 'date_mois_11' => 'Du', |
|
| 185 | - 'date_mois_11_abbr' => 'du.', |
|
| 186 | - 'date_mois_12' => 'Kerzu', |
|
| 187 | - 'date_mois_12_abbr' => 'kerzu.', |
|
| 188 | - 'date_mois_1_abbr' => 'genver.', |
|
| 189 | - 'date_mois_2' => 'C’hwevrer', |
|
| 190 | - 'date_mois_2_abbr' => 'c’hevrer.', |
|
| 191 | - 'date_mois_3' => 'Meurzh', |
|
| 192 | - 'date_mois_3_abbr' => 'Meurzh ', |
|
| 193 | - 'date_mois_4' => 'Ebrel', |
|
| 194 | - 'date_mois_4_abbr' => 'ebrel.', |
|
| 195 | - 'date_mois_5' => 'Mae', |
|
| 196 | - 'date_mois_5_abbr' => 'Mae', |
|
| 197 | - 'date_mois_6' => 'Mezheven', |
|
| 198 | - 'date_mois_6_abbr' => 'Mezheven', |
|
| 199 | - 'date_mois_7' => 'Gouere', |
|
| 200 | - 'date_mois_7_abbr' => 'gouere.', |
|
| 201 | - 'date_mois_8' => 'Eost', |
|
| 202 | - 'date_mois_8_abbr' => 'Eost', |
|
| 203 | - 'date_mois_9' => 'Gwengolo', |
|
| 204 | - 'date_mois_9_abbr' => 'gweng.', |
|
| 205 | - 'date_saison_1' => 'Goañv', |
|
| 206 | - 'date_saison_2' => 'nevez-amzer', |
|
| 207 | - 'date_saison_3' => 'hañv', |
|
| 208 | - 'date_saison_4' => 'diskar-amzer', |
|
| 209 | - 'date_secondes' => 'eilenn', |
|
| 210 | - 'date_semaines' => 'sizhun', |
|
| 211 | - 'date_un_mois' => 'miz', |
|
| 212 | - 'date_une_heure' => 'eur', |
|
| 213 | - 'date_une_minute' => 'munut', |
|
| 214 | - 'date_une_seconde' => 'eilenn', |
|
| 215 | - 'date_une_semaine' => 'sizhun', |
|
| 216 | - 'dirs_commencer' => 'a-benn kregiñ da vat gant ar staliadur', |
|
| 217 | - 'dirs_preliminaire' => 'A-raok kenderc’hel : <b>Renkañ ar gwirioù moned</b>', |
|
| 218 | - 'dirs_probleme_droits' => 'Kudenn gant ar gwirioù moned', |
|
| 219 | - 'dirs_repertoires_absents' => '<p><b>N’eo ket bet kavet ar c’havlec’hioù-mañ : </b></p><ul>@bad_dirs@.</ul> |
|
| 90 | + // D |
|
| 91 | + 'date_aujourdhui' => 'hiziv', |
|
| 92 | + 'date_avant_jc' => 'kent J.K.', |
|
| 93 | + 'date_dans' => 'a-benn @delai@', |
|
| 94 | + 'date_de_mois_1' => '@j@ @nommois@', |
|
| 95 | + 'date_de_mois_10' => '@j@ @nommois@', |
|
| 96 | + 'date_de_mois_11' => '@j@ @nommois@', |
|
| 97 | + 'date_de_mois_12' => '@j@ @nommois@', |
|
| 98 | + 'date_de_mois_2' => '@j@ @nommois@', |
|
| 99 | + 'date_de_mois_3' => '@j@ @nommois@', |
|
| 100 | + 'date_de_mois_4' => '@j@ @nommois@', |
|
| 101 | + 'date_de_mois_5' => '@j@ @nommois@', |
|
| 102 | + 'date_de_mois_6' => '@j@ @nommois@', |
|
| 103 | + 'date_de_mois_7' => '@j@ @nommois@', |
|
| 104 | + 'date_de_mois_8' => '@j@ @nommois@', |
|
| 105 | + 'date_de_mois_9' => '@j@ @nommois@', |
|
| 106 | + 'date_demain' => 'warc’hoazh', |
|
| 107 | + 'date_fmt_heures_minutes' => '@h@eur@m@munut', |
|
| 108 | + 'date_fmt_heures_minutes_court' => '@h@h@m@', |
|
| 109 | + 'date_fmt_jour' => '@nomjour@ @jour@', |
|
| 110 | + 'date_fmt_jour_heure' => '@jour@ da @heure@', |
|
| 111 | + 'date_fmt_jour_heure_debut_fin' => '@jour@ adalek @heure_debut@ betek @heure_fin@', |
|
| 112 | + 'date_fmt_jour_heure_debut_fin_abbr' => '@dtstart@@jour@ adalek @heure_debut@@dtabbr@ betek @dtend@@heure_fin@@dtabbr@', |
|
| 113 | + 'date_fmt_jour_mois' => '@jour@ a viz @nommois@', |
|
| 114 | + 'date_fmt_jour_mois_annee' => '@jour@ a viz @nommois@ @annee@', |
|
| 115 | + 'date_fmt_mois_annee' => '@nommois@ @annee@', |
|
| 116 | + 'date_fmt_nomjour' => '@nomjour@ @date@', |
|
| 117 | + 'date_fmt_nomjour_date' => '@nomjour@ @date@', |
|
| 118 | + 'date_fmt_periode' => 'Adalek @date_debut@ betek @date_fin@', |
|
| 119 | + 'date_fmt_periode_abbr' => 'Adalek @dtart@@date_debut@@dtabbr@ betek @dtend@@date_fin@@dtabbr@', |
|
| 120 | + 'date_fmt_periode_from' => 'Adalek', |
|
| 121 | + 'date_fmt_periode_to' => 'betek', |
|
| 122 | + 'date_fmt_saison_annee' => '@saison@ @annee@', |
|
| 123 | + 'date_heures' => 'eur', |
|
| 124 | + 'date_hier' => 'dec’h', |
|
| 125 | + 'date_il_y_a' => '@delai@ zo', |
|
| 126 | + 'date_jnum1' => '1añ', |
|
| 127 | + 'date_jnum10' => '10', |
|
| 128 | + 'date_jnum11' => '11', |
|
| 129 | + 'date_jnum12' => '12', |
|
| 130 | + 'date_jnum13' => '13', |
|
| 131 | + 'date_jnum14' => '14', |
|
| 132 | + 'date_jnum15' => '15', |
|
| 133 | + 'date_jnum16' => '16', |
|
| 134 | + 'date_jnum17' => '17', |
|
| 135 | + 'date_jnum18' => '18', |
|
| 136 | + 'date_jnum19' => '19', |
|
| 137 | + 'date_jnum2' => 'eil', |
|
| 138 | + 'date_jnum20' => '20', |
|
| 139 | + 'date_jnum21' => '21', |
|
| 140 | + 'date_jnum22' => '22', |
|
| 141 | + 'date_jnum23' => '23', |
|
| 142 | + 'date_jnum24' => '24', |
|
| 143 | + 'date_jnum25' => '25', |
|
| 144 | + 'date_jnum26' => '26', |
|
| 145 | + 'date_jnum27' => '27', |
|
| 146 | + 'date_jnum28' => '28', |
|
| 147 | + 'date_jnum29' => '29', |
|
| 148 | + 'date_jnum3' => '3', |
|
| 149 | + 'date_jnum30' => '30', |
|
| 150 | + 'date_jnum31' => '31', |
|
| 151 | + 'date_jnum4' => '4', |
|
| 152 | + 'date_jnum5' => '5', |
|
| 153 | + 'date_jnum6' => '6', |
|
| 154 | + 'date_jnum7' => '7', |
|
| 155 | + 'date_jnum8' => '8', |
|
| 156 | + 'date_jnum9' => '9', |
|
| 157 | + 'date_jour_1' => 'Sul', |
|
| 158 | + 'date_jour_1_abbr' => 'Sul', |
|
| 159 | + 'date_jour_1_initiale' => 'S.', |
|
| 160 | + 'date_jour_2' => 'Lun', |
|
| 161 | + 'date_jour_2_abbr' => 'Lun', |
|
| 162 | + 'date_jour_2_initiale' => 'L.', |
|
| 163 | + 'date_jour_3' => 'Meurzh', |
|
| 164 | + 'date_jour_3_abbr' => 'Meu.', |
|
| 165 | + 'date_jour_3_initiale' => 'M.', |
|
| 166 | + 'date_jour_4' => 'Merc’her', |
|
| 167 | + 'date_jour_4_abbr' => 'Mer.', |
|
| 168 | + 'date_jour_4_initiale' => 'M.', |
|
| 169 | + 'date_jour_5' => 'Yaou', |
|
| 170 | + 'date_jour_5_abbr' => 'Yaou', |
|
| 171 | + 'date_jour_5_initiale' => 'Y.', |
|
| 172 | + 'date_jour_6' => 'Gwener', |
|
| 173 | + 'date_jour_6_abbr' => 'Gwe.', |
|
| 174 | + 'date_jour_6_initiale' => 'Gw.', |
|
| 175 | + 'date_jour_7' => 'Sadorn', |
|
| 176 | + 'date_jour_7_abbr' => 'Sad.', |
|
| 177 | + 'date_jour_7_initiale' => 'S.', |
|
| 178 | + 'date_jours' => 'deiz', |
|
| 179 | + 'date_minutes' => 'munut', |
|
| 180 | + 'date_mois' => 'miz', |
|
| 181 | + 'date_mois_1' => 'Genver', |
|
| 182 | + 'date_mois_10' => 'Here', |
|
| 183 | + 'date_mois_10_abbr' => 'here.', |
|
| 184 | + 'date_mois_11' => 'Du', |
|
| 185 | + 'date_mois_11_abbr' => 'du.', |
|
| 186 | + 'date_mois_12' => 'Kerzu', |
|
| 187 | + 'date_mois_12_abbr' => 'kerzu.', |
|
| 188 | + 'date_mois_1_abbr' => 'genver.', |
|
| 189 | + 'date_mois_2' => 'C’hwevrer', |
|
| 190 | + 'date_mois_2_abbr' => 'c’hevrer.', |
|
| 191 | + 'date_mois_3' => 'Meurzh', |
|
| 192 | + 'date_mois_3_abbr' => 'Meurzh ', |
|
| 193 | + 'date_mois_4' => 'Ebrel', |
|
| 194 | + 'date_mois_4_abbr' => 'ebrel.', |
|
| 195 | + 'date_mois_5' => 'Mae', |
|
| 196 | + 'date_mois_5_abbr' => 'Mae', |
|
| 197 | + 'date_mois_6' => 'Mezheven', |
|
| 198 | + 'date_mois_6_abbr' => 'Mezheven', |
|
| 199 | + 'date_mois_7' => 'Gouere', |
|
| 200 | + 'date_mois_7_abbr' => 'gouere.', |
|
| 201 | + 'date_mois_8' => 'Eost', |
|
| 202 | + 'date_mois_8_abbr' => 'Eost', |
|
| 203 | + 'date_mois_9' => 'Gwengolo', |
|
| 204 | + 'date_mois_9_abbr' => 'gweng.', |
|
| 205 | + 'date_saison_1' => 'Goañv', |
|
| 206 | + 'date_saison_2' => 'nevez-amzer', |
|
| 207 | + 'date_saison_3' => 'hañv', |
|
| 208 | + 'date_saison_4' => 'diskar-amzer', |
|
| 209 | + 'date_secondes' => 'eilenn', |
|
| 210 | + 'date_semaines' => 'sizhun', |
|
| 211 | + 'date_un_mois' => 'miz', |
|
| 212 | + 'date_une_heure' => 'eur', |
|
| 213 | + 'date_une_minute' => 'munut', |
|
| 214 | + 'date_une_seconde' => 'eilenn', |
|
| 215 | + 'date_une_semaine' => 'sizhun', |
|
| 216 | + 'dirs_commencer' => 'a-benn kregiñ da vat gant ar staliadur', |
|
| 217 | + 'dirs_preliminaire' => 'A-raok kenderc’hel : <b>Renkañ ar gwirioù moned</b>', |
|
| 218 | + 'dirs_probleme_droits' => 'Kudenn gant ar gwirioù moned', |
|
| 219 | + 'dirs_repertoires_absents' => '<p><b>N’eo ket bet kavet ar c’havlec’hioù-mañ : </b></p><ul>@bad_dirs@.</ul> |
|
| 220 | 220 | <p>Posupl eo e vefe abalamour d’ur fazi impplij pennlizherennoù pe lizherennoù munut e lec’hioù fall. |
| 221 | 221 | Gwiriit e klot mat stumm lizherennoù ar c’havlec’hioù gant ar pezh zo diskouezet a-us; |
| 222 | 222 | ha ma ne glotont ket, adanvit anezho gant ho meziant FTP evit reizhañ ar gudenn.</p> |
| 223 | 223 | <p>Ur wech graet an dra-se e c’hellot </p>', |
| 224 | - 'dirs_repertoires_suivants' => '<p><b>N’haller ket skrivañ er c’havlec’hioù-mañ : </b></p><ul>@bad_dirs@.</ul> |
|
| 224 | + 'dirs_repertoires_suivants' => '<p><b>N’haller ket skrivañ er c’havlec’hioù-mañ : </b></p><ul>@bad_dirs@.</ul> |
|
| 225 | 225 | <p>Implijit ar meziant FTP a-benn kemmañ ar gwirioù evit pep hini. |
| 226 | 226 | Displeget eo an hentenn er sturlevr staliañ.</p> |
| 227 | 227 | <p>Ur wech graet se e c’helloc’h ', |
| 228 | - 'double_occurrence' => '@balise@ bet kavet div wech', |
|
| 228 | + 'double_occurrence' => '@balise@ bet kavet div wech', |
|
| 229 | 229 | |
| 230 | - // E |
|
| 231 | - 'en_cours' => 'war ober', |
|
| 232 | - 'envoi_via_le_site' => 'Kas dre al lec’hienn', |
|
| 233 | - 'erreur' => 'Fazi', |
|
| 234 | - 'erreur_balise_non_fermee' => 'Balizenn ziwezhañ chomet digor :', |
|
| 235 | - 'erreur_technique_ajaxform' => 'Gast ! Dre ur fazi dic’hortoz n’eus ket bet gellet kas ar furmenn. Klaskit ober en dro mar plij. |
|
| 230 | + // E |
|
| 231 | + 'en_cours' => 'war ober', |
|
| 232 | + 'envoi_via_le_site' => 'Kas dre al lec’hienn', |
|
| 233 | + 'erreur' => 'Fazi', |
|
| 234 | + 'erreur_balise_non_fermee' => 'Balizenn ziwezhañ chomet digor :', |
|
| 235 | + 'erreur_technique_ajaxform' => 'Gast ! Dre ur fazi dic’hortoz n’eus ket bet gellet kas ar furmenn. Klaskit ober en dro mar plij. |
|
| 236 | 236 | |
| 237 | 237 | ', |
| 238 | - 'erreur_technique_enregistrement_champs' => 'Miret eo bet enrolliñ mat al heuliad-gerioù @champs@ abalamour d’ur fazi teknikel.', |
|
| 239 | - 'erreur_technique_enregistrement_impossible' => 'Miret eo bet an enrolladenn abalamour d’ur fazi teknikel.', |
|
| 240 | - 'erreur_texte' => 'fazi', |
|
| 241 | - 'etape' => 'Pazenn', |
|
| 238 | + 'erreur_technique_enregistrement_champs' => 'Miret eo bet enrolliñ mat al heuliad-gerioù @champs@ abalamour d’ur fazi teknikel.', |
|
| 239 | + 'erreur_technique_enregistrement_impossible' => 'Miret eo bet an enrolladenn abalamour d’ur fazi teknikel.', |
|
| 240 | + 'erreur_texte' => 'fazi', |
|
| 241 | + 'etape' => 'Pazenn', |
|
| 242 | 242 | |
| 243 | - // F |
|
| 244 | - 'fichier_introuvable' => 'Restr @fichier@ dibosupl da gavout', # MODIF |
|
| 245 | - 'form_auteur_confirmation' => 'Gwirekait ho postel', |
|
| 246 | - 'form_auteur_email_modifie' => 'Ho postel a zo bet kemmet.', |
|
| 247 | - 'form_auteur_envoi_mail_confirmation' => 'Ur postel a wiriekadur a zo paouez bezañ kaset da @email@. Ret eo deoc’h mont da welet ar chomlec’h merket e-barzh al lizher-se evit gwiriekaat ho postel.', |
|
| 248 | - 'form_auteur_mail_confirmation' => 'Demat, |
|
| 243 | + // F |
|
| 244 | + 'fichier_introuvable' => 'Restr @fichier@ dibosupl da gavout', # MODIF |
|
| 245 | + 'form_auteur_confirmation' => 'Gwirekait ho postel', |
|
| 246 | + 'form_auteur_email_modifie' => 'Ho postel a zo bet kemmet.', |
|
| 247 | + 'form_auteur_envoi_mail_confirmation' => 'Ur postel a wiriekadur a zo paouez bezañ kaset da @email@. Ret eo deoc’h mont da welet ar chomlec’h merket e-barzh al lizher-se evit gwiriekaat ho postel.', |
|
| 248 | + 'form_auteur_mail_confirmation' => 'Demat, |
|
| 249 | 249 | |
| 250 | 250 | Goulennet ho peus cheñch ho postel. |
| 251 | 251 | Evit gwiriekaat ho postel nevez, n’ho peus nemet kevreañ d’ar chomlec’h amañ dindan (e-giz-all e vo dianavezet ho koulenn) : |
| 252 | 252 | |
| 253 | 253 | @url@ |
| 254 | 254 | ', |
| 255 | - 'form_deja_inscrit' => 'Enskrivet oc’h c’hoazh.', |
|
| 256 | - 'form_email_non_valide' => 'N’eo ket reizh ho postel.', |
|
| 257 | - 'form_forum_access_refuse' => 'N’oc’h ket aotreet da vont war al lec’hienn-mañ ken.', |
|
| 258 | - 'form_forum_bonjour' => 'Demat @nom@,', |
|
| 259 | - 'form_forum_confirmer_email' => 'Evit gwiriekaat ho postel, mont d’ar chomlec’h : |
|
| 255 | + 'form_deja_inscrit' => 'Enskrivet oc’h c’hoazh.', |
|
| 256 | + 'form_email_non_valide' => 'N’eo ket reizh ho postel.', |
|
| 257 | + 'form_forum_access_refuse' => 'N’oc’h ket aotreet da vont war al lec’hienn-mañ ken.', |
|
| 258 | + 'form_forum_bonjour' => 'Demat @nom@,', |
|
| 259 | + 'form_forum_confirmer_email' => 'Evit gwiriekaat ho postel, mont d’ar chomlec’h : |
|
| 260 | 260 | @url_confirm@', |
| 261 | - 'form_forum_email_deja_enregistre' => 'Enrollet eo ar postel-se dija. Gallout a rit ober gant ho ker-tremen boas neuze.', |
|
| 262 | - 'form_forum_identifiant_mail' => 'Emañ ho kod moned nevez o paouez bezañ kaset deoc’h dre bostel.', |
|
| 263 | - 'form_forum_identifiants' => 'Titouroù hiniennel', |
|
| 264 | - 'form_forum_indiquer_nom_email' => 'Skrivit amañ hoc’h anv hag ho postel. Kaset e vo deoc’h buan ho titouroù hiniennel dre bostel.', |
|
| 265 | - 'form_forum_login' => 'Kod kevreañ :', |
|
| 266 | - 'form_forum_message_auto' => '(ur gemennadenn emgefre eo homañ)', |
|
| 267 | - 'form_forum_pass' => 'ger-tremen :', |
|
| 268 | - 'form_forum_probleme_mail' => 'Kudenn postel : n’haller ket kas an titouroù.', |
|
| 269 | - 'form_forum_voici1' => 'Setu ho titouroù evit gallout kemer perzh e buhez "@nom_site_spip@" (@adresse_site@) :', |
|
| 270 | - 'form_forum_voici2' => 'Setu ho titouroù evit gallout kinnig pennadoù war "@nom_site_spip@" (@adresse_login@) :', |
|
| 271 | - 'form_indiquer_email' => 'Skrivit ho postel mar plij.', |
|
| 272 | - 'form_indiquer_nom' => 'Skrivit hoc’h anv mar plij.', |
|
| 273 | - 'form_indiquer_nom_site' => 'Skrivit anv ho lec’hienn.', |
|
| 274 | - 'form_pet_deja_enregistre' => 'Enrollet eo al lec’hienn-mañ c’hoazh', |
|
| 275 | - 'form_pet_signature_pasprise' => 'N’eus ket bet dalc’het kont eus ho sinadur.', |
|
| 276 | - 'form_prop_confirmer_envoi' => 'Kadarnaat ar c’has', |
|
| 277 | - 'form_prop_description' => 'Deskrivadur/evezhiadenn', |
|
| 278 | - 'form_prop_enregistre' => 'Enrollet eo bet ho kinnig. Embannet e vo goude bezañ bet asantet gant tud e-karg eus al lec’hienn-mañ.', |
|
| 279 | - 'form_prop_envoyer' => 'Kas ur gemenadenn', |
|
| 280 | - 'form_prop_indiquer_email' => 'Merkit ur postel reizh mar plij', |
|
| 281 | - 'form_prop_indiquer_nom_site' => 'Merkit anv al lec’hienn.', |
|
| 282 | - 'form_prop_indiquer_sujet' => 'Merkit ur sujed', |
|
| 283 | - 'form_prop_message_envoye' => 'Kaset eo bet ar gemennadenn', |
|
| 284 | - 'form_prop_non_enregistre' => 'N’eo ket bet enrollet ho kinnig', |
|
| 285 | - 'form_prop_sujet' => 'Sujed', |
|
| 286 | - 'form_prop_url_site' => 'Chomlec’h (URL) al lec’hienn', |
|
| 287 | - 'format_date_incorrecte' => 'N’eo ket reizh an deiziad pe e stumm.', |
|
| 288 | - 'format_heure_incorrecte' => 'N’eo ket reizh an eur pe he stumm.', |
|
| 289 | - 'forum_non_inscrit' => 'N’oc’h ket enskrivet, pe direizh eo ar ger-tremen pe ar chomlec’h.', |
|
| 290 | - 'forum_par_auteur' => 'gant @auteur@', |
|
| 291 | - 'forum_titre_erreur' => 'Fazi...', |
|
| 261 | + 'form_forum_email_deja_enregistre' => 'Enrollet eo ar postel-se dija. Gallout a rit ober gant ho ker-tremen boas neuze.', |
|
| 262 | + 'form_forum_identifiant_mail' => 'Emañ ho kod moned nevez o paouez bezañ kaset deoc’h dre bostel.', |
|
| 263 | + 'form_forum_identifiants' => 'Titouroù hiniennel', |
|
| 264 | + 'form_forum_indiquer_nom_email' => 'Skrivit amañ hoc’h anv hag ho postel. Kaset e vo deoc’h buan ho titouroù hiniennel dre bostel.', |
|
| 265 | + 'form_forum_login' => 'Kod kevreañ :', |
|
| 266 | + 'form_forum_message_auto' => '(ur gemennadenn emgefre eo homañ)', |
|
| 267 | + 'form_forum_pass' => 'ger-tremen :', |
|
| 268 | + 'form_forum_probleme_mail' => 'Kudenn postel : n’haller ket kas an titouroù.', |
|
| 269 | + 'form_forum_voici1' => 'Setu ho titouroù evit gallout kemer perzh e buhez "@nom_site_spip@" (@adresse_site@) :', |
|
| 270 | + 'form_forum_voici2' => 'Setu ho titouroù evit gallout kinnig pennadoù war "@nom_site_spip@" (@adresse_login@) :', |
|
| 271 | + 'form_indiquer_email' => 'Skrivit ho postel mar plij.', |
|
| 272 | + 'form_indiquer_nom' => 'Skrivit hoc’h anv mar plij.', |
|
| 273 | + 'form_indiquer_nom_site' => 'Skrivit anv ho lec’hienn.', |
|
| 274 | + 'form_pet_deja_enregistre' => 'Enrollet eo al lec’hienn-mañ c’hoazh', |
|
| 275 | + 'form_pet_signature_pasprise' => 'N’eus ket bet dalc’het kont eus ho sinadur.', |
|
| 276 | + 'form_prop_confirmer_envoi' => 'Kadarnaat ar c’has', |
|
| 277 | + 'form_prop_description' => 'Deskrivadur/evezhiadenn', |
|
| 278 | + 'form_prop_enregistre' => 'Enrollet eo bet ho kinnig. Embannet e vo goude bezañ bet asantet gant tud e-karg eus al lec’hienn-mañ.', |
|
| 279 | + 'form_prop_envoyer' => 'Kas ur gemenadenn', |
|
| 280 | + 'form_prop_indiquer_email' => 'Merkit ur postel reizh mar plij', |
|
| 281 | + 'form_prop_indiquer_nom_site' => 'Merkit anv al lec’hienn.', |
|
| 282 | + 'form_prop_indiquer_sujet' => 'Merkit ur sujed', |
|
| 283 | + 'form_prop_message_envoye' => 'Kaset eo bet ar gemennadenn', |
|
| 284 | + 'form_prop_non_enregistre' => 'N’eo ket bet enrollet ho kinnig', |
|
| 285 | + 'form_prop_sujet' => 'Sujed', |
|
| 286 | + 'form_prop_url_site' => 'Chomlec’h (URL) al lec’hienn', |
|
| 287 | + 'format_date_incorrecte' => 'N’eo ket reizh an deiziad pe e stumm.', |
|
| 288 | + 'format_heure_incorrecte' => 'N’eo ket reizh an eur pe he stumm.', |
|
| 289 | + 'forum_non_inscrit' => 'N’oc’h ket enskrivet, pe direizh eo ar ger-tremen pe ar chomlec’h.', |
|
| 290 | + 'forum_par_auteur' => 'gant @auteur@', |
|
| 291 | + 'forum_titre_erreur' => 'Fazi...', |
|
| 292 | 292 | |
| 293 | - // I |
|
| 294 | - 'ical_texte_rss_articles' => 'D’ar chomlec’h-mañ emañ restr «backend» ar pennadoù :', |
|
| 295 | - 'ical_texte_rss_articles2' => 'Gallout a rit kaout restroù «backend» evit pennadoù pep rummad al lec’hienn ivez :', |
|
| 296 | - 'ical_texte_rss_breves' => 'Bez’ ez eus ivez ur restr enni berrskridoù al lec’hienn. Ma resisait niverenn ur rubrikenn, n’ho po nemet berrskridoù ar rubrikenn-se.', |
|
| 297 | - 'icone_a_suivre' => 'Da genderc’hel', |
|
| 298 | - 'icone_admin_site' => 'Merañ al lec’hienn', |
|
| 299 | - 'icone_agenda' => 'Deiziataer', |
|
| 300 | - 'icone_aide_ligne' => 'Skoazell', |
|
| 301 | - 'icone_articles' => 'Pennadoù', |
|
| 302 | - 'icone_auteurs' => 'Skridaozerien', |
|
| 303 | - 'icone_brouteur' => 'Merdeiñ prim', |
|
| 304 | - 'icone_configuration_site' => 'Kefluniañ ', |
|
| 305 | - 'icone_configurer_site' => 'Kefluniañ ho lec’hienn', |
|
| 306 | - 'icone_creer_nouvel_auteur' => 'Krouiñ ur skridaozer nevez', |
|
| 307 | - 'icone_creer_rubrique' => 'Krouiñ ur rubrikenn', |
|
| 308 | - 'icone_creer_sous_rubrique' => 'Krouiñ un isrubrikenn', |
|
| 309 | - 'icone_deconnecter' => 'Digevreañ', |
|
| 310 | - 'icone_discussions' => 'Kaozeadennoù', |
|
| 311 | - 'icone_doc_rubrique' => 'Teulioù ar rubrikennoù', |
|
| 312 | - 'icone_ecrire_article' => 'Skrivañ ur pennad nevez', |
|
| 313 | - 'icone_edition_site' => 'Embann', |
|
| 314 | - 'icone_gestion_langues' => 'Merañ ar yezhoù', |
|
| 315 | - 'icone_informations_personnelles' => 'Titouroù hiniennel', |
|
| 316 | - 'icone_interface_complet' => 'Etrefas klok', |
|
| 317 | - 'icone_interface_simple' => 'Etrefas eeunaet', |
|
| 318 | - 'icone_maintenance_site' => 'Ober war-dro al lec’hienn', |
|
| 319 | - 'icone_messagerie_personnelle' => 'Postelerezh hiniennel', |
|
| 320 | - 'icone_repartition_debut' => 'Diskouez an dasparzh abaoe an deroù', |
|
| 321 | - 'icone_rubriques' => 'Rubrikennoù', |
|
| 322 | - 'icone_sauver_site' => 'Saveteiñ al lec’hienn', |
|
| 323 | - 'icone_site_entier' => 'Al lec’hienn a-bezh', |
|
| 324 | - 'icone_sites_references' => 'Lec’hiennoù menegeret', |
|
| 325 | - 'icone_statistiques' => 'Stadegoù al lec’hienn', |
|
| 326 | - 'icone_suivi_activite' => 'Heuliañ buhez al lec’hienn', |
|
| 327 | - 'icone_suivi_actualite' => 'Emdroadur al lec’hienn', |
|
| 328 | - 'icone_suivi_pettions' => 'Heuliañ/merañ ar sinadegoù', |
|
| 329 | - 'icone_suivi_revisions' => 'Kemmoù ar pennadoù', |
|
| 330 | - 'icone_supprimer_document' => 'Diverkañ an teul-mañ', |
|
| 331 | - 'icone_supprimer_image' => 'Diverkañ ar skeudenn-mañ', |
|
| 332 | - 'icone_tous_articles' => 'Ho holl bennadoù', |
|
| 333 | - 'icone_tous_auteur' => 'An holl skridaozerien', |
|
| 334 | - 'icone_tous_visiteur' => 'An holl gweladerien', |
|
| 335 | - 'icone_visiter_site' => 'Gweladenniñ al lec’hienn foran', |
|
| 336 | - 'icone_voir_en_ligne' => 'Gwelet enlinenn', |
|
| 337 | - 'img_indisponible' => 'skeudenn dibosupl da gaout', |
|
| 338 | - 'impossible' => 'dibosupl', |
|
| 339 | - 'info_a_suivre' => 'DA GENDERC’HEL»', |
|
| 340 | - 'info_acces_interdit' => 'Difennet mont tre', |
|
| 341 | - 'info_acces_refuse' => 'Nac’het eo bet deoc’h mon tre', |
|
| 342 | - 'info_action' => 'Oberiadenn : @action@', |
|
| 343 | - 'info_administrer_rubriques' => 'Gallout a rit merañ ar rubrikenn-mañ hag an isrubrikenndoù enni', |
|
| 344 | - 'info_adresse_non_indiquee' => 'N’hoc’h eus ket lakaet chomlec’h ebet da arnodiñ !', |
|
| 345 | - 'info_aide' => 'SKOAZELL :', |
|
| 346 | - 'info_ajouter_mot' => 'Ouzhpennañ ar ger-mañ', |
|
| 347 | - 'info_annonce' => 'KEMENN', |
|
| 348 | - 'info_annonces_generales' => 'Kemennoù hollek :', |
|
| 349 | - 'info_article_propose' => 'Pennad kinniget', |
|
| 350 | - 'info_article_publie' => 'Pennad embannet', |
|
| 351 | - 'info_article_redaction' => 'Pennad emeur o skridaozañ', |
|
| 352 | - 'info_article_refuse' => 'Pennad nac’het', |
|
| 353 | - 'info_article_supprime' => 'Pennad diverket', |
|
| 354 | - 'info_articles' => 'Pennadoù', |
|
| 355 | - 'info_articles_a_valider' => 'Ar pennadoù da gadarnaat', |
|
| 356 | - 'info_articles_nb' => '@nb@ pennad-skrid', |
|
| 357 | - 'info_articles_proposes' => 'Pennadoù kinniget', |
|
| 358 | - 'info_articles_un' => '1 pennad', |
|
| 359 | - 'info_auteurs_nombre' => 'skridaozer(ien) :', |
|
| 360 | - 'info_authentification_ftp' => 'Gwiriañ (dre FTP).', |
|
| 361 | - 'info_breves_2' => 'berrskridoù', |
|
| 362 | - 'info_breves_nb' => '@nb@ pennadoù-berr', |
|
| 363 | - 'info_breves_un' => '1 pennadig', |
|
| 364 | - 'info_connexion_refusee' => 'Kevreañ nac’het', |
|
| 365 | - 'info_contact_developpeur' => 'Kit e darempred gant un diorroer.', |
|
| 366 | - 'info_contenance' => 'El lec’hienn-mañ ez eus :', |
|
| 367 | - 'info_contribution' => 'kenaozadurioù', |
|
| 368 | - 'info_copyright' => 'Ur meziant dieub eo @spip@, dasparzhet @lien_gpl@.', |
|
| 369 | - 'info_copyright_doc' => 'Evit titouroù ouzhpenn, gwelet al lec’hienn <a href="@spipnet@">@spipnet_affiche@</a>.', |
|
| 370 | - 'info_copyright_gpl' => 'dindan aotre implijout GPL', |
|
| 371 | - 'info_cours_edition' => 'Ar pennadoù emaoc’h o skrivañ', # MODIF |
|
| 372 | - 'info_creer_repertoire' => 'Krouit ur restr pe ur c’havlec’h anvet :', |
|
| 373 | - 'info_creer_repertoire_2' => 'en iskavlec’h <b>@repertoire@</b>, ha :', |
|
| 374 | - 'info_creer_vignette' => 'krouiñ emgefreek ar skeudennig', |
|
| 375 | - 'info_creerdansrubrique_non_autorise' => 'N’ho peus trawalc’h a wirioù evit krouiñ danvez er rubrikenn-mañ.', |
|
| 376 | - 'info_deplier' => 'Displegañ', |
|
| 377 | - 'info_descriptif_nombre' => 'deskrivadur(ioù) :', |
|
| 378 | - 'info_description' => 'Deskrivadur :', |
|
| 379 | - 'info_description_2' => 'Deskrivadur :', |
|
| 380 | - 'info_dimension' => 'Ment :', |
|
| 381 | - 'info_documents_nb' => '@nb@ diell', |
|
| 382 | - 'info_documents_un' => '1 diell', |
|
| 383 | - 'info_ecire_message_prive' => 'Skrivañ ur gerig prevez;', |
|
| 384 | - 'info_email_invalide' => 'Postel direizh.', |
|
| 385 | - 'info_en_cours_validation' => 'Ar pennadoù emaoc’h o skrivañ', |
|
| 386 | - 'info_en_ligne' => 'Enlinenn evit poent :', |
|
| 387 | - 'info_envoyer_message_prive' => 'Kas ur gerig prevez d’ar skridaozer-mañ', |
|
| 388 | - 'info_erreur_requete' => 'Fazi er reked :', |
|
| 389 | - 'info_erreur_squelette2' => 'N’eus framm <b>@fichier@</b> ebet da gaout...', |
|
| 390 | - 'info_erreur_systeme' => 'Fazi reizhiad (errno @errsys@)', |
|
| 391 | - 'info_erreur_systeme2' => 'Marteze eo leun-chouk ar bladenn-galet, pe neuze eo mazaouet an diaz titouroù.<br /> |
|
| 293 | + // I |
|
| 294 | + 'ical_texte_rss_articles' => 'D’ar chomlec’h-mañ emañ restr «backend» ar pennadoù :', |
|
| 295 | + 'ical_texte_rss_articles2' => 'Gallout a rit kaout restroù «backend» evit pennadoù pep rummad al lec’hienn ivez :', |
|
| 296 | + 'ical_texte_rss_breves' => 'Bez’ ez eus ivez ur restr enni berrskridoù al lec’hienn. Ma resisait niverenn ur rubrikenn, n’ho po nemet berrskridoù ar rubrikenn-se.', |
|
| 297 | + 'icone_a_suivre' => 'Da genderc’hel', |
|
| 298 | + 'icone_admin_site' => 'Merañ al lec’hienn', |
|
| 299 | + 'icone_agenda' => 'Deiziataer', |
|
| 300 | + 'icone_aide_ligne' => 'Skoazell', |
|
| 301 | + 'icone_articles' => 'Pennadoù', |
|
| 302 | + 'icone_auteurs' => 'Skridaozerien', |
|
| 303 | + 'icone_brouteur' => 'Merdeiñ prim', |
|
| 304 | + 'icone_configuration_site' => 'Kefluniañ ', |
|
| 305 | + 'icone_configurer_site' => 'Kefluniañ ho lec’hienn', |
|
| 306 | + 'icone_creer_nouvel_auteur' => 'Krouiñ ur skridaozer nevez', |
|
| 307 | + 'icone_creer_rubrique' => 'Krouiñ ur rubrikenn', |
|
| 308 | + 'icone_creer_sous_rubrique' => 'Krouiñ un isrubrikenn', |
|
| 309 | + 'icone_deconnecter' => 'Digevreañ', |
|
| 310 | + 'icone_discussions' => 'Kaozeadennoù', |
|
| 311 | + 'icone_doc_rubrique' => 'Teulioù ar rubrikennoù', |
|
| 312 | + 'icone_ecrire_article' => 'Skrivañ ur pennad nevez', |
|
| 313 | + 'icone_edition_site' => 'Embann', |
|
| 314 | + 'icone_gestion_langues' => 'Merañ ar yezhoù', |
|
| 315 | + 'icone_informations_personnelles' => 'Titouroù hiniennel', |
|
| 316 | + 'icone_interface_complet' => 'Etrefas klok', |
|
| 317 | + 'icone_interface_simple' => 'Etrefas eeunaet', |
|
| 318 | + 'icone_maintenance_site' => 'Ober war-dro al lec’hienn', |
|
| 319 | + 'icone_messagerie_personnelle' => 'Postelerezh hiniennel', |
|
| 320 | + 'icone_repartition_debut' => 'Diskouez an dasparzh abaoe an deroù', |
|
| 321 | + 'icone_rubriques' => 'Rubrikennoù', |
|
| 322 | + 'icone_sauver_site' => 'Saveteiñ al lec’hienn', |
|
| 323 | + 'icone_site_entier' => 'Al lec’hienn a-bezh', |
|
| 324 | + 'icone_sites_references' => 'Lec’hiennoù menegeret', |
|
| 325 | + 'icone_statistiques' => 'Stadegoù al lec’hienn', |
|
| 326 | + 'icone_suivi_activite' => 'Heuliañ buhez al lec’hienn', |
|
| 327 | + 'icone_suivi_actualite' => 'Emdroadur al lec’hienn', |
|
| 328 | + 'icone_suivi_pettions' => 'Heuliañ/merañ ar sinadegoù', |
|
| 329 | + 'icone_suivi_revisions' => 'Kemmoù ar pennadoù', |
|
| 330 | + 'icone_supprimer_document' => 'Diverkañ an teul-mañ', |
|
| 331 | + 'icone_supprimer_image' => 'Diverkañ ar skeudenn-mañ', |
|
| 332 | + 'icone_tous_articles' => 'Ho holl bennadoù', |
|
| 333 | + 'icone_tous_auteur' => 'An holl skridaozerien', |
|
| 334 | + 'icone_tous_visiteur' => 'An holl gweladerien', |
|
| 335 | + 'icone_visiter_site' => 'Gweladenniñ al lec’hienn foran', |
|
| 336 | + 'icone_voir_en_ligne' => 'Gwelet enlinenn', |
|
| 337 | + 'img_indisponible' => 'skeudenn dibosupl da gaout', |
|
| 338 | + 'impossible' => 'dibosupl', |
|
| 339 | + 'info_a_suivre' => 'DA GENDERC’HEL»', |
|
| 340 | + 'info_acces_interdit' => 'Difennet mont tre', |
|
| 341 | + 'info_acces_refuse' => 'Nac’het eo bet deoc’h mon tre', |
|
| 342 | + 'info_action' => 'Oberiadenn : @action@', |
|
| 343 | + 'info_administrer_rubriques' => 'Gallout a rit merañ ar rubrikenn-mañ hag an isrubrikenndoù enni', |
|
| 344 | + 'info_adresse_non_indiquee' => 'N’hoc’h eus ket lakaet chomlec’h ebet da arnodiñ !', |
|
| 345 | + 'info_aide' => 'SKOAZELL :', |
|
| 346 | + 'info_ajouter_mot' => 'Ouzhpennañ ar ger-mañ', |
|
| 347 | + 'info_annonce' => 'KEMENN', |
|
| 348 | + 'info_annonces_generales' => 'Kemennoù hollek :', |
|
| 349 | + 'info_article_propose' => 'Pennad kinniget', |
|
| 350 | + 'info_article_publie' => 'Pennad embannet', |
|
| 351 | + 'info_article_redaction' => 'Pennad emeur o skridaozañ', |
|
| 352 | + 'info_article_refuse' => 'Pennad nac’het', |
|
| 353 | + 'info_article_supprime' => 'Pennad diverket', |
|
| 354 | + 'info_articles' => 'Pennadoù', |
|
| 355 | + 'info_articles_a_valider' => 'Ar pennadoù da gadarnaat', |
|
| 356 | + 'info_articles_nb' => '@nb@ pennad-skrid', |
|
| 357 | + 'info_articles_proposes' => 'Pennadoù kinniget', |
|
| 358 | + 'info_articles_un' => '1 pennad', |
|
| 359 | + 'info_auteurs_nombre' => 'skridaozer(ien) :', |
|
| 360 | + 'info_authentification_ftp' => 'Gwiriañ (dre FTP).', |
|
| 361 | + 'info_breves_2' => 'berrskridoù', |
|
| 362 | + 'info_breves_nb' => '@nb@ pennadoù-berr', |
|
| 363 | + 'info_breves_un' => '1 pennadig', |
|
| 364 | + 'info_connexion_refusee' => 'Kevreañ nac’het', |
|
| 365 | + 'info_contact_developpeur' => 'Kit e darempred gant un diorroer.', |
|
| 366 | + 'info_contenance' => 'El lec’hienn-mañ ez eus :', |
|
| 367 | + 'info_contribution' => 'kenaozadurioù', |
|
| 368 | + 'info_copyright' => 'Ur meziant dieub eo @spip@, dasparzhet @lien_gpl@.', |
|
| 369 | + 'info_copyright_doc' => 'Evit titouroù ouzhpenn, gwelet al lec’hienn <a href="@spipnet@">@spipnet_affiche@</a>.', |
|
| 370 | + 'info_copyright_gpl' => 'dindan aotre implijout GPL', |
|
| 371 | + 'info_cours_edition' => 'Ar pennadoù emaoc’h o skrivañ', # MODIF |
|
| 372 | + 'info_creer_repertoire' => 'Krouit ur restr pe ur c’havlec’h anvet :', |
|
| 373 | + 'info_creer_repertoire_2' => 'en iskavlec’h <b>@repertoire@</b>, ha :', |
|
| 374 | + 'info_creer_vignette' => 'krouiñ emgefreek ar skeudennig', |
|
| 375 | + 'info_creerdansrubrique_non_autorise' => 'N’ho peus trawalc’h a wirioù evit krouiñ danvez er rubrikenn-mañ.', |
|
| 376 | + 'info_deplier' => 'Displegañ', |
|
| 377 | + 'info_descriptif_nombre' => 'deskrivadur(ioù) :', |
|
| 378 | + 'info_description' => 'Deskrivadur :', |
|
| 379 | + 'info_description_2' => 'Deskrivadur :', |
|
| 380 | + 'info_dimension' => 'Ment :', |
|
| 381 | + 'info_documents_nb' => '@nb@ diell', |
|
| 382 | + 'info_documents_un' => '1 diell', |
|
| 383 | + 'info_ecire_message_prive' => 'Skrivañ ur gerig prevez;', |
|
| 384 | + 'info_email_invalide' => 'Postel direizh.', |
|
| 385 | + 'info_en_cours_validation' => 'Ar pennadoù emaoc’h o skrivañ', |
|
| 386 | + 'info_en_ligne' => 'Enlinenn evit poent :', |
|
| 387 | + 'info_envoyer_message_prive' => 'Kas ur gerig prevez d’ar skridaozer-mañ', |
|
| 388 | + 'info_erreur_requete' => 'Fazi er reked :', |
|
| 389 | + 'info_erreur_squelette2' => 'N’eus framm <b>@fichier@</b> ebet da gaout...', |
|
| 390 | + 'info_erreur_systeme' => 'Fazi reizhiad (errno @errsys@)', |
|
| 391 | + 'info_erreur_systeme2' => 'Marteze eo leun-chouk ar bladenn-galet, pe neuze eo mazaouet an diaz titouroù.<br /> |
|
| 392 | 392 | <span style="color:red;">Klaskit <a href=\'@script@\'>ratreañ an diaz</a>, pe kit e darempred gant an herberc’hier.</span>', |
| 393 | - 'info_fini' => 'Echu eo !', |
|
| 394 | - 'info_format_image' => 'Furmadoù skeudenn a c’hell bezañ implijet da sevel skeudennigoù : @gd_formats@.', |
|
| 395 | - 'info_format_non_defini' => 'Stumm didermenet', |
|
| 396 | - 'info_grand_ecran' => 'Skramm bras', |
|
| 397 | - 'info_image_aide' => 'SKOAZELL', |
|
| 398 | - 'info_image_process_titre' => 'Hentenn da grouiñ skeudennigoù', |
|
| 399 | - 'info_impossible_lire_page' => '<b>Fazi !</b> Dibosupl eo lenn ar bajenn <tt><html>@test_proxy@</html></tt> dre ar proksi', |
|
| 400 | - 'info_installation_systeme_publication' => 'O staliañ ar reizhiad embann...', |
|
| 401 | - 'info_installer_documents' => 'Gallout a rit staliañ en un doare emgefreek an holl deulioù zo en teuliad @upload@.', |
|
| 402 | - 'info_installer_ftp' => 'Dre ma’z oc’h merour e c’hellit staliañ restroù (dre FTP) en teuliad @upload@ deoc’h da c’hallout ober ganto amañ da c’houde.', |
|
| 403 | - 'info_installer_images' => 'Er furmadoù JPEG, GIF ha PNG e c’hellit staliañ skeudennoù.', |
|
| 404 | - 'info_installer_images_dossier' => 'Staliañ skeudennoù en teuliad @upload@ evit gallout o diuzañ amañ.', |
|
| 405 | - 'info_interface_complete' => 'Etrefas klok', |
|
| 406 | - 'info_interface_simple' => 'Etrefas eeunaet', |
|
| 407 | - 'info_joindre_document_article' => 'Teulioù a eurt-se a c’hellit stagañ ouzh ar pennad-mañ :', |
|
| 408 | - 'info_joindre_document_rubrique' => 'Teulioù a seurt-se a c’hellit stagañ ouzh ar rubrikenn-mañ :', |
|
| 409 | - 'info_joindre_documents_article' => 'Teulioù a seurt-se a c’hellit stagañ ouzh ho pennad :', |
|
| 410 | - 'info_l_article' => 'ar pennad', |
|
| 411 | - 'info_la_breve' => 'ar berrskrid', |
|
| 412 | - 'info_la_rubrique' => 'ar rubrikenn', |
|
| 413 | - 'info_langue_principale' => 'Yezh pennañ al lec’hienn', |
|
| 414 | - 'info_largeur_vignette' => '@largeur_vignette@ × @hauteur_vignette@ piksel', |
|
| 415 | - 'info_les_auteurs_1' => 'gant @les_auteurs@', |
|
| 416 | - 'info_logo_format_interdit' => 'Er furmad @formats@ hepken e vez aotreet al logoioù.', |
|
| 417 | - 'info_logo_max_poids' => 'Nebeutoc’h eget @maxi@ e rank al logoioù bezañ (@actuel@ eo ar restr-mañ).', |
|
| 418 | - 'info_mail_fournisseur' => 'hoc’hanv@herberc’hier.com', |
|
| 419 | - 'info_message_2' => 'KEMENNADENN', |
|
| 420 | - 'info_message_supprime' => 'KEMENNADENN BET DIVERKET', |
|
| 421 | - 'info_messages_nb' => '@nb@ kemennadennoù', |
|
| 422 | - 'info_messages_un' => '1 gemennadenn', |
|
| 423 | - 'info_mise_en_ligne' => 'Lakaet war ar rouedad d’an :', |
|
| 424 | - 'info_modification_parametres_securite' => 'kemm an arventennoù surentez', |
|
| 425 | - 'info_mois_courant' => 'E-kerzh ar miz :', |
|
| 426 | - 'info_mot_cle_ajoute' => 'Ar ger-stur-mañ zo bet ouzhpennet', |
|
| 427 | - 'info_multi_herit' => 'Yezh dre ziouer', |
|
| 428 | - 'info_multi_langues_soulignees' => 'Ar <u>yezhoù islinennet</u> zo bet troet holl destennoù an etrefas enne. Ma tibabit ar yezhoù-se e vo troet ul lodenn vat eus elfennoù al lec’hienn (deiziadoù, furmskridoù, hag all) en un doare otomatek. Evit ar yezhoù n’int ket islinennet e vo an elfennoù-se e yezh pennañ al lec’hienn.', |
|
| 429 | - 'info_multilinguisme' => 'Liesyezhegezh', |
|
| 430 | - 'info_nom_non_utilisateurs_connectes' => 'N’emañ ket hoc’h anv war roll an implijerien kevreet.', |
|
| 431 | - 'info_nom_utilisateurs_connectes' => 'Gwelet e vez hoc’h anv war roll an implijerien kevreet.', |
|
| 432 | - 'info_nombre_en_ligne' => 'Bremañ war al lec’hienn :', |
|
| 433 | - 'info_non_resultat' => 'Disoc’h ebet evit "@cherche_mot@"', |
|
| 434 | - 'info_non_utilisation_messagerie' => 'N’implijit ket postelerezh diabarzh al lec’hienn-mañ.', |
|
| 435 | - 'info_nouveau_message' => 'UR GEMENNADENN NEVEZ HOC’H EUS BET', |
|
| 436 | - 'info_nouveaux_messages' => '@total_messages@ KEMENNADENN NEVEZ HOC’H EUS BET', |
|
| 437 | - 'info_numero_abbreviation' => 'Niv. ', |
|
| 438 | - 'info_obligatoire' => 'Ret eo deoc’h reiñ an titour-mañ', |
|
| 439 | - 'info_pense_bete' => 'NOTENNIG-EÑVOR', |
|
| 440 | - 'info_petit_ecran' => 'Skramm bihan', |
|
| 441 | - 'info_petition_close' => 'Kloz eo ar sinadeg', |
|
| 442 | - 'info_pixels' => 'piksel', |
|
| 443 | - 'info_plusieurs_mots_trouves' => 'Meur a c’her-stur zo bet kavet evit "@cherche_mot@":', |
|
| 444 | - 'info_portfolio_automatique' => 'Portfolio emgefre :', |
|
| 445 | - 'info_premier_resultat' => '[@debut_limit@ disoc’h kentañ diwar @total@]', |
|
| 446 | - 'info_premier_resultat_sur' => '[@debut_limit@ disoc’h kentañ diwar @total@]', |
|
| 447 | - 'info_propose_1' => '[@nom_site_spip@] a ginnig : @titre@', |
|
| 448 | - 'info_propose_2' => 'Pennad bet kinniget |
|
| 393 | + 'info_fini' => 'Echu eo !', |
|
| 394 | + 'info_format_image' => 'Furmadoù skeudenn a c’hell bezañ implijet da sevel skeudennigoù : @gd_formats@.', |
|
| 395 | + 'info_format_non_defini' => 'Stumm didermenet', |
|
| 396 | + 'info_grand_ecran' => 'Skramm bras', |
|
| 397 | + 'info_image_aide' => 'SKOAZELL', |
|
| 398 | + 'info_image_process_titre' => 'Hentenn da grouiñ skeudennigoù', |
|
| 399 | + 'info_impossible_lire_page' => '<b>Fazi !</b> Dibosupl eo lenn ar bajenn <tt><html>@test_proxy@</html></tt> dre ar proksi', |
|
| 400 | + 'info_installation_systeme_publication' => 'O staliañ ar reizhiad embann...', |
|
| 401 | + 'info_installer_documents' => 'Gallout a rit staliañ en un doare emgefreek an holl deulioù zo en teuliad @upload@.', |
|
| 402 | + 'info_installer_ftp' => 'Dre ma’z oc’h merour e c’hellit staliañ restroù (dre FTP) en teuliad @upload@ deoc’h da c’hallout ober ganto amañ da c’houde.', |
|
| 403 | + 'info_installer_images' => 'Er furmadoù JPEG, GIF ha PNG e c’hellit staliañ skeudennoù.', |
|
| 404 | + 'info_installer_images_dossier' => 'Staliañ skeudennoù en teuliad @upload@ evit gallout o diuzañ amañ.', |
|
| 405 | + 'info_interface_complete' => 'Etrefas klok', |
|
| 406 | + 'info_interface_simple' => 'Etrefas eeunaet', |
|
| 407 | + 'info_joindre_document_article' => 'Teulioù a eurt-se a c’hellit stagañ ouzh ar pennad-mañ :', |
|
| 408 | + 'info_joindre_document_rubrique' => 'Teulioù a seurt-se a c’hellit stagañ ouzh ar rubrikenn-mañ :', |
|
| 409 | + 'info_joindre_documents_article' => 'Teulioù a seurt-se a c’hellit stagañ ouzh ho pennad :', |
|
| 410 | + 'info_l_article' => 'ar pennad', |
|
| 411 | + 'info_la_breve' => 'ar berrskrid', |
|
| 412 | + 'info_la_rubrique' => 'ar rubrikenn', |
|
| 413 | + 'info_langue_principale' => 'Yezh pennañ al lec’hienn', |
|
| 414 | + 'info_largeur_vignette' => '@largeur_vignette@ × @hauteur_vignette@ piksel', |
|
| 415 | + 'info_les_auteurs_1' => 'gant @les_auteurs@', |
|
| 416 | + 'info_logo_format_interdit' => 'Er furmad @formats@ hepken e vez aotreet al logoioù.', |
|
| 417 | + 'info_logo_max_poids' => 'Nebeutoc’h eget @maxi@ e rank al logoioù bezañ (@actuel@ eo ar restr-mañ).', |
|
| 418 | + 'info_mail_fournisseur' => 'hoc’hanv@herberc’hier.com', |
|
| 419 | + 'info_message_2' => 'KEMENNADENN', |
|
| 420 | + 'info_message_supprime' => 'KEMENNADENN BET DIVERKET', |
|
| 421 | + 'info_messages_nb' => '@nb@ kemennadennoù', |
|
| 422 | + 'info_messages_un' => '1 gemennadenn', |
|
| 423 | + 'info_mise_en_ligne' => 'Lakaet war ar rouedad d’an :', |
|
| 424 | + 'info_modification_parametres_securite' => 'kemm an arventennoù surentez', |
|
| 425 | + 'info_mois_courant' => 'E-kerzh ar miz :', |
|
| 426 | + 'info_mot_cle_ajoute' => 'Ar ger-stur-mañ zo bet ouzhpennet', |
|
| 427 | + 'info_multi_herit' => 'Yezh dre ziouer', |
|
| 428 | + 'info_multi_langues_soulignees' => 'Ar <u>yezhoù islinennet</u> zo bet troet holl destennoù an etrefas enne. Ma tibabit ar yezhoù-se e vo troet ul lodenn vat eus elfennoù al lec’hienn (deiziadoù, furmskridoù, hag all) en un doare otomatek. Evit ar yezhoù n’int ket islinennet e vo an elfennoù-se e yezh pennañ al lec’hienn.', |
|
| 429 | + 'info_multilinguisme' => 'Liesyezhegezh', |
|
| 430 | + 'info_nom_non_utilisateurs_connectes' => 'N’emañ ket hoc’h anv war roll an implijerien kevreet.', |
|
| 431 | + 'info_nom_utilisateurs_connectes' => 'Gwelet e vez hoc’h anv war roll an implijerien kevreet.', |
|
| 432 | + 'info_nombre_en_ligne' => 'Bremañ war al lec’hienn :', |
|
| 433 | + 'info_non_resultat' => 'Disoc’h ebet evit "@cherche_mot@"', |
|
| 434 | + 'info_non_utilisation_messagerie' => 'N’implijit ket postelerezh diabarzh al lec’hienn-mañ.', |
|
| 435 | + 'info_nouveau_message' => 'UR GEMENNADENN NEVEZ HOC’H EUS BET', |
|
| 436 | + 'info_nouveaux_messages' => '@total_messages@ KEMENNADENN NEVEZ HOC’H EUS BET', |
|
| 437 | + 'info_numero_abbreviation' => 'Niv. ', |
|
| 438 | + 'info_obligatoire' => 'Ret eo deoc’h reiñ an titour-mañ', |
|
| 439 | + 'info_pense_bete' => 'NOTENNIG-EÑVOR', |
|
| 440 | + 'info_petit_ecran' => 'Skramm bihan', |
|
| 441 | + 'info_petition_close' => 'Kloz eo ar sinadeg', |
|
| 442 | + 'info_pixels' => 'piksel', |
|
| 443 | + 'info_plusieurs_mots_trouves' => 'Meur a c’her-stur zo bet kavet evit "@cherche_mot@":', |
|
| 444 | + 'info_portfolio_automatique' => 'Portfolio emgefre :', |
|
| 445 | + 'info_premier_resultat' => '[@debut_limit@ disoc’h kentañ diwar @total@]', |
|
| 446 | + 'info_premier_resultat_sur' => '[@debut_limit@ disoc’h kentañ diwar @total@]', |
|
| 447 | + 'info_propose_1' => '[@nom_site_spip@] a ginnig : @titre@', |
|
| 448 | + 'info_propose_2' => 'Pennad bet kinniget |
|
| 449 | 449 | ---------------', |
| 450 | - 'info_propose_3' => 'Kinnig a reer embann ar pennad "@titre@".', |
|
| 451 | - 'info_propose_4' => 'Pedet oc’h da zont d’e lenn ha da reiñ hoc’h ali', |
|
| 452 | - 'info_propose_5' => 'er forom stag outañ. Kavet e vo er chomlec’h-mañ :', |
|
| 453 | - 'info_publie_01' => 'Kadarnaet eo bet ar pennad "@titre@" gant @connect_nom@.', |
|
| 454 | - 'info_publie_1' => '[@nom_site_spip@] A EMBANN : @titre@', |
|
| 455 | - 'info_publie_2' => 'Pennad embannet |
|
| 450 | + 'info_propose_3' => 'Kinnig a reer embann ar pennad "@titre@".', |
|
| 451 | + 'info_propose_4' => 'Pedet oc’h da zont d’e lenn ha da reiñ hoc’h ali', |
|
| 452 | + 'info_propose_5' => 'er forom stag outañ. Kavet e vo er chomlec’h-mañ :', |
|
| 453 | + 'info_publie_01' => 'Kadarnaet eo bet ar pennad "@titre@" gant @connect_nom@.', |
|
| 454 | + 'info_publie_1' => '[@nom_site_spip@] A EMBANN : @titre@', |
|
| 455 | + 'info_publie_2' => 'Pennad embannet |
|
| 456 | 456 | --------------', |
| 457 | - 'info_rechercher' => 'Klask', |
|
| 458 | - 'info_rechercher_02' => 'Klask :', |
|
| 459 | - 'info_remplacer_vignette' => 'Erlec’hiañ ar skeudennig dre ziouer gant ul logo deoc’h :', |
|
| 460 | - 'info_rubriques_nb' => '@nb@ rubrikenn', |
|
| 461 | - 'info_rubriques_un' => '1 rubrikenn', |
|
| 462 | - 'info_sans_titre_2' => 'titl ebet', |
|
| 463 | - 'info_selectionner_fichier' => 'Gallout a rit diuzañ ur restr eus an teuliad @upload@', |
|
| 464 | - 'info_selectionner_fichier_2' => 'Diuzañ ur restr :', |
|
| 465 | - 'info_sites_nb' => '@nb@ lec’hienn', |
|
| 466 | - 'info_sites_un' => '1 lec’hienn', |
|
| 467 | - 'info_supprimer_vignette' => 'diverkañ ar skeudennig', |
|
| 468 | - 'info_symbole_bleu' => 'Talvezout a ra an arouez <b>glas</b> evit un <b>notennig-eñvor</b>: da lavaret eo ur gemennadenn evidoc’h hepken.', |
|
| 469 | - 'info_symbole_jaune' => 'Talvezout a ra an arouez <b>melen</b> evit ur <b>c’hemenn d’an holl skridaozerien</b> : a c’hell bezañ kemmet gant ur merour ha lennet gant an holl skridaozerien.', |
|
| 470 | - 'info_symbole_vert' => 'Talvezout a ra an arouez <b>gwer</b> evit ar <b>c’hemennadennoù bet eskemmet etre implijerien all</b> al lec’hienn.', |
|
| 471 | - 'info_telecharger_nouveau_logo' => 'Pellgargañ ul logo nevez :', |
|
| 472 | - 'info_telecharger_ordinateur' => 'Pellgargañ adal hoc’h urzhiataer :', |
|
| 473 | - 'info_tous_resultats_enregistres' => '[enrollet e vez an holl discoc’hoù]', |
|
| 474 | - 'info_tout_afficher' => 'Diskouez pep tra', |
|
| 475 | - 'info_travaux_texte' => 'N’eo ket bet kefluniet al lec’hienn evit c’hoazh. Distroit a-benn nebeut...', |
|
| 476 | - 'info_travaux_titre' => 'Emeur o sevel al lec’hienn', |
|
| 477 | - 'info_trop_resultat' => 'Re a zisoc’hoù evit "@cherche_mot@"; resisait termenoù hoc’h enklask mar plij.', |
|
| 478 | - 'info_utilisation_messagerie_interne' => 'Ober a rit gant postelerezh diabarzh al lec’hienn-mañ.', |
|
| 479 | - 'info_valider_lien' => 'kadarnaat al liamm-mañ', |
|
| 480 | - 'info_verifier_image' => 'gwiriit eo bet treuzkaset mat ho skeudennoù.', |
|
| 481 | - 'info_vignette_defaut' => 'Skeudennig dre ziouer', |
|
| 482 | - 'info_vignette_personnalisee' => 'skeudennig personelaet', |
|
| 483 | - 'info_visite' => 'gweladenn :', |
|
| 484 | - 'info_vos_rendez_vous' => 'Hoc’h emgavioù da zont', |
|
| 485 | - 'infos_vos_pense_bete' => 'Ho notennigoù-eñvor', |
|
| 457 | + 'info_rechercher' => 'Klask', |
|
| 458 | + 'info_rechercher_02' => 'Klask :', |
|
| 459 | + 'info_remplacer_vignette' => 'Erlec’hiañ ar skeudennig dre ziouer gant ul logo deoc’h :', |
|
| 460 | + 'info_rubriques_nb' => '@nb@ rubrikenn', |
|
| 461 | + 'info_rubriques_un' => '1 rubrikenn', |
|
| 462 | + 'info_sans_titre_2' => 'titl ebet', |
|
| 463 | + 'info_selectionner_fichier' => 'Gallout a rit diuzañ ur restr eus an teuliad @upload@', |
|
| 464 | + 'info_selectionner_fichier_2' => 'Diuzañ ur restr :', |
|
| 465 | + 'info_sites_nb' => '@nb@ lec’hienn', |
|
| 466 | + 'info_sites_un' => '1 lec’hienn', |
|
| 467 | + 'info_supprimer_vignette' => 'diverkañ ar skeudennig', |
|
| 468 | + 'info_symbole_bleu' => 'Talvezout a ra an arouez <b>glas</b> evit un <b>notennig-eñvor</b>: da lavaret eo ur gemennadenn evidoc’h hepken.', |
|
| 469 | + 'info_symbole_jaune' => 'Talvezout a ra an arouez <b>melen</b> evit ur <b>c’hemenn d’an holl skridaozerien</b> : a c’hell bezañ kemmet gant ur merour ha lennet gant an holl skridaozerien.', |
|
| 470 | + 'info_symbole_vert' => 'Talvezout a ra an arouez <b>gwer</b> evit ar <b>c’hemennadennoù bet eskemmet etre implijerien all</b> al lec’hienn.', |
|
| 471 | + 'info_telecharger_nouveau_logo' => 'Pellgargañ ul logo nevez :', |
|
| 472 | + 'info_telecharger_ordinateur' => 'Pellgargañ adal hoc’h urzhiataer :', |
|
| 473 | + 'info_tous_resultats_enregistres' => '[enrollet e vez an holl discoc’hoù]', |
|
| 474 | + 'info_tout_afficher' => 'Diskouez pep tra', |
|
| 475 | + 'info_travaux_texte' => 'N’eo ket bet kefluniet al lec’hienn evit c’hoazh. Distroit a-benn nebeut...', |
|
| 476 | + 'info_travaux_titre' => 'Emeur o sevel al lec’hienn', |
|
| 477 | + 'info_trop_resultat' => 'Re a zisoc’hoù evit "@cherche_mot@"; resisait termenoù hoc’h enklask mar plij.', |
|
| 478 | + 'info_utilisation_messagerie_interne' => 'Ober a rit gant postelerezh diabarzh al lec’hienn-mañ.', |
|
| 479 | + 'info_valider_lien' => 'kadarnaat al liamm-mañ', |
|
| 480 | + 'info_verifier_image' => 'gwiriit eo bet treuzkaset mat ho skeudennoù.', |
|
| 481 | + 'info_vignette_defaut' => 'Skeudennig dre ziouer', |
|
| 482 | + 'info_vignette_personnalisee' => 'skeudennig personelaet', |
|
| 483 | + 'info_visite' => 'gweladenn :', |
|
| 484 | + 'info_vos_rendez_vous' => 'Hoc’h emgavioù da zont', |
|
| 485 | + 'infos_vos_pense_bete' => 'Ho notennigoù-eñvor', |
|
| 486 | 486 | |
| 487 | - // L |
|
| 488 | - 'label_ajout_id_rapide' => 'Ouzhpennet buan', |
|
| 489 | - 'label_poids_fichier' => 'Ment', |
|
| 490 | - 'lien_afficher_icones_seuls' => 'Diskouez ar skeudennigoù hepken', |
|
| 491 | - 'lien_afficher_texte_icones' => 'Diskouez ar skeudennigoù hag an destenn', |
|
| 492 | - 'lien_afficher_texte_seul' => 'Diskouez an destenn hepken', |
|
| 493 | - 'lien_liberer' => 'dieubiñ', |
|
| 494 | - 'lien_liberer_tous' => 'Dinaskañ an holl', |
|
| 495 | - 'lien_nouvea_pense_bete' => 'NOTENNIG-EÑVOR NEVEZ', |
|
| 496 | - 'lien_nouveau_message' => 'KEMENNADENN NEVEZ', |
|
| 497 | - 'lien_nouvelle_annonce' => 'KEMENN NEVEZ', |
|
| 498 | - 'lien_petitions' => 'SINADEG', |
|
| 499 | - 'lien_popularite' => 'brud : @popularite@%', |
|
| 500 | - 'lien_racine_site' => 'GWRIZIENN AL LEC’HIENN', |
|
| 501 | - 'lien_reessayer' => 'klask en-dro', |
|
| 502 | - 'lien_repondre_message' => 'Repont d’ar gemennadenn-mañ', |
|
| 503 | - 'lien_supprimer' => 'diverkañ', |
|
| 504 | - 'lien_tout_afficher' => 'Diskouez pep tra', |
|
| 505 | - 'lien_visite_site' => 'gweladenniñ al lec’hienn-mañ', |
|
| 506 | - 'lien_visites' => '@visites@ gweladenn', |
|
| 507 | - 'lien_voir_auteur' => 'Gwelet ar skridaozer-mañ', |
|
| 508 | - 'ligne' => 'Linenn', |
|
| 509 | - 'login' => 'Kevreañ', |
|
| 510 | - 'login_acces_prive' => 'tizhout al lodenn brevez', |
|
| 511 | - 'login_autre_identifiant' => 'Kevreañ gant ur c’hod anaout all', |
|
| 512 | - 'login_cookie_accepte' => 'Grit ar pezh zo ezhomm evit ma vint degemeret gant ho merdeer, evit al lec’hienn-mañ d’an nebeutañ', |
|
| 513 | - 'login_cookie_oblige' => 'Evit kevreañ en un doare sur war al lec’hienn-mañ e rankit degemer an toupinoù.', |
|
| 514 | - 'login_deconnexion_ok' => 'Digevreet oc’h.', |
|
| 515 | - 'login_erreur_pass' => 'Fazi ger-tremen.', |
|
| 516 | - 'login_espace_prive' => 'lodenn brevez', |
|
| 517 | - 'login_identifiant_inconnu' => 'N’eo ket anavezet ar c’hoad anaout « @login@ ».', |
|
| 518 | - 'login_login' => 'Kod kevreañ :', |
|
| 519 | - 'login_login2' => 'Login pe postel :', |
|
| 520 | - 'login_login_pass_incorrect' => '(direizh eo ar c’hod kevreañ pe ar ger-tremen)', |
|
| 521 | - 'login_motpasseoublie' => 'ankouaet ho ker-tremen ganeoc’h ?', |
|
| 522 | - 'login_non_securise' => 'Diwallit, n’eo ket suraet ar furmskrid-mañ. |
|
| 487 | + // L |
|
| 488 | + 'label_ajout_id_rapide' => 'Ouzhpennet buan', |
|
| 489 | + 'label_poids_fichier' => 'Ment', |
|
| 490 | + 'lien_afficher_icones_seuls' => 'Diskouez ar skeudennigoù hepken', |
|
| 491 | + 'lien_afficher_texte_icones' => 'Diskouez ar skeudennigoù hag an destenn', |
|
| 492 | + 'lien_afficher_texte_seul' => 'Diskouez an destenn hepken', |
|
| 493 | + 'lien_liberer' => 'dieubiñ', |
|
| 494 | + 'lien_liberer_tous' => 'Dinaskañ an holl', |
|
| 495 | + 'lien_nouvea_pense_bete' => 'NOTENNIG-EÑVOR NEVEZ', |
|
| 496 | + 'lien_nouveau_message' => 'KEMENNADENN NEVEZ', |
|
| 497 | + 'lien_nouvelle_annonce' => 'KEMENN NEVEZ', |
|
| 498 | + 'lien_petitions' => 'SINADEG', |
|
| 499 | + 'lien_popularite' => 'brud : @popularite@%', |
|
| 500 | + 'lien_racine_site' => 'GWRIZIENN AL LEC’HIENN', |
|
| 501 | + 'lien_reessayer' => 'klask en-dro', |
|
| 502 | + 'lien_repondre_message' => 'Repont d’ar gemennadenn-mañ', |
|
| 503 | + 'lien_supprimer' => 'diverkañ', |
|
| 504 | + 'lien_tout_afficher' => 'Diskouez pep tra', |
|
| 505 | + 'lien_visite_site' => 'gweladenniñ al lec’hienn-mañ', |
|
| 506 | + 'lien_visites' => '@visites@ gweladenn', |
|
| 507 | + 'lien_voir_auteur' => 'Gwelet ar skridaozer-mañ', |
|
| 508 | + 'ligne' => 'Linenn', |
|
| 509 | + 'login' => 'Kevreañ', |
|
| 510 | + 'login_acces_prive' => 'tizhout al lodenn brevez', |
|
| 511 | + 'login_autre_identifiant' => 'Kevreañ gant ur c’hod anaout all', |
|
| 512 | + 'login_cookie_accepte' => 'Grit ar pezh zo ezhomm evit ma vint degemeret gant ho merdeer, evit al lec’hienn-mañ d’an nebeutañ', |
|
| 513 | + 'login_cookie_oblige' => 'Evit kevreañ en un doare sur war al lec’hienn-mañ e rankit degemer an toupinoù.', |
|
| 514 | + 'login_deconnexion_ok' => 'Digevreet oc’h.', |
|
| 515 | + 'login_erreur_pass' => 'Fazi ger-tremen.', |
|
| 516 | + 'login_espace_prive' => 'lodenn brevez', |
|
| 517 | + 'login_identifiant_inconnu' => 'N’eo ket anavezet ar c’hoad anaout « @login@ ».', |
|
| 518 | + 'login_login' => 'Kod kevreañ :', |
|
| 519 | + 'login_login2' => 'Login pe postel :', |
|
| 520 | + 'login_login_pass_incorrect' => '(direizh eo ar c’hod kevreañ pe ar ger-tremen)', |
|
| 521 | + 'login_motpasseoublie' => 'ankouaet ho ker-tremen ganeoc’h ?', |
|
| 522 | + 'login_non_securise' => 'Diwallit, n’eo ket suraet ar furmskrid-mañ. |
|
| 523 | 523 | Ma ne fell ket deoc’h e c’hellfe ho ker-tremen bezañ pesketet |
| 524 | 524 | war ar rouedad, gweredekait Javascript en ho merdeer ha', |
| 525 | - 'login_nouvelle_tentative' => 'Klask en-dro', |
|
| 526 | - 'login_par_ici' => 'Enrollet oc’h...dre amañ...', |
|
| 527 | - 'login_pass2' => 'Ger-tremen :', |
|
| 528 | - 'login_preferez_refuser' => '<b>Ma kavit gwell nac’hañ an toupinoù</b>, e c’hellit ober gant un doare all da gevreañ, met n’eo ket ken asur :', |
|
| 529 | - 'login_recharger' => 'adkargañ ar bajenn-mañ', |
|
| 530 | - 'login_rester_identifie' => 'Chom anavezet un nebeud devezhioù', # MODIF |
|
| 531 | - 'login_retour_public' => 'Distreiñ d’al lodenn foran', |
|
| 532 | - 'login_retour_site' => 'Distreiñ d’al lodenn foran', |
|
| 533 | - 'login_retoursitepublic' => 'distreiñ d’al lodenn foran', |
|
| 534 | - 'login_sans_cookie' => 'Kevreañ hep toupinoù', |
|
| 535 | - 'login_securise' => 'Login diogelet', |
|
| 536 | - 'login_sinscrire' => 'en em enskrivañ', |
|
| 537 | - 'login_test_navigateur' => 'taol-arnod merdeer/adkevreañ', |
|
| 538 | - 'login_verifiez_navigateur' => '(Gwiriit memes tra n’eo ket bet memoret ho ker-tremen gant ar merdeer...)', |
|
| 525 | + 'login_nouvelle_tentative' => 'Klask en-dro', |
|
| 526 | + 'login_par_ici' => 'Enrollet oc’h...dre amañ...', |
|
| 527 | + 'login_pass2' => 'Ger-tremen :', |
|
| 528 | + 'login_preferez_refuser' => '<b>Ma kavit gwell nac’hañ an toupinoù</b>, e c’hellit ober gant un doare all da gevreañ, met n’eo ket ken asur :', |
|
| 529 | + 'login_recharger' => 'adkargañ ar bajenn-mañ', |
|
| 530 | + 'login_rester_identifie' => 'Chom anavezet un nebeud devezhioù', # MODIF |
|
| 531 | + 'login_retour_public' => 'Distreiñ d’al lodenn foran', |
|
| 532 | + 'login_retour_site' => 'Distreiñ d’al lodenn foran', |
|
| 533 | + 'login_retoursitepublic' => 'distreiñ d’al lodenn foran', |
|
| 534 | + 'login_sans_cookie' => 'Kevreañ hep toupinoù', |
|
| 535 | + 'login_securise' => 'Login diogelet', |
|
| 536 | + 'login_sinscrire' => 'en em enskrivañ', |
|
| 537 | + 'login_test_navigateur' => 'taol-arnod merdeer/adkevreañ', |
|
| 538 | + 'login_verifiez_navigateur' => '(Gwiriit memes tra n’eo ket bet memoret ho ker-tremen gant ar merdeer...)', |
|
| 539 | 539 | |
| 540 | - // M |
|
| 541 | - 'masquer_colonne' => 'Kuzhat ar bann-mañ', |
|
| 542 | - 'masquer_trad' => 'kuzhat an troidigezhioù', |
|
| 543 | - 'message_nouveaux_identifiants_echec' => 'N’heller ket krouiñ anvioù implijer nevez.', |
|
| 544 | - 'message_nouveaux_identifiants_echec_envoi' => 'N’eo ket bet kaset an anvioù implijer nevez evit kevreañ.', |
|
| 545 | - 'message_nouveaux_identifiants_ok' => 'Kaset eo bet an anvioù implijer nevez evit kevreañ da @email@.', |
|
| 546 | - 'module_fichiers_langues' => 'Restroù yezh', |
|
| 540 | + // M |
|
| 541 | + 'masquer_colonne' => 'Kuzhat ar bann-mañ', |
|
| 542 | + 'masquer_trad' => 'kuzhat an troidigezhioù', |
|
| 543 | + 'message_nouveaux_identifiants_echec' => 'N’heller ket krouiñ anvioù implijer nevez.', |
|
| 544 | + 'message_nouveaux_identifiants_echec_envoi' => 'N’eo ket bet kaset an anvioù implijer nevez evit kevreañ.', |
|
| 545 | + 'message_nouveaux_identifiants_ok' => 'Kaset eo bet an anvioù implijer nevez evit kevreañ da @email@.', |
|
| 546 | + 'module_fichiers_langues' => 'Restroù yezh', |
|
| 547 | 547 | |
| 548 | - // N |
|
| 549 | - 'navigateur_pas_redirige' => 'Klikit amañ evit kederc’hel ma ne vez ket adheñchet ho merdeer.', |
|
| 550 | - 'numero' => 'Niverenn', |
|
| 548 | + // N |
|
| 549 | + 'navigateur_pas_redirige' => 'Klikit amañ evit kederc’hel ma ne vez ket adheñchet ho merdeer.', |
|
| 550 | + 'numero' => 'Niverenn', |
|
| 551 | 551 | |
| 552 | - // O |
|
| 553 | - 'occurence' => 'Kavadenn', |
|
| 554 | - 'onglet_affacer_base' => 'Diverkañ an diaz', |
|
| 555 | - 'onglet_auteur' => 'Ar skridaozer', |
|
| 556 | - 'onglet_contenu_site' => 'Endalc’had al lec’hienn', |
|
| 557 | - 'onglet_evolution_visite_mod' => 'Emdroadur', |
|
| 558 | - 'onglet_fonctions_avances' => 'Arc’hwelioù kemplezh', |
|
| 559 | - 'onglet_informations_personnelles' => 'Titouroù hiniennel', |
|
| 560 | - 'onglet_interactivite' => 'Etreobererezh', |
|
| 561 | - 'onglet_messagerie' => 'Postelerezh', |
|
| 562 | - 'onglet_repartition_rubrique' => 'Dasparzh diouzh ar rummad', |
|
| 563 | - 'onglet_save_restaur_base' => 'Saveteiñ/Assevel an diaz', |
|
| 564 | - 'onglet_vider_cache' => 'Goullonderiñ ar grubuilh', |
|
| 552 | + // O |
|
| 553 | + 'occurence' => 'Kavadenn', |
|
| 554 | + 'onglet_affacer_base' => 'Diverkañ an diaz', |
|
| 555 | + 'onglet_auteur' => 'Ar skridaozer', |
|
| 556 | + 'onglet_contenu_site' => 'Endalc’had al lec’hienn', |
|
| 557 | + 'onglet_evolution_visite_mod' => 'Emdroadur', |
|
| 558 | + 'onglet_fonctions_avances' => 'Arc’hwelioù kemplezh', |
|
| 559 | + 'onglet_informations_personnelles' => 'Titouroù hiniennel', |
|
| 560 | + 'onglet_interactivite' => 'Etreobererezh', |
|
| 561 | + 'onglet_messagerie' => 'Postelerezh', |
|
| 562 | + 'onglet_repartition_rubrique' => 'Dasparzh diouzh ar rummad', |
|
| 563 | + 'onglet_save_restaur_base' => 'Saveteiñ/Assevel an diaz', |
|
| 564 | + 'onglet_vider_cache' => 'Goullonderiñ ar grubuilh', |
|
| 565 | 565 | |
| 566 | - // P |
|
| 567 | - 'pass_choix_pass' => 'Dibabit ho ker-tremen nevez :', |
|
| 568 | - 'pass_erreur' => 'Fazi', |
|
| 569 | - 'pass_erreur_acces_refuse' => '<b>Fazi :</b> n’hoc’h ket aotreet da zont war al lec’hienn-mañ ken.', |
|
| 570 | - 'pass_erreur_code_inconnu' => '<b>Fazi :</b> ne glot ar c’hod-mañ gant gweladenner ebet a c’hall mont war al lec’hienn-mañ.', |
|
| 571 | - 'pass_erreur_non_enregistre' => '<b>Fazi :</b>n’eo ket enrollet ar chomlec’h <tt>@email_oubli@</tt> war al lec’hienn-mañ.', |
|
| 572 | - 'pass_erreur_non_valide' => '<b>Fazi :</b> n’eo ket reizh ar postel <tt>@email_oubli@</tt> !', |
|
| 573 | - 'pass_erreur_probleme_technique' => '<b>Fazi :</b> abalamout d’u gudenn deknikel, ne c’hell ket ar postel bezañ kaset.', |
|
| 574 | - 'pass_espace_prive_bla' => 'Dav eo bezañ enskrivet a-raok gallout tizhout lodenn brevez al lec’hienn. |
|
| 566 | + // P |
|
| 567 | + 'pass_choix_pass' => 'Dibabit ho ker-tremen nevez :', |
|
| 568 | + 'pass_erreur' => 'Fazi', |
|
| 569 | + 'pass_erreur_acces_refuse' => '<b>Fazi :</b> n’hoc’h ket aotreet da zont war al lec’hienn-mañ ken.', |
|
| 570 | + 'pass_erreur_code_inconnu' => '<b>Fazi :</b> ne glot ar c’hod-mañ gant gweladenner ebet a c’hall mont war al lec’hienn-mañ.', |
|
| 571 | + 'pass_erreur_non_enregistre' => '<b>Fazi :</b>n’eo ket enrollet ar chomlec’h <tt>@email_oubli@</tt> war al lec’hienn-mañ.', |
|
| 572 | + 'pass_erreur_non_valide' => '<b>Fazi :</b> n’eo ket reizh ar postel <tt>@email_oubli@</tt> !', |
|
| 573 | + 'pass_erreur_probleme_technique' => '<b>Fazi :</b> abalamout d’u gudenn deknikel, ne c’hell ket ar postel bezañ kaset.', |
|
| 574 | + 'pass_espace_prive_bla' => 'Dav eo bezañ enskrivet a-raok gallout tizhout lodenn brevez al lec’hienn. |
|
| 575 | 575 | P aviot enrollet e c’hellot lenn ar pennadoù meeur o skrivañ, kinnig pennadoù, ha kemer perzh er foromoù.', |
| 576 | - 'pass_forum_bla' => 'Goulennet hoc’h eus gallout kemer perzh war ur forom n’hall nemet an implijerien enrollet skrivañ warnañ.', |
|
| 577 | - 'pass_indiquez_cidessous' => 'Skrivit amañ dindan ar postel a oa bet implijet ganeoc’h evit en em enrollañ. |
|
| 576 | + 'pass_forum_bla' => 'Goulennet hoc’h eus gallout kemer perzh war ur forom n’hall nemet an implijerien enrollet skrivañ warnañ.', |
|
| 577 | + 'pass_indiquez_cidessous' => 'Skrivit amañ dindan ar postel a oa bet implijet ganeoc’h evit en em enrollañ. |
|
| 578 | 578 | Ur postel a vo kaset deoc’h ennañ an titouroù ret evit gallout dont en-dro war al lec’hienn.', |
| 579 | - 'pass_mail_passcookie' => '(ur gemennadenn emgefre eo homañ) |
|
| 579 | + 'pass_mail_passcookie' => '(ur gemennadenn emgefre eo homañ) |
|
| 580 | 580 | Evit gallout distreiñ war al lec’hienn |
| 581 | 581 | @nom_site_spip@ (@adresse_site@) |
| 582 | 582 | |
@@ -588,139 +588,139 @@ discard block |
||
| 588 | 588 | kevreañ en-dro ouzh al lec’hienn. |
| 589 | 589 | |
| 590 | 590 | ', # Connecter : gwelloc'h eo ober gant kevreañ zo muioc'h en implij gant an dud. Kevreañ ouzh ar genrouedad hag all. |
| 591 | - 'pass_mot_oublie' => 'Ankouaet ar ger-tremen', |
|
| 592 | - 'pass_nouveau_enregistre' => 'Enrollet eo bet ho ker-tremen nevez.', |
|
| 593 | - 'pass_nouveau_pass' => 'Ger-tremen nevez', |
|
| 594 | - 'pass_ok' => 'MAT EO', |
|
| 595 | - 'pass_oubli_mot' => 'Ankouaet ar ger-tremen', |
|
| 596 | - 'pass_procedure_changer' => 'Evit kemmañ ho ker-tremen e rankomp gwiriekaat piv oc’h. Evit en ober diskouezit deomp ar postel liammet gant ho kont.', |
|
| 597 | - 'pass_quitter_fenetre' => 'Kuitaat ar prenestr-mañ', |
|
| 598 | - 'pass_rappel_login' => 'Dalc’hit soñj : « @login@ » eo ho anv-tremen (login).', |
|
| 599 | - 'pass_recevoir_mail' => 'Ur postel a vo kaset deoc’h, ennañ an titouroù ret da c’hallout tizhout al lec’hienn en-dro.', # MODIF |
|
| 600 | - 'pass_retour_public' => 'Distreiñ d’al lodenn foran', |
|
| 601 | - 'pass_rien_a_faire_ici' => 'Netra d’ober amañ.', |
|
| 602 | - 'pass_vousinscrire' => 'En em enskrivañ war al lec’hienn-mañ', |
|
| 603 | - 'precedent' => 'kent', |
|
| 604 | - 'previsualisation' => 'Rakwelet', |
|
| 605 | - 'previsualiser' => 'Rakwelet', |
|
| 591 | + 'pass_mot_oublie' => 'Ankouaet ar ger-tremen', |
|
| 592 | + 'pass_nouveau_enregistre' => 'Enrollet eo bet ho ker-tremen nevez.', |
|
| 593 | + 'pass_nouveau_pass' => 'Ger-tremen nevez', |
|
| 594 | + 'pass_ok' => 'MAT EO', |
|
| 595 | + 'pass_oubli_mot' => 'Ankouaet ar ger-tremen', |
|
| 596 | + 'pass_procedure_changer' => 'Evit kemmañ ho ker-tremen e rankomp gwiriekaat piv oc’h. Evit en ober diskouezit deomp ar postel liammet gant ho kont.', |
|
| 597 | + 'pass_quitter_fenetre' => 'Kuitaat ar prenestr-mañ', |
|
| 598 | + 'pass_rappel_login' => 'Dalc’hit soñj : « @login@ » eo ho anv-tremen (login).', |
|
| 599 | + 'pass_recevoir_mail' => 'Ur postel a vo kaset deoc’h, ennañ an titouroù ret da c’hallout tizhout al lec’hienn en-dro.', # MODIF |
|
| 600 | + 'pass_retour_public' => 'Distreiñ d’al lodenn foran', |
|
| 601 | + 'pass_rien_a_faire_ici' => 'Netra d’ober amañ.', |
|
| 602 | + 'pass_vousinscrire' => 'En em enskrivañ war al lec’hienn-mañ', |
|
| 603 | + 'precedent' => 'kent', |
|
| 604 | + 'previsualisation' => 'Rakwelet', |
|
| 605 | + 'previsualiser' => 'Rakwelet', |
|
| 606 | 606 | |
| 607 | - // R |
|
| 608 | - 'retour' => 'Distreiñ', |
|
| 607 | + // R |
|
| 608 | + 'retour' => 'Distreiñ', |
|
| 609 | 609 | |
| 610 | - // S |
|
| 611 | - 'spip_conforme_dtd' => 'SPIP a gav dezhañ e klot an teul-mañ gant e DOCTYPE :', |
|
| 612 | - 'squelette' => 'framm', |
|
| 613 | - 'squelette_inclus_ligne' => 'framm e-barzh, linenn', |
|
| 614 | - 'squelette_ligne' => 'framm, linenn', |
|
| 615 | - 'stats_visites_et_popularite' => '@visites@ gweladenn ; brud; : @popularite@', |
|
| 616 | - 'suivant' => 'war-lerc’h', |
|
| 610 | + // S |
|
| 611 | + 'spip_conforme_dtd' => 'SPIP a gav dezhañ e klot an teul-mañ gant e DOCTYPE :', |
|
| 612 | + 'squelette' => 'framm', |
|
| 613 | + 'squelette_inclus_ligne' => 'framm e-barzh, linenn', |
|
| 614 | + 'squelette_ligne' => 'framm, linenn', |
|
| 615 | + 'stats_visites_et_popularite' => '@visites@ gweladenn ; brud; : @popularite@', |
|
| 616 | + 'suivant' => 'war-lerc’h', |
|
| 617 | 617 | |
| 618 | - // T |
|
| 619 | - 'taille_go' => '@taille@ Go', |
|
| 620 | - 'taille_ko' => '@taille@ ke', |
|
| 621 | - 'taille_mo' => '@taille@ Me', |
|
| 622 | - 'taille_octets' => '@taille@ eizhbit', |
|
| 623 | - 'texte_actualite_site_1' => 'Pa viot boas ouzh an etrefas e c’hellot klikañ war «', |
|
| 624 | - 'texte_actualite_site_2' => 'etrefas klok', |
|
| 625 | - 'texte_actualite_site_3' => '» evit sevijoù ouzhpenn.', |
|
| 626 | - 'texte_creation_automatique_vignette' => 'Ober a reer gant ar sevel skeudennigoù adal skeudennoù. Ma stailhi skeudennoù er furmad(où) @gd_formats@, adal ar furmskrid-mañ e vo staget ur skeudennig @taille_preview@ piksel d’ar muiañ outo.', |
|
| 627 | - 'texte_documents_associes' => 'Stag eo an teulioù-mañ ouzh ar pennad, |
|
| 618 | + // T |
|
| 619 | + 'taille_go' => '@taille@ Go', |
|
| 620 | + 'taille_ko' => '@taille@ ke', |
|
| 621 | + 'taille_mo' => '@taille@ Me', |
|
| 622 | + 'taille_octets' => '@taille@ eizhbit', |
|
| 623 | + 'texte_actualite_site_1' => 'Pa viot boas ouzh an etrefas e c’hellot klikañ war «', |
|
| 624 | + 'texte_actualite_site_2' => 'etrefas klok', |
|
| 625 | + 'texte_actualite_site_3' => '» evit sevijoù ouzhpenn.', |
|
| 626 | + 'texte_creation_automatique_vignette' => 'Ober a reer gant ar sevel skeudennigoù adal skeudennoù. Ma stailhi skeudennoù er furmad(où) @gd_formats@, adal ar furmskrid-mañ e vo staget ur skeudennig @taille_preview@ piksel d’ar muiañ outo.', |
|
| 627 | + 'texte_documents_associes' => 'Stag eo an teulioù-mañ ouzh ar pennad, |
|
| 628 | 628 | met n’int ket bet ensoc’het diouzhtu ennañ |
| 629 | 629 | Diouzh mod pajennaozañ al lec’hienn e c’hellint bezañ diskouezet dindan stumm restroù stag.', |
| 630 | - 'texte_erreur_mise_niveau_base' => 'Ur fazi zo bet gant an diaz titouroù en ur hizivaat. |
|
| 630 | + 'texte_erreur_mise_niveau_base' => 'Ur fazi zo bet gant an diaz titouroù en ur hizivaat. |
|
| 631 | 631 | N’eo ket tremenet ar skeudenn <b>@fichier@</b> (pennad @id_article@). |
| 632 | 632 | Notennit an daveenn-se, klaksit hizivaat en-dro, |
| 633 | 633 | ha gwiriit e vez diskouezet ar skeudennoù er pennadoù.', |
| 634 | - 'texte_erreur_visiteur' => 'Klasket hoc’h eus tizhout al lodenn brevez gant un anv implijer direizh.', |
|
| 635 | - 'texte_inc_auth_1' => 'Enrollet oc’h dindan al ger kevreañ |
|
| 634 | + 'texte_erreur_visiteur' => 'Klasket hoc’h eus tizhout al lodenn brevez gant un anv implijer direizh.', |
|
| 635 | + 'texte_inc_auth_1' => 'Enrollet oc’h dindan al ger kevreañ |
|
| 636 | 636 | <b>@auth_login@</b>, met n’eus ket anezhañ (ken) en diaz titouroù. |
| 637 | 637 | Klaskit ', |
| 638 | - 'texte_inc_auth_2' => 'adkevreañ', |
|
| 639 | - 'texte_inc_auth_3' => ', goude bezañ kuitaet hag adloc’het ho merdeer.', |
|
| 640 | - 'texte_inc_config' => '>Ul levezon vras o deus kemmoù ar bajenn-mañ war mont en-dro hollek al lec’hienn. |
|
| 638 | + 'texte_inc_auth_2' => 'adkevreañ', |
|
| 639 | + 'texte_inc_auth_3' => ', goude bezañ kuitaet hag adloc’het ho merdeer.', |
|
| 640 | + 'texte_inc_config' => '>Ul levezon vras o deus kemmoù ar bajenn-mañ war mont en-dro hollek al lec’hienn. |
|
| 641 | 641 | Aliet oc’h da chom hep kemmañ tra ebet e-keit ha n’oc’h ket boas ouzh SPIP. |
| 642 | 642 | <br /><br /><b>Aliet oc’h da lezel webmestr pennañ al lec’hienn ober war-dro ar pajennoù-mañ.</b>', |
| 643 | - 'texte_inc_meta_1' => 'Ur fazi zo bet en ur skrivañ war ar restr <code>@fichier@</code>. Dre ma’z oc’h merour al lec’hienn e rankit ', |
|
| 644 | - 'texte_inc_meta_2' => 'Gwiriañ ar gwirioù da skrivañ ', |
|
| 645 | - 'texte_inc_meta_3' => 'war ar c’havlec’h <code>@repertoire@</code>.', |
|
| 646 | - 'texte_statut_en_cours_redaction' => 'o skridaozañ', |
|
| 647 | - 'texte_statut_poubelle' => 'er pod-lastez', |
|
| 648 | - 'texte_statut_propose_evaluation' => 'kinniget ouzh an amprou', |
|
| 649 | - 'texte_statut_publie' => 'embannet', |
|
| 650 | - 'texte_statut_refuse' => 'nac’het', |
|
| 651 | - 'titre_ajouter_mot_cle' => 'OUZHPENNAÑ UR GER-STUR :', |
|
| 652 | - 'titre_cadre_raccourcis' => 'BERRADENNOÙ :', |
|
| 653 | - 'titre_changer_couleur_interface' => 'Kemm liv an etrefas', |
|
| 654 | - 'titre_image_admin_article' => 'Gallout a rit merañ ar pennad-mañ', |
|
| 655 | - 'titre_image_administrateur' => 'Merour', |
|
| 656 | - 'titre_image_aide' => 'Skoazell diwar-benn an elfenn-mañ', |
|
| 657 | - 'titre_image_auteur_supprime' => 'Skridaozer bet diverket', |
|
| 658 | - 'titre_image_redacteur' => 'Skridaozer hep aotre moned', |
|
| 659 | - 'titre_image_redacteur_02' => 'Skridaozer', |
|
| 660 | - 'titre_image_selecteur' => 'Diskouez al listenn', |
|
| 661 | - 'titre_image_visiteur' => 'Gweladenner', |
|
| 662 | - 'titre_joindre_document' => 'STAGAÑ UN TEUL', |
|
| 663 | - 'titre_mots_cles' => 'GERIOÙ-STUR', |
|
| 664 | - 'titre_probleme_technique' => 'Diwallit : abalamour d’ur gudenn deknikel (servijer SQL), n’eus ket tu da dizhout al lodenn-mañ eus al lec’hienn. Trugarez evit ho komprenezon.', |
|
| 665 | - 'titre_publier_document' => 'EMBANN UN TEUL ER RUBRIKENN-MAÑ', |
|
| 666 | - 'titre_signatures_attente' => 'Sinadurioù a c’hortoz bezañ kadarnaet', |
|
| 667 | - 'titre_signatures_confirmees' => 'Sinadurioù bet gwiriekaet', |
|
| 668 | - 'titre_statistiques' => 'Stadegoù al lec’hienn', # Stadegoù, termen skoueriekaet gant TermBret evit Statistiques. |
|
| 669 | - 'titre_titre_document' => 'Titl an teul :', |
|
| 670 | - 'todo' => 'da zont', |
|
| 671 | - 'trad_definir_reference' => 'Dibab "@titre@" evel dave an troidigezhioù', |
|
| 672 | - 'trad_reference' => '(Pennad diazez evit an troidigezhioù)', |
|
| 643 | + 'texte_inc_meta_1' => 'Ur fazi zo bet en ur skrivañ war ar restr <code>@fichier@</code>. Dre ma’z oc’h merour al lec’hienn e rankit ', |
|
| 644 | + 'texte_inc_meta_2' => 'Gwiriañ ar gwirioù da skrivañ ', |
|
| 645 | + 'texte_inc_meta_3' => 'war ar c’havlec’h <code>@repertoire@</code>.', |
|
| 646 | + 'texte_statut_en_cours_redaction' => 'o skridaozañ', |
|
| 647 | + 'texte_statut_poubelle' => 'er pod-lastez', |
|
| 648 | + 'texte_statut_propose_evaluation' => 'kinniget ouzh an amprou', |
|
| 649 | + 'texte_statut_publie' => 'embannet', |
|
| 650 | + 'texte_statut_refuse' => 'nac’het', |
|
| 651 | + 'titre_ajouter_mot_cle' => 'OUZHPENNAÑ UR GER-STUR :', |
|
| 652 | + 'titre_cadre_raccourcis' => 'BERRADENNOÙ :', |
|
| 653 | + 'titre_changer_couleur_interface' => 'Kemm liv an etrefas', |
|
| 654 | + 'titre_image_admin_article' => 'Gallout a rit merañ ar pennad-mañ', |
|
| 655 | + 'titre_image_administrateur' => 'Merour', |
|
| 656 | + 'titre_image_aide' => 'Skoazell diwar-benn an elfenn-mañ', |
|
| 657 | + 'titre_image_auteur_supprime' => 'Skridaozer bet diverket', |
|
| 658 | + 'titre_image_redacteur' => 'Skridaozer hep aotre moned', |
|
| 659 | + 'titre_image_redacteur_02' => 'Skridaozer', |
|
| 660 | + 'titre_image_selecteur' => 'Diskouez al listenn', |
|
| 661 | + 'titre_image_visiteur' => 'Gweladenner', |
|
| 662 | + 'titre_joindre_document' => 'STAGAÑ UN TEUL', |
|
| 663 | + 'titre_mots_cles' => 'GERIOÙ-STUR', |
|
| 664 | + 'titre_probleme_technique' => 'Diwallit : abalamour d’ur gudenn deknikel (servijer SQL), n’eus ket tu da dizhout al lodenn-mañ eus al lec’hienn. Trugarez evit ho komprenezon.', |
|
| 665 | + 'titre_publier_document' => 'EMBANN UN TEUL ER RUBRIKENN-MAÑ', |
|
| 666 | + 'titre_signatures_attente' => 'Sinadurioù a c’hortoz bezañ kadarnaet', |
|
| 667 | + 'titre_signatures_confirmees' => 'Sinadurioù bet gwiriekaet', |
|
| 668 | + 'titre_statistiques' => 'Stadegoù al lec’hienn', # Stadegoù, termen skoueriekaet gant TermBret evit Statistiques. |
|
| 669 | + 'titre_titre_document' => 'Titl an teul :', |
|
| 670 | + 'todo' => 'da zont', |
|
| 671 | + 'trad_definir_reference' => 'Dibab "@titre@" evel dave an troidigezhioù', |
|
| 672 | + 'trad_reference' => '(Pennad diazez evit an troidigezhioù)', |
|
| 673 | 673 | |
| 674 | - // U |
|
| 675 | - 'upload_limit' => 'Re bounner eo ar fichennaoueg-mañ evit ar servijer ; brasañ ment aotreet e <i>upload</i> a zo @max@.', |
|
| 674 | + // U |
|
| 675 | + 'upload_limit' => 'Re bounner eo ar fichennaoueg-mañ evit ar servijer ; brasañ ment aotreet e <i>upload</i> a zo @max@.', |
|
| 676 | 676 | |
| 677 | - // Z |
|
| 678 | - 'zbug_balise_b_aval' => ' : balizenn B en ardraoñ', |
|
| 679 | - 'zbug_balise_inexistante' => 'Disklêriet-fall eo ar valizenn @balise@ evit @from@', |
|
| 680 | - 'zbug_balise_sans_argument' => 'Un arguzenn a vank er valizenn @balise@', |
|
| 681 | - 'zbug_boucle' => 'bouklenn', |
|
| 682 | - 'zbug_boucle_recursive_undef' => 'N’eo ket bet termenet ar vouklenn-mañ : @nom@', |
|
| 683 | - 'zbug_calcul' => 'jediñ', |
|
| 684 | - 'zbug_champ_hors_boucle' => 'Maezienn @champ@ e diavaez ar vouklenn', |
|
| 685 | - 'zbug_champ_hors_motif' => 'Maezienn @champ@ er-maez kendestenn @motif@', |
|
| 686 | - 'zbug_code' => 'kod', |
|
| 687 | - 'zbug_critere_inconnu' => 'Dezverk @critere@ dianav', |
|
| 688 | - 'zbug_critere_sur_table_sans_cle_primaire' => '{@critere@} war un daolenn hep alc’hwez kentael atomek', |
|
| 689 | - 'zbug_distant_interdit' => 'N’eo ket posupl war un diaz roadoù diavaez', |
|
| 690 | - 'zbug_doublon_table_sans_cle_primaire' => 'Doublennoù war un diaz hep alc’hwez kentañ atomek', |
|
| 691 | - 'zbug_doublon_table_sans_index' => 'Doublenn war un diaz hep meneger', |
|
| 692 | - 'zbug_erreur_boucle_double' => 'Bouklenn @id@ bet termenet div wech', |
|
| 693 | - 'zbug_erreur_boucle_fermant' => 'Chomet eo digor ar vouklenn @id@', |
|
| 694 | - 'zbug_erreur_boucle_syntaxe' => 'Direizh eo ereadurezh ar vouklenn @id@', |
|
| 695 | - 'zbug_erreur_compilation' => 'Fazi kempunañ', |
|
| 696 | - 'zbug_erreur_execution_page' => 'Fazi erounit', |
|
| 697 | - 'zbug_erreur_filtre' => 'Sil @filtre@ didermenet', |
|
| 698 | - 'zbug_erreur_meme_parent' => 'n’hall an dezverk {meme_parent} bezañ implijet nemet war ar bouklennoù (FOROMOÙ) pe (RUBRIKENNOÙ)', |
|
| 699 | - 'zbug_erreur_squelette' => 'Fazi(où) er framm', |
|
| 700 | - 'zbug_hors_compilation' => 'Er-maez kempunad', |
|
| 701 | - 'zbug_info_erreur_squelette' => 'Fazi war al lec’hienn', |
|
| 702 | - 'zbug_inversion_ordre_inexistant' => 'Eilpennañ un urzh n’eus ket anezhañ', |
|
| 703 | - 'zbug_pagination_sans_critere' => 'N’eus dezverk ebet d’ar valizenn #PAJENNAOUIÑ, pe neuze eo implijet en ur vouken a dro warni hec’h-unan', |
|
| 704 | - 'zbug_parametres_inclus_incorrects' => 'Direizh eo an arventenn ensoc’hañ @param@', |
|
| 705 | - 'zbug_profile' => 'Amzer jediñ : @time@', |
|
| 706 | - 'zbug_resultat' => 'disoc’h', |
|
| 707 | - 'zbug_serveur_indefini' => 'Servijer SQL didermenet', |
|
| 708 | - 'zbug_statistiques' => 'Stadegoù ar goulennoù SQL urzhiet diouzh o fad', |
|
| 709 | - 'zbug_table_inconnue' => 'Taolenn SQL « @table@ » dianav', |
|
| 710 | - 'zxml_connus_attributs' => 'perzhioù anavezet', |
|
| 711 | - 'zxml_de' => 'da', |
|
| 712 | - 'zxml_inconnu_attribut' => 'perzh dianav', |
|
| 713 | - 'zxml_inconnu_balise' => 'balizenn dianav', |
|
| 714 | - 'zxml_inconnu_entite' => 'elfenn dianav', |
|
| 715 | - 'zxml_inconnu_id' => 'ID dianav', |
|
| 716 | - 'zxml_mais_de' => 'met eus', |
|
| 717 | - 'zxml_non_conforme' => 'ne glot ket gant an abeg', |
|
| 718 | - 'zxml_non_fils' => 'n’eo ket ur mab da', |
|
| 719 | - 'zxml_nonvide_balise' => 'balizenn ket goullo', |
|
| 720 | - 'zxml_obligatoire_attribut' => 'perzh rediet, met na gaver ket e', |
|
| 721 | - 'zxml_succession_fils_incorrecte' => 'heuliad ar vibien direizh', |
|
| 722 | - 'zxml_survoler' => 'tremen buan da welet ar re zo reizh', |
|
| 723 | - 'zxml_valeur_attribut' => 'talvoudegezh ar perzh', |
|
| 724 | - 'zxml_vide_balise' => 'balizenn c’houllo', |
|
| 725 | - 'zxml_vu' => 'bet gwelet a-raok' |
|
| 677 | + // Z |
|
| 678 | + 'zbug_balise_b_aval' => ' : balizenn B en ardraoñ', |
|
| 679 | + 'zbug_balise_inexistante' => 'Disklêriet-fall eo ar valizenn @balise@ evit @from@', |
|
| 680 | + 'zbug_balise_sans_argument' => 'Un arguzenn a vank er valizenn @balise@', |
|
| 681 | + 'zbug_boucle' => 'bouklenn', |
|
| 682 | + 'zbug_boucle_recursive_undef' => 'N’eo ket bet termenet ar vouklenn-mañ : @nom@', |
|
| 683 | + 'zbug_calcul' => 'jediñ', |
|
| 684 | + 'zbug_champ_hors_boucle' => 'Maezienn @champ@ e diavaez ar vouklenn', |
|
| 685 | + 'zbug_champ_hors_motif' => 'Maezienn @champ@ er-maez kendestenn @motif@', |
|
| 686 | + 'zbug_code' => 'kod', |
|
| 687 | + 'zbug_critere_inconnu' => 'Dezverk @critere@ dianav', |
|
| 688 | + 'zbug_critere_sur_table_sans_cle_primaire' => '{@critere@} war un daolenn hep alc’hwez kentael atomek', |
|
| 689 | + 'zbug_distant_interdit' => 'N’eo ket posupl war un diaz roadoù diavaez', |
|
| 690 | + 'zbug_doublon_table_sans_cle_primaire' => 'Doublennoù war un diaz hep alc’hwez kentañ atomek', |
|
| 691 | + 'zbug_doublon_table_sans_index' => 'Doublenn war un diaz hep meneger', |
|
| 692 | + 'zbug_erreur_boucle_double' => 'Bouklenn @id@ bet termenet div wech', |
|
| 693 | + 'zbug_erreur_boucle_fermant' => 'Chomet eo digor ar vouklenn @id@', |
|
| 694 | + 'zbug_erreur_boucle_syntaxe' => 'Direizh eo ereadurezh ar vouklenn @id@', |
|
| 695 | + 'zbug_erreur_compilation' => 'Fazi kempunañ', |
|
| 696 | + 'zbug_erreur_execution_page' => 'Fazi erounit', |
|
| 697 | + 'zbug_erreur_filtre' => 'Sil @filtre@ didermenet', |
|
| 698 | + 'zbug_erreur_meme_parent' => 'n’hall an dezverk {meme_parent} bezañ implijet nemet war ar bouklennoù (FOROMOÙ) pe (RUBRIKENNOÙ)', |
|
| 699 | + 'zbug_erreur_squelette' => 'Fazi(où) er framm', |
|
| 700 | + 'zbug_hors_compilation' => 'Er-maez kempunad', |
|
| 701 | + 'zbug_info_erreur_squelette' => 'Fazi war al lec’hienn', |
|
| 702 | + 'zbug_inversion_ordre_inexistant' => 'Eilpennañ un urzh n’eus ket anezhañ', |
|
| 703 | + 'zbug_pagination_sans_critere' => 'N’eus dezverk ebet d’ar valizenn #PAJENNAOUIÑ, pe neuze eo implijet en ur vouken a dro warni hec’h-unan', |
|
| 704 | + 'zbug_parametres_inclus_incorrects' => 'Direizh eo an arventenn ensoc’hañ @param@', |
|
| 705 | + 'zbug_profile' => 'Amzer jediñ : @time@', |
|
| 706 | + 'zbug_resultat' => 'disoc’h', |
|
| 707 | + 'zbug_serveur_indefini' => 'Servijer SQL didermenet', |
|
| 708 | + 'zbug_statistiques' => 'Stadegoù ar goulennoù SQL urzhiet diouzh o fad', |
|
| 709 | + 'zbug_table_inconnue' => 'Taolenn SQL « @table@ » dianav', |
|
| 710 | + 'zxml_connus_attributs' => 'perzhioù anavezet', |
|
| 711 | + 'zxml_de' => 'da', |
|
| 712 | + 'zxml_inconnu_attribut' => 'perzh dianav', |
|
| 713 | + 'zxml_inconnu_balise' => 'balizenn dianav', |
|
| 714 | + 'zxml_inconnu_entite' => 'elfenn dianav', |
|
| 715 | + 'zxml_inconnu_id' => 'ID dianav', |
|
| 716 | + 'zxml_mais_de' => 'met eus', |
|
| 717 | + 'zxml_non_conforme' => 'ne glot ket gant an abeg', |
|
| 718 | + 'zxml_non_fils' => 'n’eo ket ur mab da', |
|
| 719 | + 'zxml_nonvide_balise' => 'balizenn ket goullo', |
|
| 720 | + 'zxml_obligatoire_attribut' => 'perzh rediet, met na gaver ket e', |
|
| 721 | + 'zxml_succession_fils_incorrecte' => 'heuliad ar vibien direizh', |
|
| 722 | + 'zxml_survoler' => 'tremen buan da welet ar re zo reizh', |
|
| 723 | + 'zxml_valeur_attribut' => 'talvoudegezh ar perzh', |
|
| 724 | + 'zxml_vide_balise' => 'balizenn c’houllo', |
|
| 725 | + 'zxml_vu' => 'bet gwelet a-raok' |
|
| 726 | 726 | ); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -19,158 +19,158 @@ discard block |
||
| 19 | 19 | * @return string |
| 20 | 20 | */ |
| 21 | 21 | function securiser_redirect_action($redirect) { |
| 22 | - $redirect ??= ''; |
|
| 23 | - // cas d'un double urlencode : si un urldecode de l'url n'est pas secure, on retient ca comme redirect |
|
| 24 | - if (strpos($redirect, '%') !== false) { |
|
| 25 | - $r2 = urldecode($redirect); |
|
| 26 | - if (($r3 = securiser_redirect_action($r2)) !== $r2) { |
|
| 27 | - return $r3; |
|
| 28 | - } |
|
| 29 | - } |
|
| 30 | - if ( |
|
| 31 | - (tester_url_absolue($redirect) or preg_match(',^\w+:,', trim($redirect))) |
|
| 32 | - and !defined('_AUTORISER_ACTION_ABS_REDIRECT') |
|
| 33 | - ) { |
|
| 34 | - // si l'url est une url du site, on la laisse passer sans rien faire |
|
| 35 | - // c'est encore le plus simple |
|
| 36 | - $base = $GLOBALS['meta']['adresse_site'] . '/'; |
|
| 37 | - if (strlen($base) and strncmp($redirect, $base, strlen($base)) == 0) { |
|
| 38 | - return $redirect; |
|
| 39 | - } |
|
| 40 | - $base = url_de_base(); |
|
| 41 | - if (strlen($base) and strncmp($redirect, $base, strlen($base)) == 0) { |
|
| 42 | - return $redirect; |
|
| 43 | - } |
|
| 22 | + $redirect ??= ''; |
|
| 23 | + // cas d'un double urlencode : si un urldecode de l'url n'est pas secure, on retient ca comme redirect |
|
| 24 | + if (strpos($redirect, '%') !== false) { |
|
| 25 | + $r2 = urldecode($redirect); |
|
| 26 | + if (($r3 = securiser_redirect_action($r2)) !== $r2) { |
|
| 27 | + return $r3; |
|
| 28 | + } |
|
| 29 | + } |
|
| 30 | + if ( |
|
| 31 | + (tester_url_absolue($redirect) or preg_match(',^\w+:,', trim($redirect))) |
|
| 32 | + and !defined('_AUTORISER_ACTION_ABS_REDIRECT') |
|
| 33 | + ) { |
|
| 34 | + // si l'url est une url du site, on la laisse passer sans rien faire |
|
| 35 | + // c'est encore le plus simple |
|
| 36 | + $base = $GLOBALS['meta']['adresse_site'] . '/'; |
|
| 37 | + if (strlen($base) and strncmp($redirect, $base, strlen($base)) == 0) { |
|
| 38 | + return $redirect; |
|
| 39 | + } |
|
| 40 | + $base = url_de_base(); |
|
| 41 | + if (strlen($base) and strncmp($redirect, $base, strlen($base)) == 0) { |
|
| 42 | + return $redirect; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - return ''; |
|
| 46 | - } |
|
| 45 | + return ''; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - return $redirect; |
|
| 48 | + return $redirect; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | function traiter_appels_actions() { |
| 52 | - // cas de l'appel qui renvoie une redirection (302) ou rien (204) |
|
| 53 | - if ($action = _request('action')) { |
|
| 54 | - include_spip('base/abstract_sql'); // chargement systematique pour les actions |
|
| 55 | - include_spip('inc/autoriser'); |
|
| 56 | - include_spip('inc/headers'); |
|
| 57 | - include_spip('inc/actions'); |
|
| 58 | - // des actions peuvent appeler _T |
|
| 59 | - if (!isset($GLOBALS['spip_lang'])) { |
|
| 60 | - include_spip('inc/lang'); |
|
| 61 | - utiliser_langue_visiteur(); |
|
| 62 | - } |
|
| 63 | - // si l'action est provoque par un hit {ajax} |
|
| 64 | - // il faut transmettre l'env ajax au redirect |
|
| 65 | - // on le met avant dans la query string au cas ou l'action fait elle meme sa redirection |
|
| 66 | - if ( |
|
| 67 | - ($v = _request('var_ajax')) |
|
| 68 | - and ($v !== 'form') |
|
| 69 | - and ($args = _request('var_ajax_env')) |
|
| 70 | - and ($url = _request('redirect')) |
|
| 71 | - ) { |
|
| 72 | - $url = parametre_url($url, 'var_ajax', $v, '&'); |
|
| 73 | - $url = parametre_url($url, 'var_ajax_env', $args, '&'); |
|
| 74 | - set_request('redirect', $url); |
|
| 75 | - } else { |
|
| 76 | - if (_request('redirect')) { |
|
| 77 | - set_request('redirect', securiser_redirect_action(_request('redirect'))); |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - $var_f = charger_fonction($action, 'action'); |
|
| 81 | - $var_f(); |
|
| 82 | - if (!isset($GLOBALS['redirect'])) { |
|
| 83 | - $GLOBALS['redirect'] = _request('redirect') ?? ''; |
|
| 84 | - if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
|
| 85 | - $GLOBALS['redirect'] = urldecode($GLOBALS['redirect']); |
|
| 86 | - } |
|
| 87 | - $GLOBALS['redirect'] = securiser_redirect_action($GLOBALS['redirect']); |
|
| 88 | - } |
|
| 89 | - if ($url = $GLOBALS['redirect']) { |
|
| 90 | - // si l'action est provoque par un hit {ajax} |
|
| 91 | - // il faut transmettre l'env ajax au redirect |
|
| 92 | - // qui a pu etre defini par l'action |
|
| 93 | - if ( |
|
| 94 | - ($v = _request('var_ajax')) |
|
| 95 | - and ($v !== 'form') |
|
| 96 | - and ($args = _request('var_ajax_env')) |
|
| 97 | - ) { |
|
| 98 | - $url = parametre_url($url, 'var_ajax', $v, '&'); |
|
| 99 | - $url = parametre_url($url, 'var_ajax_env', $args, '&'); |
|
| 100 | - // passer l'ancre en variable pour pouvoir la gerer cote serveur |
|
| 101 | - $url = preg_replace(',#([^#&?]+)$,', "&var_ajax_ancre=\\1", $url); |
|
| 102 | - } |
|
| 103 | - $url = str_replace('&', '&', $url); // les redirections se font en &, pas en en & |
|
| 104 | - redirige_par_entete($url); |
|
| 105 | - } |
|
| 52 | + // cas de l'appel qui renvoie une redirection (302) ou rien (204) |
|
| 53 | + if ($action = _request('action')) { |
|
| 54 | + include_spip('base/abstract_sql'); // chargement systematique pour les actions |
|
| 55 | + include_spip('inc/autoriser'); |
|
| 56 | + include_spip('inc/headers'); |
|
| 57 | + include_spip('inc/actions'); |
|
| 58 | + // des actions peuvent appeler _T |
|
| 59 | + if (!isset($GLOBALS['spip_lang'])) { |
|
| 60 | + include_spip('inc/lang'); |
|
| 61 | + utiliser_langue_visiteur(); |
|
| 62 | + } |
|
| 63 | + // si l'action est provoque par un hit {ajax} |
|
| 64 | + // il faut transmettre l'env ajax au redirect |
|
| 65 | + // on le met avant dans la query string au cas ou l'action fait elle meme sa redirection |
|
| 66 | + if ( |
|
| 67 | + ($v = _request('var_ajax')) |
|
| 68 | + and ($v !== 'form') |
|
| 69 | + and ($args = _request('var_ajax_env')) |
|
| 70 | + and ($url = _request('redirect')) |
|
| 71 | + ) { |
|
| 72 | + $url = parametre_url($url, 'var_ajax', $v, '&'); |
|
| 73 | + $url = parametre_url($url, 'var_ajax_env', $args, '&'); |
|
| 74 | + set_request('redirect', $url); |
|
| 75 | + } else { |
|
| 76 | + if (_request('redirect')) { |
|
| 77 | + set_request('redirect', securiser_redirect_action(_request('redirect'))); |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + $var_f = charger_fonction($action, 'action'); |
|
| 81 | + $var_f(); |
|
| 82 | + if (!isset($GLOBALS['redirect'])) { |
|
| 83 | + $GLOBALS['redirect'] = _request('redirect') ?? ''; |
|
| 84 | + if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
|
| 85 | + $GLOBALS['redirect'] = urldecode($GLOBALS['redirect']); |
|
| 86 | + } |
|
| 87 | + $GLOBALS['redirect'] = securiser_redirect_action($GLOBALS['redirect']); |
|
| 88 | + } |
|
| 89 | + if ($url = $GLOBALS['redirect']) { |
|
| 90 | + // si l'action est provoque par un hit {ajax} |
|
| 91 | + // il faut transmettre l'env ajax au redirect |
|
| 92 | + // qui a pu etre defini par l'action |
|
| 93 | + if ( |
|
| 94 | + ($v = _request('var_ajax')) |
|
| 95 | + and ($v !== 'form') |
|
| 96 | + and ($args = _request('var_ajax_env')) |
|
| 97 | + ) { |
|
| 98 | + $url = parametre_url($url, 'var_ajax', $v, '&'); |
|
| 99 | + $url = parametre_url($url, 'var_ajax_env', $args, '&'); |
|
| 100 | + // passer l'ancre en variable pour pouvoir la gerer cote serveur |
|
| 101 | + $url = preg_replace(',#([^#&?]+)$,', "&var_ajax_ancre=\\1", $url); |
|
| 102 | + } |
|
| 103 | + $url = str_replace('&', '&', $url); // les redirections se font en &, pas en en & |
|
| 104 | + redirige_par_entete($url); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - // attention : avec zlib.output_compression=1 on a vu des cas de ob_get_length() qui renvoi 0 |
|
| 108 | - // et du coup en renvoi un status 204 a tort (vu sur le menu rubriques notamment) |
|
| 109 | - if ( |
|
| 110 | - !headers_sent() |
|
| 111 | - and !ob_get_length() |
|
| 112 | - ) { |
|
| 113 | - http_status(204); |
|
| 114 | - } // No Content |
|
| 115 | - return true; |
|
| 116 | - } |
|
| 107 | + // attention : avec zlib.output_compression=1 on a vu des cas de ob_get_length() qui renvoi 0 |
|
| 108 | + // et du coup en renvoi un status 204 a tort (vu sur le menu rubriques notamment) |
|
| 109 | + if ( |
|
| 110 | + !headers_sent() |
|
| 111 | + and !ob_get_length() |
|
| 112 | + ) { |
|
| 113 | + http_status(204); |
|
| 114 | + } // No Content |
|
| 115 | + return true; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - return false; |
|
| 118 | + return false; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | function refuser_traiter_formulaire_ajax() { |
| 123 | - if ( |
|
| 124 | - $v = _request('var_ajax') |
|
| 125 | - and $v == 'form' |
|
| 126 | - and $form = _request('formulaire_action') |
|
| 127 | - and $args = _request('formulaire_action_args') |
|
| 128 | - and decoder_contexte_ajax($args, $form) !== false |
|
| 129 | - ) { |
|
| 130 | - // on est bien dans le contexte de traitement d'un formulaire en ajax |
|
| 131 | - // mais traiter ne veut pas |
|
| 132 | - // on le dit a la page qui va resumbit |
|
| 133 | - // sans ajax |
|
| 134 | - include_spip('inc/actions'); |
|
| 135 | - ajax_retour('noajax', false); |
|
| 136 | - exit; |
|
| 137 | - } |
|
| 123 | + if ( |
|
| 124 | + $v = _request('var_ajax') |
|
| 125 | + and $v == 'form' |
|
| 126 | + and $form = _request('formulaire_action') |
|
| 127 | + and $args = _request('formulaire_action_args') |
|
| 128 | + and decoder_contexte_ajax($args, $form) !== false |
|
| 129 | + ) { |
|
| 130 | + // on est bien dans le contexte de traitement d'un formulaire en ajax |
|
| 131 | + // mais traiter ne veut pas |
|
| 132 | + // on le dit a la page qui va resumbit |
|
| 133 | + // sans ajax |
|
| 134 | + include_spip('inc/actions'); |
|
| 135 | + ajax_retour('noajax', false); |
|
| 136 | + exit; |
|
| 137 | + } |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | function traiter_appels_inclusions_ajax() { |
| 141 | - // traiter les appels de bloc ajax (ex: pagination) |
|
| 142 | - if ( |
|
| 143 | - $v = _request('var_ajax') |
|
| 144 | - and $v !== 'form' |
|
| 145 | - and $args = _request('var_ajax_env') |
|
| 146 | - ) { |
|
| 147 | - include_spip('inc/filtres'); |
|
| 148 | - include_spip('inc/actions'); |
|
| 149 | - if ( |
|
| 150 | - $args = decoder_contexte_ajax($args) |
|
| 151 | - and $fond = $args['fond'] |
|
| 152 | - ) { |
|
| 153 | - include_spip('public/assembler'); |
|
| 154 | - $contexte = calculer_contexte(); |
|
| 155 | - $contexte = array_merge($args, $contexte); |
|
| 156 | - $page = recuperer_fond($fond, $contexte, ['trim' => false]); |
|
| 157 | - $texte = $page; |
|
| 158 | - if ($ancre = _request('var_ajax_ancre')) { |
|
| 159 | - // pas n'importe quoi quand meme dans la variable ! |
|
| 160 | - $ancre = str_replace(['<', '"', "'"], ['<', '"', ''], $ancre); |
|
| 161 | - $texte = "<a href='#$ancre' name='ajax_ancre' style='display:none;'>anchor</a>" . $texte; |
|
| 162 | - } |
|
| 163 | - } else { |
|
| 164 | - include_spip('inc/headers'); |
|
| 165 | - http_response_code(400); |
|
| 166 | - $texte = _L('signature ajax bloc incorrecte'); |
|
| 167 | - } |
|
| 168 | - ajax_retour($texte, false); |
|
| 141 | + // traiter les appels de bloc ajax (ex: pagination) |
|
| 142 | + if ( |
|
| 143 | + $v = _request('var_ajax') |
|
| 144 | + and $v !== 'form' |
|
| 145 | + and $args = _request('var_ajax_env') |
|
| 146 | + ) { |
|
| 147 | + include_spip('inc/filtres'); |
|
| 148 | + include_spip('inc/actions'); |
|
| 149 | + if ( |
|
| 150 | + $args = decoder_contexte_ajax($args) |
|
| 151 | + and $fond = $args['fond'] |
|
| 152 | + ) { |
|
| 153 | + include_spip('public/assembler'); |
|
| 154 | + $contexte = calculer_contexte(); |
|
| 155 | + $contexte = array_merge($args, $contexte); |
|
| 156 | + $page = recuperer_fond($fond, $contexte, ['trim' => false]); |
|
| 157 | + $texte = $page; |
|
| 158 | + if ($ancre = _request('var_ajax_ancre')) { |
|
| 159 | + // pas n'importe quoi quand meme dans la variable ! |
|
| 160 | + $ancre = str_replace(['<', '"', "'"], ['<', '"', ''], $ancre); |
|
| 161 | + $texte = "<a href='#$ancre' name='ajax_ancre' style='display:none;'>anchor</a>" . $texte; |
|
| 162 | + } |
|
| 163 | + } else { |
|
| 164 | + include_spip('inc/headers'); |
|
| 165 | + http_response_code(400); |
|
| 166 | + $texte = _L('signature ajax bloc incorrecte'); |
|
| 167 | + } |
|
| 168 | + ajax_retour($texte, false); |
|
| 169 | 169 | |
| 170 | - return true; // on a fini le hit |
|
| 171 | - } |
|
| 170 | + return true; // on a fini le hit |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - return false; |
|
| 173 | + return false; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | // au 1er appel, traite les formulaires dynamiques charger/verifier/traiter |
@@ -178,172 +178,172 @@ discard block |
||
| 178 | 178 | // Le 1er renvoie True si il faut faire exit a la sortie |
| 179 | 179 | |
| 180 | 180 | function traiter_formulaires_dynamiques($get = false) { |
| 181 | - static $post = []; |
|
| 182 | - static $done = false; |
|
| 181 | + static $post = []; |
|
| 182 | + static $done = false; |
|
| 183 | 183 | |
| 184 | - if ($get) { |
|
| 185 | - return $post; |
|
| 186 | - } |
|
| 187 | - if ($done) { |
|
| 188 | - return false; |
|
| 189 | - } |
|
| 190 | - $done = true; |
|
| 184 | + if ($get) { |
|
| 185 | + return $post; |
|
| 186 | + } |
|
| 187 | + if ($done) { |
|
| 188 | + return false; |
|
| 189 | + } |
|
| 190 | + $done = true; |
|
| 191 | 191 | |
| 192 | - if ( |
|
| 193 | - !($form = _request('formulaire_action') |
|
| 194 | - and $args = _request('formulaire_action_args')) |
|
| 195 | - ) { |
|
| 196 | - return false; |
|
| 197 | - } // le hit peut continuer normalement |
|
| 192 | + if ( |
|
| 193 | + !($form = _request('formulaire_action') |
|
| 194 | + and $args = _request('formulaire_action_args')) |
|
| 195 | + ) { |
|
| 196 | + return false; |
|
| 197 | + } // le hit peut continuer normalement |
|
| 198 | 198 | |
| 199 | - // verifier que le post est licite (du meme auteur ou d'une session anonyme) |
|
| 200 | - $sign = _request('formulaire_action_sign'); |
|
| 201 | - if (!empty($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 202 | - if (empty($sign)) { |
|
| 203 | - spip_log("signature ajax form incorrecte : $form (formulaire non signe mais on a une session)", 'formulaires' . _LOG_ERREUR); |
|
| 204 | - return false; |
|
| 205 | - } |
|
| 206 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 207 | - $secu = $securiser_action($form, $args, '', -1); |
|
| 208 | - if ($sign !== $secu['hash']) { |
|
| 209 | - spip_log("signature ajax form incorrecte : $form (formulaire signe mais ne correspond pas a la session)", 'formulaires' . _LOG_ERREUR); |
|
| 210 | - return false; |
|
| 211 | - } |
|
| 212 | - } |
|
| 213 | - else { |
|
| 214 | - if (!empty($sign)) { |
|
| 215 | - spip_log("signature ajax form incorrecte : $form (formulaire signe mais pas de session)", 'formulaires' . _LOG_ERREUR); |
|
| 216 | - return false; |
|
| 217 | - } |
|
| 218 | - } |
|
| 199 | + // verifier que le post est licite (du meme auteur ou d'une session anonyme) |
|
| 200 | + $sign = _request('formulaire_action_sign'); |
|
| 201 | + if (!empty($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 202 | + if (empty($sign)) { |
|
| 203 | + spip_log("signature ajax form incorrecte : $form (formulaire non signe mais on a une session)", 'formulaires' . _LOG_ERREUR); |
|
| 204 | + return false; |
|
| 205 | + } |
|
| 206 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 207 | + $secu = $securiser_action($form, $args, '', -1); |
|
| 208 | + if ($sign !== $secu['hash']) { |
|
| 209 | + spip_log("signature ajax form incorrecte : $form (formulaire signe mais ne correspond pas a la session)", 'formulaires' . _LOG_ERREUR); |
|
| 210 | + return false; |
|
| 211 | + } |
|
| 212 | + } |
|
| 213 | + else { |
|
| 214 | + if (!empty($sign)) { |
|
| 215 | + spip_log("signature ajax form incorrecte : $form (formulaire signe mais pas de session)", 'formulaires' . _LOG_ERREUR); |
|
| 216 | + return false; |
|
| 217 | + } |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | - include_spip('inc/filtres'); |
|
| 221 | - if (($args = decoder_contexte_ajax($args, $form)) === false) { |
|
| 222 | - spip_log("signature ajax form incorrecte : $form (encodage corrompu)", 'formulaires' . _LOG_ERREUR); |
|
| 220 | + include_spip('inc/filtres'); |
|
| 221 | + if (($args = decoder_contexte_ajax($args, $form)) === false) { |
|
| 222 | + spip_log("signature ajax form incorrecte : $form (encodage corrompu)", 'formulaires' . _LOG_ERREUR); |
|
| 223 | 223 | |
| 224 | - return false; // continuons le hit comme si de rien etait |
|
| 225 | - } else { |
|
| 226 | - include_spip('inc/lang'); |
|
| 227 | - // sauvegarder la lang en cours |
|
| 228 | - $old_lang = $GLOBALS['spip_lang']; |
|
| 229 | - // changer la langue avec celle qui a cours dans le formulaire |
|
| 230 | - // on la depile de $args car c'est un argument implicite masque |
|
| 231 | - changer_langue(array_shift($args)); |
|
| 224 | + return false; // continuons le hit comme si de rien etait |
|
| 225 | + } else { |
|
| 226 | + include_spip('inc/lang'); |
|
| 227 | + // sauvegarder la lang en cours |
|
| 228 | + $old_lang = $GLOBALS['spip_lang']; |
|
| 229 | + // changer la langue avec celle qui a cours dans le formulaire |
|
| 230 | + // on la depile de $args car c'est un argument implicite masque |
|
| 231 | + changer_langue(array_shift($args)); |
|
| 232 | 232 | |
| 233 | 233 | |
| 234 | - // inclure mes_fonctions et autres filtres avant verifier/traiter |
|
| 235 | - include_fichiers_fonctions(); |
|
| 236 | - // ainsi que l'API SQL bien utile dans verifier/traiter |
|
| 237 | - include_spip('base/abstract_sql'); |
|
| 234 | + // inclure mes_fonctions et autres filtres avant verifier/traiter |
|
| 235 | + include_fichiers_fonctions(); |
|
| 236 | + // ainsi que l'API SQL bien utile dans verifier/traiter |
|
| 237 | + include_spip('base/abstract_sql'); |
|
| 238 | 238 | |
| 239 | - /** |
|
| 240 | - * Pipeline exécuté lors de la soumission d'un formulaire, |
|
| 241 | - * mais avant l'appel de la fonction de vérification. |
|
| 242 | - */ |
|
| 243 | - pipeline( |
|
| 244 | - 'formulaire_receptionner', |
|
| 245 | - [ |
|
| 246 | - 'args' => ['form' => $form, 'args' => $args], |
|
| 247 | - 'data' => null, |
|
| 248 | - ] |
|
| 249 | - ); |
|
| 239 | + /** |
|
| 240 | + * Pipeline exécuté lors de la soumission d'un formulaire, |
|
| 241 | + * mais avant l'appel de la fonction de vérification. |
|
| 242 | + */ |
|
| 243 | + pipeline( |
|
| 244 | + 'formulaire_receptionner', |
|
| 245 | + [ |
|
| 246 | + 'args' => ['form' => $form, 'args' => $args], |
|
| 247 | + 'data' => null, |
|
| 248 | + ] |
|
| 249 | + ); |
|
| 250 | 250 | |
| 251 | - $verifier = charger_fonction('verifier', "formulaires/$form/", true); |
|
| 252 | - $post["erreurs_$form"] = pipeline( |
|
| 253 | - 'formulaire_verifier', |
|
| 254 | - [ |
|
| 255 | - 'args' => ['form' => $form, 'args' => $args], |
|
| 256 | - 'data' => $verifier ? $verifier(...$args) : [] |
|
| 257 | - ] |
|
| 258 | - ); |
|
| 259 | - // prise en charge CVT multi etape si besoin |
|
| 260 | - if (_request('cvtm_prev_post')) { |
|
| 261 | - include_spip('inc/cvt_multietapes'); |
|
| 262 | - $post["erreurs_$form"] = cvtmulti_formulaire_verifier_etapes( |
|
| 263 | - ['form' => $form, 'args' => $args], |
|
| 264 | - $post["erreurs_$form"] |
|
| 265 | - ); |
|
| 266 | - } |
|
| 251 | + $verifier = charger_fonction('verifier', "formulaires/$form/", true); |
|
| 252 | + $post["erreurs_$form"] = pipeline( |
|
| 253 | + 'formulaire_verifier', |
|
| 254 | + [ |
|
| 255 | + 'args' => ['form' => $form, 'args' => $args], |
|
| 256 | + 'data' => $verifier ? $verifier(...$args) : [] |
|
| 257 | + ] |
|
| 258 | + ); |
|
| 259 | + // prise en charge CVT multi etape si besoin |
|
| 260 | + if (_request('cvtm_prev_post')) { |
|
| 261 | + include_spip('inc/cvt_multietapes'); |
|
| 262 | + $post["erreurs_$form"] = cvtmulti_formulaire_verifier_etapes( |
|
| 263 | + ['form' => $form, 'args' => $args], |
|
| 264 | + $post["erreurs_$form"] |
|
| 265 | + ); |
|
| 266 | + } |
|
| 267 | 267 | |
| 268 | - // accessibilite : si des erreurs mais pas de message general l'ajouter |
|
| 269 | - if ((isset($post["erreurs_$form"]) and is_countable($post["erreurs_$form"]) ? count($post["erreurs_$form"]) : 0) and !isset($post["erreurs_$form"]['message_erreur'])) { |
|
| 270 | - $post["erreurs_$form"]['message_erreur'] = singulier_ou_pluriel( |
|
| 271 | - is_countable($post["erreurs_$form"]) ? count($post["erreurs_$form"]) : 0, |
|
| 272 | - 'avis_1_erreur_saisie', |
|
| 273 | - 'avis_nb_erreurs_saisie' |
|
| 274 | - ); |
|
| 275 | - } |
|
| 268 | + // accessibilite : si des erreurs mais pas de message general l'ajouter |
|
| 269 | + if ((isset($post["erreurs_$form"]) and is_countable($post["erreurs_$form"]) ? count($post["erreurs_$form"]) : 0) and !isset($post["erreurs_$form"]['message_erreur'])) { |
|
| 270 | + $post["erreurs_$form"]['message_erreur'] = singulier_ou_pluriel( |
|
| 271 | + is_countable($post["erreurs_$form"]) ? count($post["erreurs_$form"]) : 0, |
|
| 272 | + 'avis_1_erreur_saisie', |
|
| 273 | + 'avis_nb_erreurs_saisie' |
|
| 274 | + ); |
|
| 275 | + } |
|
| 276 | 276 | |
| 277 | - // si on ne demandait qu'une verif json |
|
| 278 | - if (_request('formulaire_action_verifier_json')) { |
|
| 279 | - include_spip('inc/json'); |
|
| 280 | - include_spip('inc/actions'); |
|
| 281 | - ajax_retour(json_encode($post["erreurs_$form"], JSON_THROW_ON_ERROR), 'text/plain'); |
|
| 277 | + // si on ne demandait qu'une verif json |
|
| 278 | + if (_request('formulaire_action_verifier_json')) { |
|
| 279 | + include_spip('inc/json'); |
|
| 280 | + include_spip('inc/actions'); |
|
| 281 | + ajax_retour(json_encode($post["erreurs_$form"], JSON_THROW_ON_ERROR), 'text/plain'); |
|
| 282 | 282 | |
| 283 | - return true; // on a fini le hit |
|
| 284 | - } |
|
| 285 | - $retour = ''; |
|
| 286 | - if (isset($post["erreurs_$form"]) and ((is_countable($post["erreurs_$form"]) ? count($post["erreurs_$form"]) : 0) == 0)) { |
|
| 287 | - $rev = ''; |
|
| 288 | - if ($traiter = charger_fonction('traiter', "formulaires/$form/", true)) { |
|
| 289 | - $rev = $traiter(...$args); |
|
| 290 | - } |
|
| 283 | + return true; // on a fini le hit |
|
| 284 | + } |
|
| 285 | + $retour = ''; |
|
| 286 | + if (isset($post["erreurs_$form"]) and ((is_countable($post["erreurs_$form"]) ? count($post["erreurs_$form"]) : 0) == 0)) { |
|
| 287 | + $rev = ''; |
|
| 288 | + if ($traiter = charger_fonction('traiter', "formulaires/$form/", true)) { |
|
| 289 | + $rev = $traiter(...$args); |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - $rev = pipeline( |
|
| 293 | - 'formulaire_traiter', |
|
| 294 | - [ |
|
| 295 | - 'args' => ['form' => $form, 'args' => $args], |
|
| 296 | - 'data' => $rev |
|
| 297 | - ] |
|
| 298 | - ); |
|
| 299 | - // le retour de traiter est |
|
| 300 | - // un tableau explicite ('editable'=>$editable,'message_ok'=>$message,'redirect'=>$redirect,'id_xx'=>$id_xx) |
|
| 301 | - // il permet le pipelinage, en particulier |
|
| 302 | - // en y passant l'id de l'objet cree/modifie |
|
| 303 | - // si message_erreur est present, on considere que le traitement a echoue |
|
| 304 | - $post["message_ok_$form"] = ''; |
|
| 305 | - // on peut avoir message_ok et message_erreur |
|
| 306 | - if (isset($rev['message_ok'])) { |
|
| 307 | - $post["message_ok_$form"] = $rev['message_ok']; |
|
| 308 | - } |
|
| 292 | + $rev = pipeline( |
|
| 293 | + 'formulaire_traiter', |
|
| 294 | + [ |
|
| 295 | + 'args' => ['form' => $form, 'args' => $args], |
|
| 296 | + 'data' => $rev |
|
| 297 | + ] |
|
| 298 | + ); |
|
| 299 | + // le retour de traiter est |
|
| 300 | + // un tableau explicite ('editable'=>$editable,'message_ok'=>$message,'redirect'=>$redirect,'id_xx'=>$id_xx) |
|
| 301 | + // il permet le pipelinage, en particulier |
|
| 302 | + // en y passant l'id de l'objet cree/modifie |
|
| 303 | + // si message_erreur est present, on considere que le traitement a echoue |
|
| 304 | + $post["message_ok_$form"] = ''; |
|
| 305 | + // on peut avoir message_ok et message_erreur |
|
| 306 | + if (isset($rev['message_ok'])) { |
|
| 307 | + $post["message_ok_$form"] = $rev['message_ok']; |
|
| 308 | + } |
|
| 309 | 309 | |
| 310 | - // verifier si traiter n'a pas echoue avec une erreur : |
|
| 311 | - if (isset($rev['message_erreur'])) { |
|
| 312 | - $post["erreurs_$form"]['message_erreur'] = $rev['message_erreur']; |
|
| 313 | - // si il y a une erreur on ne redirige pas |
|
| 314 | - } else { |
|
| 315 | - // sinon faire ce qu'il faut : |
|
| 316 | - if (isset($rev['editable'])) { |
|
| 317 | - $post["editable_$form"] = $rev['editable']; |
|
| 318 | - } |
|
| 319 | - // si une redirection est demandee, appeler redirigae_formulaire qui choisira |
|
| 320 | - // le bon mode de redirection (302 et on ne revient pas ici, ou javascript et on continue) |
|
| 321 | - if (isset($rev['redirect']) and $rev['redirect']) { |
|
| 322 | - include_spip('inc/headers'); |
|
| 323 | - [$masque, $message] = redirige_formulaire($rev['redirect'], '', 'ajaxform'); |
|
| 324 | - $post["message_ok_$form"] .= $message; |
|
| 325 | - $retour .= $masque; |
|
| 326 | - } |
|
| 327 | - } |
|
| 328 | - } |
|
| 329 | - // si le formulaire a ete soumis en ajax, on le renvoie direct ! |
|
| 330 | - if (_request('var_ajax')) { |
|
| 331 | - if (find_in_path('formulaire_.php', 'balise/', true)) { |
|
| 332 | - include_spip('inc/actions'); |
|
| 333 | - include_spip('public/assembler'); |
|
| 334 | - $retour .= inclure_balise_dynamique(balise_formulaire__dyn($form, ...$args), false); |
|
| 335 | - // on ajoute un br en display none en tete du retour ajax pour regler un bug dans IE6/7 |
|
| 336 | - // sans cela le formulaire n'est pas actif apres le hit ajax |
|
| 337 | - // la classe ajax-form-is-ok sert a s'assurer que le retour ajax s'est bien passe |
|
| 338 | - $retour = "<br class='bugajaxie ajax-form-is-ok' style='display:none;'/>" . $retour; |
|
| 339 | - ajax_retour($retour, false); |
|
| 310 | + // verifier si traiter n'a pas echoue avec une erreur : |
|
| 311 | + if (isset($rev['message_erreur'])) { |
|
| 312 | + $post["erreurs_$form"]['message_erreur'] = $rev['message_erreur']; |
|
| 313 | + // si il y a une erreur on ne redirige pas |
|
| 314 | + } else { |
|
| 315 | + // sinon faire ce qu'il faut : |
|
| 316 | + if (isset($rev['editable'])) { |
|
| 317 | + $post["editable_$form"] = $rev['editable']; |
|
| 318 | + } |
|
| 319 | + // si une redirection est demandee, appeler redirigae_formulaire qui choisira |
|
| 320 | + // le bon mode de redirection (302 et on ne revient pas ici, ou javascript et on continue) |
|
| 321 | + if (isset($rev['redirect']) and $rev['redirect']) { |
|
| 322 | + include_spip('inc/headers'); |
|
| 323 | + [$masque, $message] = redirige_formulaire($rev['redirect'], '', 'ajaxform'); |
|
| 324 | + $post["message_ok_$form"] .= $message; |
|
| 325 | + $retour .= $masque; |
|
| 326 | + } |
|
| 327 | + } |
|
| 328 | + } |
|
| 329 | + // si le formulaire a ete soumis en ajax, on le renvoie direct ! |
|
| 330 | + if (_request('var_ajax')) { |
|
| 331 | + if (find_in_path('formulaire_.php', 'balise/', true)) { |
|
| 332 | + include_spip('inc/actions'); |
|
| 333 | + include_spip('public/assembler'); |
|
| 334 | + $retour .= inclure_balise_dynamique(balise_formulaire__dyn($form, ...$args), false); |
|
| 335 | + // on ajoute un br en display none en tete du retour ajax pour regler un bug dans IE6/7 |
|
| 336 | + // sans cela le formulaire n'est pas actif apres le hit ajax |
|
| 337 | + // la classe ajax-form-is-ok sert a s'assurer que le retour ajax s'est bien passe |
|
| 338 | + $retour = "<br class='bugajaxie ajax-form-is-ok' style='display:none;'/>" . $retour; |
|
| 339 | + ajax_retour($retour, false); |
|
| 340 | 340 | |
| 341 | - return true; // on a fini le hit |
|
| 342 | - } |
|
| 343 | - } |
|
| 344 | - // restaurer la lang en cours |
|
| 345 | - changer_langue($old_lang); |
|
| 346 | - } |
|
| 341 | + return true; // on a fini le hit |
|
| 342 | + } |
|
| 343 | + } |
|
| 344 | + // restaurer la lang en cours |
|
| 345 | + changer_langue($old_lang); |
|
| 346 | + } |
|
| 347 | 347 | |
| 348 | - return false; // le hit peut continuer normalement |
|
| 348 | + return false; // le hit peut continuer normalement |
|
| 349 | 349 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | 22 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 23 | - return; |
|
| 23 | + return; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | include_spip('inc/config'); |
@@ -32,31 +32,31 @@ discard block |
||
| 32 | 32 | * @return array|false |
| 33 | 33 | */ |
| 34 | 34 | function cvtconf_formulaire_charger($flux) { |
| 35 | - if ( |
|
| 36 | - $form = $flux['args']['form'] |
|
| 37 | - and strncmp($form, 'configurer_', 11) == 0 // un #FORMULAIRE_CONFIGURER_XXX |
|
| 38 | - ) { |
|
| 39 | - // Pour tous les formulaires CONFIGURER, ayant une fonction charger ou pas, on teste si autorisé |
|
| 40 | - include_spip('inc/autoriser'); |
|
| 41 | - if (!autoriser('configurer', '_' . substr($form, 11))) { |
|
| 42 | - return false; |
|
| 43 | - } |
|
| 35 | + if ( |
|
| 36 | + $form = $flux['args']['form'] |
|
| 37 | + and strncmp($form, 'configurer_', 11) == 0 // un #FORMULAIRE_CONFIGURER_XXX |
|
| 38 | + ) { |
|
| 39 | + // Pour tous les formulaires CONFIGURER, ayant une fonction charger ou pas, on teste si autorisé |
|
| 40 | + include_spip('inc/autoriser'); |
|
| 41 | + if (!autoriser('configurer', '_' . substr($form, 11))) { |
|
| 42 | + return false; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - // S'il n'y a pas de fonction charger(), on génère un contexte automatiquement |
|
| 46 | - if (!charger_fonction('charger', "formulaires/$form/", true)) { |
|
| 47 | - $flux['data'] = cvtconf_formulaires_configurer_recense($form); |
|
| 48 | - $flux['data']['editable'] = true; |
|
| 49 | - if (_request('var_mode') == 'configurer' and autoriser('webmestre')) { |
|
| 50 | - if (!_AJAX) { |
|
| 51 | - var_dump($flux['data']); |
|
| 52 | - } |
|
| 53 | - // reinjecter pour la trace au traitement |
|
| 54 | - $flux['data']['_hidden'] = "<input type='hidden' name='var_mode' value='configurer' />"; |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - } |
|
| 45 | + // S'il n'y a pas de fonction charger(), on génère un contexte automatiquement |
|
| 46 | + if (!charger_fonction('charger', "formulaires/$form/", true)) { |
|
| 47 | + $flux['data'] = cvtconf_formulaires_configurer_recense($form); |
|
| 48 | + $flux['data']['editable'] = true; |
|
| 49 | + if (_request('var_mode') == 'configurer' and autoriser('webmestre')) { |
|
| 50 | + if (!_AJAX) { |
|
| 51 | + var_dump($flux['data']); |
|
| 52 | + } |
|
| 53 | + // reinjecter pour la trace au traitement |
|
| 54 | + $flux['data']['_hidden'] = "<input type='hidden' name='var_mode' value='configurer' />"; |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - return $flux; |
|
| 59 | + return $flux; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | * @return array |
| 67 | 67 | */ |
| 68 | 68 | function cvtconf_formulaire_traiter($flux) { |
| 69 | - if ( |
|
| 70 | - $form = $flux['args']['form'] |
|
| 71 | - and strncmp($form, 'configurer_', 11) == 0 // un #FORMULAIRE_CONFIGURER_XXX |
|
| 72 | - and !charger_fonction('traiter', "formulaires/$form/", true) // sans fonction traiter() |
|
| 73 | - ) { |
|
| 74 | - $trace = cvtconf_formulaires_configurer_enregistre($form, $flux['args']['args']); |
|
| 75 | - $flux['data'] = ['message_ok' => _T('config_info_enregistree') . $trace, 'editable' => true]; |
|
| 76 | - } |
|
| 69 | + if ( |
|
| 70 | + $form = $flux['args']['form'] |
|
| 71 | + and strncmp($form, 'configurer_', 11) == 0 // un #FORMULAIRE_CONFIGURER_XXX |
|
| 72 | + and !charger_fonction('traiter', "formulaires/$form/", true) // sans fonction traiter() |
|
| 73 | + ) { |
|
| 74 | + $trace = cvtconf_formulaires_configurer_enregistre($form, $flux['args']['args']); |
|
| 75 | + $flux['data'] = ['message_ok' => _T('config_info_enregistree') . $trace, 'editable' => true]; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - return $flux; |
|
| 78 | + return $flux; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -91,32 +91,32 @@ discard block |
||
| 91 | 91 | * @return string |
| 92 | 92 | */ |
| 93 | 93 | function cvtconf_formulaires_configurer_enregistre($form, $args) { |
| 94 | - $valeurs = []; |
|
| 95 | - // charger les valeurs |
|
| 96 | - // ce qui permet de prendre en charge une fonction charger() existante |
|
| 97 | - // qui prend alors la main sur l'auto detection |
|
| 98 | - if ($charger_valeurs = charger_fonction('charger', "formulaires/$form/", true)) { |
|
| 99 | - $valeurs = $charger_valeurs(...$args); |
|
| 100 | - } |
|
| 101 | - $valeurs = pipeline( |
|
| 102 | - 'formulaire_charger', |
|
| 103 | - [ |
|
| 104 | - 'args' => ['form' => $form, 'args' => $args, 'je_suis_poste' => false], |
|
| 105 | - 'data' => $valeurs |
|
| 106 | - ] |
|
| 107 | - ); |
|
| 108 | - // ne pas stocker editable ! |
|
| 109 | - unset($valeurs['editable']); |
|
| 94 | + $valeurs = []; |
|
| 95 | + // charger les valeurs |
|
| 96 | + // ce qui permet de prendre en charge une fonction charger() existante |
|
| 97 | + // qui prend alors la main sur l'auto detection |
|
| 98 | + if ($charger_valeurs = charger_fonction('charger', "formulaires/$form/", true)) { |
|
| 99 | + $valeurs = $charger_valeurs(...$args); |
|
| 100 | + } |
|
| 101 | + $valeurs = pipeline( |
|
| 102 | + 'formulaire_charger', |
|
| 103 | + [ |
|
| 104 | + 'args' => ['form' => $form, 'args' => $args, 'je_suis_poste' => false], |
|
| 105 | + 'data' => $valeurs |
|
| 106 | + ] |
|
| 107 | + ); |
|
| 108 | + // ne pas stocker editable ! |
|
| 109 | + unset($valeurs['editable']); |
|
| 110 | 110 | |
| 111 | - // recuperer les valeurs postees |
|
| 112 | - $store = []; |
|
| 113 | - foreach ($valeurs as $k => $v) { |
|
| 114 | - if (substr($k, 0, 1) !== '_') { |
|
| 115 | - $store[$k] = _request($k); |
|
| 116 | - } |
|
| 117 | - } |
|
| 111 | + // recuperer les valeurs postees |
|
| 112 | + $store = []; |
|
| 113 | + foreach ($valeurs as $k => $v) { |
|
| 114 | + if (substr($k, 0, 1) !== '_') { |
|
| 115 | + $store[$k] = _request($k); |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - return cvtconf_configurer_stocker($form, $valeurs, $store); |
|
| 119 | + return cvtconf_configurer_stocker($form, $valeurs, $store); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -132,31 +132,31 @@ discard block |
||
| 132 | 132 | * @return array |
| 133 | 133 | */ |
| 134 | 134 | function cvtconf_definir_configurer_conteneur($form, $valeurs) { |
| 135 | - // stocker en base |
|
| 136 | - // par defaut, dans un casier serialize dans spip_meta (idem CFG) |
|
| 137 | - $casier = substr($form, 11); |
|
| 138 | - $table = 'meta'; |
|
| 139 | - $prefixe = ''; |
|
| 140 | - $stockage = ''; |
|
| 135 | + // stocker en base |
|
| 136 | + // par defaut, dans un casier serialize dans spip_meta (idem CFG) |
|
| 137 | + $casier = substr($form, 11); |
|
| 138 | + $table = 'meta'; |
|
| 139 | + $prefixe = ''; |
|
| 140 | + $stockage = ''; |
|
| 141 | 141 | |
| 142 | - if (isset($valeurs['_meta_casier'])) { |
|
| 143 | - $casier = $valeurs['_meta_casier']; |
|
| 144 | - } |
|
| 145 | - if (isset($valeurs['_meta_prefixe'])) { |
|
| 146 | - $prefixe = $valeurs['_meta_prefixe']; |
|
| 147 | - } |
|
| 148 | - if (isset($valeurs['_meta_stockage'])) { |
|
| 149 | - $stockage = $valeurs['_meta_stockage'] . '::'; |
|
| 150 | - } |
|
| 142 | + if (isset($valeurs['_meta_casier'])) { |
|
| 143 | + $casier = $valeurs['_meta_casier']; |
|
| 144 | + } |
|
| 145 | + if (isset($valeurs['_meta_prefixe'])) { |
|
| 146 | + $prefixe = $valeurs['_meta_prefixe']; |
|
| 147 | + } |
|
| 148 | + if (isset($valeurs['_meta_stockage'])) { |
|
| 149 | + $stockage = $valeurs['_meta_stockage'] . '::'; |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - // si on indique juste une table, il faut vider les autres proprietes |
|
| 153 | - // car par defaut on utilise ni casier ni prefixe dans ce cas |
|
| 154 | - if (isset($valeurs['_meta_table'])) { |
|
| 155 | - $table = $valeurs['_meta_table']; |
|
| 156 | - $casier = ($valeurs['_meta_casier'] ?? ''); |
|
| 157 | - } |
|
| 152 | + // si on indique juste une table, il faut vider les autres proprietes |
|
| 153 | + // car par defaut on utilise ni casier ni prefixe dans ce cas |
|
| 154 | + if (isset($valeurs['_meta_table'])) { |
|
| 155 | + $table = $valeurs['_meta_table']; |
|
| 156 | + $casier = ($valeurs['_meta_casier'] ?? ''); |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - return [$table, $casier, $prefixe, $stockage]; |
|
| 159 | + return [$table, $casier, $prefixe, $stockage]; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -167,48 +167,48 @@ discard block |
||
| 167 | 167 | * @return array |
| 168 | 168 | */ |
| 169 | 169 | function cvtconf_formulaires_configurer_recense($form) { |
| 170 | - $valeurs = ['editable' => ' ']; |
|
| 170 | + $valeurs = ['editable' => ' ']; |
|
| 171 | 171 | |
| 172 | - // sinon cas analyse du squelette |
|
| 173 | - if ( |
|
| 174 | - $f = find_in_path($form . '.' . _EXTENSION_SQUELETTES, 'formulaires/') |
|
| 175 | - and lire_fichier($f, $contenu) |
|
| 176 | - ) { |
|
| 177 | - for ($i = 0; $i < 2; $i++) { |
|
| 178 | - // a la seconde iteration, evaluer le fond avec les valeurs deja trouvees |
|
| 179 | - // permet de trouver aussi les name="#GET{truc}" |
|
| 180 | - if ($i == 1) { |
|
| 181 | - $contenu = recuperer_fond("formulaires/$form", $valeurs); |
|
| 182 | - } |
|
| 172 | + // sinon cas analyse du squelette |
|
| 173 | + if ( |
|
| 174 | + $f = find_in_path($form . '.' . _EXTENSION_SQUELETTES, 'formulaires/') |
|
| 175 | + and lire_fichier($f, $contenu) |
|
| 176 | + ) { |
|
| 177 | + for ($i = 0; $i < 2; $i++) { |
|
| 178 | + // a la seconde iteration, evaluer le fond avec les valeurs deja trouvees |
|
| 179 | + // permet de trouver aussi les name="#GET{truc}" |
|
| 180 | + if ($i == 1) { |
|
| 181 | + $contenu = recuperer_fond("formulaires/$form", $valeurs); |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - $balises = array_merge( |
|
| 185 | - extraire_balises($contenu, 'input'), |
|
| 186 | - extraire_balises($contenu, 'textarea'), |
|
| 187 | - extraire_balises($contenu, 'select') |
|
| 188 | - ); |
|
| 184 | + $balises = array_merge( |
|
| 185 | + extraire_balises($contenu, 'input'), |
|
| 186 | + extraire_balises($contenu, 'textarea'), |
|
| 187 | + extraire_balises($contenu, 'select') |
|
| 188 | + ); |
|
| 189 | 189 | |
| 190 | - foreach ($balises as $b) { |
|
| 191 | - if ( |
|
| 192 | - $n = extraire_attribut($b, 'name') |
|
| 193 | - and preg_match(',^([\w\-]+)(\[\w*\])?$,', $n, $r) |
|
| 194 | - and !in_array($n, ['formulaire_action', 'formulaire_action_args', 'formulaire_action_sign']) |
|
| 195 | - and extraire_attribut($b, 'type') !== 'submit' |
|
| 196 | - ) { |
|
| 197 | - $valeurs[$r[1]] = ''; |
|
| 198 | - // recuperer les valeurs _meta_xx qui peuvent etre fournies |
|
| 199 | - // en input hidden dans le squelette |
|
| 200 | - if (strncmp($r[1], '_meta_', 6) == 0) { |
|
| 201 | - $valeurs[$r[1]] = extraire_attribut($b, 'value'); |
|
| 202 | - } |
|
| 203 | - } |
|
| 204 | - } |
|
| 205 | - } |
|
| 206 | - } |
|
| 190 | + foreach ($balises as $b) { |
|
| 191 | + if ( |
|
| 192 | + $n = extraire_attribut($b, 'name') |
|
| 193 | + and preg_match(',^([\w\-]+)(\[\w*\])?$,', $n, $r) |
|
| 194 | + and !in_array($n, ['formulaire_action', 'formulaire_action_args', 'formulaire_action_sign']) |
|
| 195 | + and extraire_attribut($b, 'type') !== 'submit' |
|
| 196 | + ) { |
|
| 197 | + $valeurs[$r[1]] = ''; |
|
| 198 | + // recuperer les valeurs _meta_xx qui peuvent etre fournies |
|
| 199 | + // en input hidden dans le squelette |
|
| 200 | + if (strncmp($r[1], '_meta_', 6) == 0) { |
|
| 201 | + $valeurs[$r[1]] = extraire_attribut($b, 'value'); |
|
| 202 | + } |
|
| 203 | + } |
|
| 204 | + } |
|
| 205 | + } |
|
| 206 | + } |
|
| 207 | 207 | |
| 208 | 208 | |
| 209 | - cvtconf_configurer_lire_meta($form, $valeurs); |
|
| 209 | + cvtconf_configurer_lire_meta($form, $valeurs); |
|
| 210 | 210 | |
| 211 | - return $valeurs; |
|
| 211 | + return $valeurs; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -220,26 +220,26 @@ discard block |
||
| 220 | 220 | * @return string |
| 221 | 221 | */ |
| 222 | 222 | function cvtconf_configurer_stocker($form, $valeurs, $store) { |
| 223 | - $trace = ''; |
|
| 224 | - [$table, $casier, $prefixe, $stockage] = cvtconf_definir_configurer_conteneur($form, $valeurs); |
|
| 225 | - // stocker en base |
|
| 226 | - // par defaut, dans un casier serialize dans spip_meta (idem CFG) |
|
| 227 | - if (!isset($GLOBALS[$table])) { |
|
| 228 | - lire_metas($table); |
|
| 229 | - } |
|
| 223 | + $trace = ''; |
|
| 224 | + [$table, $casier, $prefixe, $stockage] = cvtconf_definir_configurer_conteneur($form, $valeurs); |
|
| 225 | + // stocker en base |
|
| 226 | + // par defaut, dans un casier serialize dans spip_meta (idem CFG) |
|
| 227 | + if (!isset($GLOBALS[$table])) { |
|
| 228 | + lire_metas($table); |
|
| 229 | + } |
|
| 230 | 230 | |
| 231 | - $prefixe = ($prefixe ? $prefixe . '_' : ''); |
|
| 232 | - $table = ($table) ? "/$table/" : ''; |
|
| 233 | - $casier = ($casier) ? rtrim($casier, '/') . '/' : ''; // slash final, sinon rien |
|
| 231 | + $prefixe = ($prefixe ? $prefixe . '_' : ''); |
|
| 232 | + $table = ($table) ? "/$table/" : ''; |
|
| 233 | + $casier = ($casier) ? rtrim($casier, '/') . '/' : ''; // slash final, sinon rien |
|
| 234 | 234 | |
| 235 | - foreach ($store as $k => $v) { |
|
| 236 | - ecrire_config("$stockage$table$prefixe$casier$k", $v); |
|
| 237 | - if (_request('var_mode') == 'configurer' and autoriser('webmestre')) { |
|
| 238 | - $trace .= "<br />table $table : " . $prefixe . $k . " = $v;"; |
|
| 239 | - } |
|
| 240 | - } |
|
| 235 | + foreach ($store as $k => $v) { |
|
| 236 | + ecrire_config("$stockage$table$prefixe$casier$k", $v); |
|
| 237 | + if (_request('var_mode') == 'configurer' and autoriser('webmestre')) { |
|
| 238 | + $trace .= "<br />table $table : " . $prefixe . $k . " = $v;"; |
|
| 239 | + } |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | - return $trace; |
|
| 242 | + return $trace; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -249,21 +249,21 @@ discard block |
||
| 249 | 249 | * @param array $valeurs |
| 250 | 250 | */ |
| 251 | 251 | function cvtconf_configurer_lire_meta($form, &$valeurs) { |
| 252 | - [$table, $casier, $prefixe, $stockage] = cvtconf_definir_configurer_conteneur($form, $valeurs); |
|
| 252 | + [$table, $casier, $prefixe, $stockage] = cvtconf_definir_configurer_conteneur($form, $valeurs); |
|
| 253 | 253 | |
| 254 | - $table = ($table) ? "/$table/" : ''; |
|
| 255 | - $prefixe = ($prefixe ? $prefixe . '_' : ''); |
|
| 256 | - if ($casier) { |
|
| 257 | - $meta = lire_config("$stockage$table$prefixe$casier"); |
|
| 258 | - $prefixe = ''; |
|
| 259 | - } else { |
|
| 260 | - $table = rtrim($table, '/'); |
|
| 261 | - $meta = lire_config("$stockage$table"); |
|
| 262 | - } |
|
| 254 | + $table = ($table) ? "/$table/" : ''; |
|
| 255 | + $prefixe = ($prefixe ? $prefixe . '_' : ''); |
|
| 256 | + if ($casier) { |
|
| 257 | + $meta = lire_config("$stockage$table$prefixe$casier"); |
|
| 258 | + $prefixe = ''; |
|
| 259 | + } else { |
|
| 260 | + $table = rtrim($table, '/'); |
|
| 261 | + $meta = lire_config("$stockage$table"); |
|
| 262 | + } |
|
| 263 | 263 | |
| 264 | - foreach ($valeurs as $k => $v) { |
|
| 265 | - if (substr($k, 0, 1) !== '_') { |
|
| 266 | - $valeurs[$k] = ($meta[$prefixe . $k] ?? null); |
|
| 267 | - } |
|
| 268 | - } |
|
| 264 | + foreach ($valeurs as $k => $v) { |
|
| 265 | + if (substr($k, 0, 1) !== '_') { |
|
| 266 | + $valeurs[$k] = ($meta[$prefixe . $k] ?? null); |
|
| 267 | + } |
|
| 268 | + } |
|
| 269 | 269 | } |
@@ -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 | include_spip('inc/charsets'); |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | * @return string |
| 33 | 33 | */ |
| 34 | 34 | function exporter_csv_champ($champ) { |
| 35 | - #$champ = str_replace("\r", "\n", $champ); |
|
| 36 | - #$champ = preg_replace(",[\n]+,ms", "\n", $champ); |
|
| 37 | - #$champ = str_replace("\n", ", ", $champ); |
|
| 38 | - $champ = preg_replace(',[\s]+,ms', ' ', $champ); |
|
| 39 | - $champ = str_replace('"', '""', $champ); |
|
| 35 | + #$champ = str_replace("\r", "\n", $champ); |
|
| 36 | + #$champ = preg_replace(",[\n]+,ms", "\n", $champ); |
|
| 37 | + #$champ = str_replace("\n", ", ", $champ); |
|
| 38 | + $champ = preg_replace(',[\s]+,ms', ' ', $champ); |
|
| 39 | + $champ = str_replace('"', '""', $champ); |
|
| 40 | 40 | |
| 41 | - return '"' . $champ . '"'; |
|
| 41 | + return '"' . $champ . '"'; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | * @return string |
| 56 | 56 | */ |
| 57 | 57 | function exporter_csv_ligne_numerotee($nb, $ligne, $delim = ',', $importer_charset = null, ?callable $callback = null) { |
| 58 | - if ($callback) { |
|
| 59 | - $ligne = $callback($nb, $ligne, $delim, $importer_charset); |
|
| 60 | - } |
|
| 61 | - $output = join($delim, array_map('exporter_csv_champ', $ligne)) . "\r\n"; |
|
| 62 | - if ($importer_charset) { |
|
| 63 | - $output = str_replace('’', '\'', $output); |
|
| 64 | - $output = unicode2charset(html2unicode(charset2unicode($output)), $importer_charset); |
|
| 65 | - } |
|
| 66 | - return $output; |
|
| 58 | + if ($callback) { |
|
| 59 | + $ligne = $callback($nb, $ligne, $delim, $importer_charset); |
|
| 60 | + } |
|
| 61 | + $output = join($delim, array_map('exporter_csv_champ', $ligne)) . "\r\n"; |
|
| 62 | + if ($importer_charset) { |
|
| 63 | + $output = str_replace('’', '\'', $output); |
|
| 64 | + $output = unicode2charset(html2unicode(charset2unicode($output)), $importer_charset); |
|
| 65 | + } |
|
| 66 | + return $output; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | 77 | function exporter_csv_ligne($ligne, $delim = ',', $importer_charset = null) { |
| 78 | - return exporter_csv_ligne_numerotee(null, $ligne, $delim, $importer_charset); |
|
| 78 | + return exporter_csv_ligne_numerotee(null, $ligne, $delim, $importer_charset); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -101,101 +101,101 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | function inc_exporter_csv_dist($titre, $resource, $options = []) { |
| 103 | 103 | |
| 104 | - // support ancienne syntaxe |
|
| 105 | - // inc_exporter_csv_dist($titre, $resource, $delim = ', ', $entetes = null, $envoyer = true) |
|
| 106 | - if (is_string($options)) { |
|
| 107 | - $args = func_get_args(); |
|
| 108 | - $options = []; |
|
| 109 | - foreach ([2 => 'delim', 3 => 'entetes', 4 => 'envoyer'] as $k => $option) { |
|
| 110 | - if (!empty($args[$k])) { |
|
| 111 | - $options[$option] = $args[$k]; |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - $default_options = [ |
|
| 117 | - 'delim' => ', ', |
|
| 118 | - 'entetes' => null, |
|
| 119 | - 'envoyer' => true, |
|
| 120 | - 'charset' => null, |
|
| 121 | - 'callback' => null, |
|
| 122 | - ]; |
|
| 123 | - $options = array_merge($default_options, $options); |
|
| 124 | - |
|
| 125 | - $filename = preg_replace(',[^-_\w]+,', '_', translitteration(textebrut(typo($titre)))); |
|
| 126 | - |
|
| 127 | - if ($options['delim'] == 'TAB') { |
|
| 128 | - $options['delim'] = "\t"; |
|
| 129 | - } |
|
| 130 | - if (!in_array($options['delim'], [',', ';', "\t"])) { |
|
| 131 | - $options['delim'] = ','; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - $charset = $GLOBALS['meta']['charset']; |
|
| 135 | - $importer_charset = null; |
|
| 136 | - if ($options['delim'] == ',') { |
|
| 137 | - $extension = 'csv'; |
|
| 138 | - } else { |
|
| 139 | - $extension = 'xls'; |
|
| 140 | - # Excel n'accepte pas l'utf-8 ni les entites html... on transcode tout ce qu'on peut |
|
| 141 | - $charset = 'iso-8859-1'; |
|
| 142 | - } |
|
| 143 | - // mais si une option charset est explicite, elle a la priorite |
|
| 144 | - if (!empty($options['charset'])) { |
|
| 145 | - $charset = $options['charset']; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - $importer_charset = (($charset === $GLOBALS['meta']['charset']) ? null : $charset); |
|
| 149 | - |
|
| 150 | - $filename = "$filename.$extension"; |
|
| 151 | - |
|
| 152 | - $output = ''; |
|
| 153 | - $nb = 0; |
|
| 154 | - if (!empty($options['entetes']) and is_array($options['entetes'])) { |
|
| 155 | - $output = exporter_csv_ligne_numerotee($nb, $options['entetes'], $options['delim'], $importer_charset, $options['callback']); |
|
| 156 | - } |
|
| 157 | - // les donnees commencent toujours a la ligne 1, qu'il y ait ou non des entetes |
|
| 158 | - $nb++; |
|
| 159 | - |
|
| 160 | - if ($options['envoyer']) { |
|
| 161 | - $disposition = ($options['envoyer'] === 'attachment' ? 'attachment' : 'inline'); |
|
| 162 | - header("Content-Type: text/comma-separated-values; charset=$charset"); |
|
| 163 | - header("Content-Disposition: $disposition; filename=$filename"); |
|
| 164 | - |
|
| 165 | - // Vider tous les tampons |
|
| 166 | - $level = @ob_get_level(); |
|
| 167 | - while ($level--) { |
|
| 168 | - @ob_end_flush(); |
|
| 169 | - } |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - // si envoyer=='attachment' on passe par un fichier temporaire |
|
| 173 | - // sinon on ecrit directement sur stdout |
|
| 174 | - if ($options['envoyer'] and $options['envoyer'] !== 'attachment') { |
|
| 175 | - $fichier = 'php://output'; |
|
| 176 | - } |
|
| 177 | - else { |
|
| 178 | - $fichier = sous_repertoire(_DIR_CACHE, 'export') . $filename; |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - $fp = fopen($fichier, 'w'); |
|
| 182 | - $length = fwrite($fp, $output); |
|
| 183 | - |
|
| 184 | - while ($row = is_array($resource) ? array_shift($resource) : sql_fetch($resource)) { |
|
| 185 | - $output = exporter_csv_ligne_numerotee($nb, $row, $options['delim'], $importer_charset, $options['callback']); |
|
| 186 | - $length += fwrite($fp, $output); |
|
| 187 | - $nb++; |
|
| 188 | - } |
|
| 189 | - fclose($fp); |
|
| 190 | - |
|
| 191 | - if ($options['envoyer']) { |
|
| 192 | - if ($options['envoyer'] === 'attachment') { |
|
| 193 | - header("Content-Length: $length"); |
|
| 194 | - readfile($fichier); |
|
| 195 | - } |
|
| 196 | - // si on a envoye inline, c'est deja tout bon |
|
| 197 | - exit; |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - return $fichier; |
|
| 104 | + // support ancienne syntaxe |
|
| 105 | + // inc_exporter_csv_dist($titre, $resource, $delim = ', ', $entetes = null, $envoyer = true) |
|
| 106 | + if (is_string($options)) { |
|
| 107 | + $args = func_get_args(); |
|
| 108 | + $options = []; |
|
| 109 | + foreach ([2 => 'delim', 3 => 'entetes', 4 => 'envoyer'] as $k => $option) { |
|
| 110 | + if (!empty($args[$k])) { |
|
| 111 | + $options[$option] = $args[$k]; |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + $default_options = [ |
|
| 117 | + 'delim' => ', ', |
|
| 118 | + 'entetes' => null, |
|
| 119 | + 'envoyer' => true, |
|
| 120 | + 'charset' => null, |
|
| 121 | + 'callback' => null, |
|
| 122 | + ]; |
|
| 123 | + $options = array_merge($default_options, $options); |
|
| 124 | + |
|
| 125 | + $filename = preg_replace(',[^-_\w]+,', '_', translitteration(textebrut(typo($titre)))); |
|
| 126 | + |
|
| 127 | + if ($options['delim'] == 'TAB') { |
|
| 128 | + $options['delim'] = "\t"; |
|
| 129 | + } |
|
| 130 | + if (!in_array($options['delim'], [',', ';', "\t"])) { |
|
| 131 | + $options['delim'] = ','; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + $charset = $GLOBALS['meta']['charset']; |
|
| 135 | + $importer_charset = null; |
|
| 136 | + if ($options['delim'] == ',') { |
|
| 137 | + $extension = 'csv'; |
|
| 138 | + } else { |
|
| 139 | + $extension = 'xls'; |
|
| 140 | + # Excel n'accepte pas l'utf-8 ni les entites html... on transcode tout ce qu'on peut |
|
| 141 | + $charset = 'iso-8859-1'; |
|
| 142 | + } |
|
| 143 | + // mais si une option charset est explicite, elle a la priorite |
|
| 144 | + if (!empty($options['charset'])) { |
|
| 145 | + $charset = $options['charset']; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + $importer_charset = (($charset === $GLOBALS['meta']['charset']) ? null : $charset); |
|
| 149 | + |
|
| 150 | + $filename = "$filename.$extension"; |
|
| 151 | + |
|
| 152 | + $output = ''; |
|
| 153 | + $nb = 0; |
|
| 154 | + if (!empty($options['entetes']) and is_array($options['entetes'])) { |
|
| 155 | + $output = exporter_csv_ligne_numerotee($nb, $options['entetes'], $options['delim'], $importer_charset, $options['callback']); |
|
| 156 | + } |
|
| 157 | + // les donnees commencent toujours a la ligne 1, qu'il y ait ou non des entetes |
|
| 158 | + $nb++; |
|
| 159 | + |
|
| 160 | + if ($options['envoyer']) { |
|
| 161 | + $disposition = ($options['envoyer'] === 'attachment' ? 'attachment' : 'inline'); |
|
| 162 | + header("Content-Type: text/comma-separated-values; charset=$charset"); |
|
| 163 | + header("Content-Disposition: $disposition; filename=$filename"); |
|
| 164 | + |
|
| 165 | + // Vider tous les tampons |
|
| 166 | + $level = @ob_get_level(); |
|
| 167 | + while ($level--) { |
|
| 168 | + @ob_end_flush(); |
|
| 169 | + } |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + // si envoyer=='attachment' on passe par un fichier temporaire |
|
| 173 | + // sinon on ecrit directement sur stdout |
|
| 174 | + if ($options['envoyer'] and $options['envoyer'] !== 'attachment') { |
|
| 175 | + $fichier = 'php://output'; |
|
| 176 | + } |
|
| 177 | + else { |
|
| 178 | + $fichier = sous_repertoire(_DIR_CACHE, 'export') . $filename; |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + $fp = fopen($fichier, 'w'); |
|
| 182 | + $length = fwrite($fp, $output); |
|
| 183 | + |
|
| 184 | + while ($row = is_array($resource) ? array_shift($resource) : sql_fetch($resource)) { |
|
| 185 | + $output = exporter_csv_ligne_numerotee($nb, $row, $options['delim'], $importer_charset, $options['callback']); |
|
| 186 | + $length += fwrite($fp, $output); |
|
| 187 | + $nb++; |
|
| 188 | + } |
|
| 189 | + fclose($fp); |
|
| 190 | + |
|
| 191 | + if ($options['envoyer']) { |
|
| 192 | + if ($options['envoyer'] === 'attachment') { |
|
| 193 | + header("Content-Length: $length"); |
|
| 194 | + readfile($fichier); |
|
| 195 | + } |
|
| 196 | + // si on a envoye inline, c'est deja tout bon |
|
| 197 | + exit; |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + return $fichier; |
|
| 201 | 201 | } |
@@ -17,17 +17,17 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if (!defined('_UPGRADE_TIME_OUT')) { |
| 24 | - /** |
|
| 25 | - * Durée en secondes pour relancer les scripts de mises à jour, x secondes |
|
| 26 | - * avant que la durée d'exécution du script provoque un timeout |
|
| 27 | - * |
|
| 28 | - * @var int |
|
| 29 | - **/ |
|
| 30 | - define('_UPGRADE_TIME_OUT', 20); |
|
| 24 | + /** |
|
| 25 | + * Durée en secondes pour relancer les scripts de mises à jour, x secondes |
|
| 26 | + * avant que la durée d'exécution du script provoque un timeout |
|
| 27 | + * |
|
| 28 | + * @var int |
|
| 29 | + **/ |
|
| 30 | + define('_UPGRADE_TIME_OUT', 20); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -50,40 +50,40 @@ discard block |
||
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | 52 | function base_upgrade_dist($titre = '', $reprise = '') { |
| 53 | - if (!$titre) { |
|
| 54 | - return; |
|
| 55 | - } // anti-testeur automatique |
|
| 56 | - if ($GLOBALS['spip_version_base'] != $GLOBALS['meta']['version_installee']) { |
|
| 57 | - if (!is_numeric(_request('reinstall'))) { |
|
| 58 | - include_spip('base/create'); |
|
| 59 | - spip_log('recree les tables eventuellement disparues', 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 60 | - creer_base(); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - // quand on rentre par ici, c'est toujours une mise a jour de SPIP |
|
| 64 | - // lancement de l'upgrade SPIP |
|
| 65 | - $res = maj_base(); |
|
| 66 | - |
|
| 67 | - if ($res) { |
|
| 68 | - // on arrete tout ici ! |
|
| 69 | - exit; |
|
| 70 | - } |
|
| 71 | - } |
|
| 72 | - spip_log('Fin de mise a jour SQL. Debut m-a-j acces et config', 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 73 | - |
|
| 74 | - // supprimer quelques fichiers temporaires qui peuvent se retrouver invalides |
|
| 75 | - @spip_unlink(_CACHE_RUBRIQUES); |
|
| 76 | - @spip_unlink(_CACHE_PIPELINES); |
|
| 77 | - @spip_unlink(_CACHE_PLUGINS_PATH); |
|
| 78 | - @spip_unlink(_CACHE_PLUGINS_OPT); |
|
| 79 | - @spip_unlink(_CACHE_PLUGINS_FCT); |
|
| 80 | - @spip_unlink(_CACHE_CHEMIN); |
|
| 81 | - @spip_unlink(_DIR_TMP . 'plugin_xml_cache.gz'); |
|
| 82 | - |
|
| 83 | - include_spip('inc/auth'); |
|
| 84 | - auth_synchroniser_distant(); |
|
| 85 | - $config = charger_fonction('config', 'inc'); |
|
| 86 | - $config(); |
|
| 53 | + if (!$titre) { |
|
| 54 | + return; |
|
| 55 | + } // anti-testeur automatique |
|
| 56 | + if ($GLOBALS['spip_version_base'] != $GLOBALS['meta']['version_installee']) { |
|
| 57 | + if (!is_numeric(_request('reinstall'))) { |
|
| 58 | + include_spip('base/create'); |
|
| 59 | + spip_log('recree les tables eventuellement disparues', 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 60 | + creer_base(); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + // quand on rentre par ici, c'est toujours une mise a jour de SPIP |
|
| 64 | + // lancement de l'upgrade SPIP |
|
| 65 | + $res = maj_base(); |
|
| 66 | + |
|
| 67 | + if ($res) { |
|
| 68 | + // on arrete tout ici ! |
|
| 69 | + exit; |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | + spip_log('Fin de mise a jour SQL. Debut m-a-j acces et config', 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 73 | + |
|
| 74 | + // supprimer quelques fichiers temporaires qui peuvent se retrouver invalides |
|
| 75 | + @spip_unlink(_CACHE_RUBRIQUES); |
|
| 76 | + @spip_unlink(_CACHE_PIPELINES); |
|
| 77 | + @spip_unlink(_CACHE_PLUGINS_PATH); |
|
| 78 | + @spip_unlink(_CACHE_PLUGINS_OPT); |
|
| 79 | + @spip_unlink(_CACHE_PLUGINS_FCT); |
|
| 80 | + @spip_unlink(_CACHE_CHEMIN); |
|
| 81 | + @spip_unlink(_DIR_TMP . 'plugin_xml_cache.gz'); |
|
| 82 | + |
|
| 83 | + include_spip('inc/auth'); |
|
| 84 | + auth_synchroniser_distant(); |
|
| 85 | + $config = charger_fonction('config', 'inc'); |
|
| 86 | + $config(); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -114,51 +114,51 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | function maj_base($version_cible = 0, $redirect = '', $debut_page = true) { |
| 116 | 116 | |
| 117 | - $version_installee = $GLOBALS['meta']['version_installee'] ?? null; |
|
| 118 | - |
|
| 119 | - spip_log( |
|
| 120 | - "Version anterieure: $version_installee. Courante: " . $GLOBALS['spip_version_base'], |
|
| 121 | - 'maj.' . _LOG_INFO_IMPORTANTE |
|
| 122 | - ); |
|
| 123 | - if (!$version_installee or ($GLOBALS['spip_version_base'] < $version_installee)) { |
|
| 124 | - sql_replace( |
|
| 125 | - 'spip_meta', |
|
| 126 | - [ |
|
| 127 | - 'nom' => 'version_installee', |
|
| 128 | - 'valeur' => $GLOBALS['spip_version_base'], |
|
| 129 | - 'impt' => 'non' |
|
| 130 | - ] |
|
| 131 | - ); |
|
| 132 | - return false; |
|
| 133 | - } |
|
| 134 | - if (!upgrade_test()) { |
|
| 135 | - return true; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - $cible = ($version_cible ?: $GLOBALS['spip_version_base']); |
|
| 139 | - |
|
| 140 | - if ($version_installee < 2021_01_01_00) { |
|
| 141 | - include_spip('maj/legacy/v21'); |
|
| 142 | - include_spip('maj/legacy/v30'); |
|
| 143 | - include_spip('maj/legacy/v31'); |
|
| 144 | - include_spip('maj/legacy/v32'); |
|
| 145 | - include_spip('maj/legacy/v40'); |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - include_spip('maj/2021'); |
|
| 149 | - |
|
| 150 | - ksort($GLOBALS['maj']); |
|
| 151 | - $res = maj_while($version_installee, $cible, $GLOBALS['maj'], 'version_installee', 'meta', $redirect, $debut_page); |
|
| 152 | - if ($res) { |
|
| 153 | - if (!is_array($res)) { |
|
| 154 | - spip_log("Pb d'acces SQL a la mise a jour", 'maj.' . _LOG_ERREUR); |
|
| 155 | - } else { |
|
| 156 | - echo _T('avis_operation_echec') . ' ' . join(' ', $res); |
|
| 157 | - echo install_fin_html(); |
|
| 158 | - } |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - return $res; |
|
| 117 | + $version_installee = $GLOBALS['meta']['version_installee'] ?? null; |
|
| 118 | + |
|
| 119 | + spip_log( |
|
| 120 | + "Version anterieure: $version_installee. Courante: " . $GLOBALS['spip_version_base'], |
|
| 121 | + 'maj.' . _LOG_INFO_IMPORTANTE |
|
| 122 | + ); |
|
| 123 | + if (!$version_installee or ($GLOBALS['spip_version_base'] < $version_installee)) { |
|
| 124 | + sql_replace( |
|
| 125 | + 'spip_meta', |
|
| 126 | + [ |
|
| 127 | + 'nom' => 'version_installee', |
|
| 128 | + 'valeur' => $GLOBALS['spip_version_base'], |
|
| 129 | + 'impt' => 'non' |
|
| 130 | + ] |
|
| 131 | + ); |
|
| 132 | + return false; |
|
| 133 | + } |
|
| 134 | + if (!upgrade_test()) { |
|
| 135 | + return true; |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + $cible = ($version_cible ?: $GLOBALS['spip_version_base']); |
|
| 139 | + |
|
| 140 | + if ($version_installee < 2021_01_01_00) { |
|
| 141 | + include_spip('maj/legacy/v21'); |
|
| 142 | + include_spip('maj/legacy/v30'); |
|
| 143 | + include_spip('maj/legacy/v31'); |
|
| 144 | + include_spip('maj/legacy/v32'); |
|
| 145 | + include_spip('maj/legacy/v40'); |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + include_spip('maj/2021'); |
|
| 149 | + |
|
| 150 | + ksort($GLOBALS['maj']); |
|
| 151 | + $res = maj_while($version_installee, $cible, $GLOBALS['maj'], 'version_installee', 'meta', $redirect, $debut_page); |
|
| 152 | + if ($res) { |
|
| 153 | + if (!is_array($res)) { |
|
| 154 | + spip_log("Pb d'acces SQL a la mise a jour", 'maj.' . _LOG_ERREUR); |
|
| 155 | + } else { |
|
| 156 | + echo _T('avis_operation_echec') . ' ' . join(' ', $res); |
|
| 157 | + echo install_fin_html(); |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + return $res; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -200,53 +200,53 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | function maj_plugin($nom_meta_base_version, $version_cible, $maj, $table_meta = 'meta') { |
| 202 | 202 | |
| 203 | - if ($table_meta !== 'meta') { |
|
| 204 | - installer_table_meta($table_meta); |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - $current_version = null; |
|
| 208 | - |
|
| 209 | - if ( |
|
| 210 | - (!isset($GLOBALS[$table_meta][$nom_meta_base_version])) |
|
| 211 | - || (!spip_version_compare($current_version = $GLOBALS[$table_meta][$nom_meta_base_version], $version_cible, '=')) |
|
| 212 | - ) { |
|
| 213 | - // $maj['create'] contient les directives propres a la premiere creation de base |
|
| 214 | - // c'est une operation derogatoire qui fait aboutir directement dans la version_cible |
|
| 215 | - if (isset($maj['create'])) { |
|
| 216 | - if (!isset($GLOBALS[$table_meta][$nom_meta_base_version])) { |
|
| 217 | - // installation : on ne fait que l'operation create |
|
| 218 | - $maj = ['init' => $maj['create']]; |
|
| 219 | - // et on lui ajoute un appel a inc/config |
|
| 220 | - // pour creer les metas par defaut |
|
| 221 | - $config = charger_fonction('config', 'inc'); |
|
| 222 | - $maj[$version_cible] = [[$config]]; |
|
| 223 | - } |
|
| 224 | - // dans tous les cas enlever cet index du tableau |
|
| 225 | - unset($maj['create']); |
|
| 226 | - } |
|
| 227 | - // si init, deja dans le bon ordre |
|
| 228 | - if (!isset($maj['init'])) { |
|
| 229 | - include_spip('inc/plugin'); // pour spip_version_compare |
|
| 230 | - uksort($maj, 'spip_version_compare'); |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - // la redirection se fait par defaut sur la page d'administration des plugins |
|
| 234 | - // sauf lorsque nous sommes sur l'installation de SPIP |
|
| 235 | - // ou define _REDIRECT_MAJ_PLUGIN |
|
| 236 | - $redirect = (defined('_REDIRECT_MAJ_PLUGIN') ? _REDIRECT_MAJ_PLUGIN : generer_url_ecrire('admin_plugin')); |
|
| 237 | - if (defined('_ECRIRE_INSTALL')) { |
|
| 238 | - $redirect = parametre_url(generer_url_ecrire('install'), 'etape', _request('etape')); |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - $res = maj_while($current_version, $version_cible, $maj, $nom_meta_base_version, $table_meta, $redirect); |
|
| 242 | - if ($res) { |
|
| 243 | - if (!is_array($res)) { |
|
| 244 | - spip_log("Pb d'acces SQL a la mise a jour", 'maj.' . _LOG_ERREUR); |
|
| 245 | - } else { |
|
| 246 | - echo '<p>' . _T('avis_operation_echec') . ' ' . join(' ', $res) . '</p>'; |
|
| 247 | - } |
|
| 248 | - } |
|
| 249 | - } |
|
| 203 | + if ($table_meta !== 'meta') { |
|
| 204 | + installer_table_meta($table_meta); |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + $current_version = null; |
|
| 208 | + |
|
| 209 | + if ( |
|
| 210 | + (!isset($GLOBALS[$table_meta][$nom_meta_base_version])) |
|
| 211 | + || (!spip_version_compare($current_version = $GLOBALS[$table_meta][$nom_meta_base_version], $version_cible, '=')) |
|
| 212 | + ) { |
|
| 213 | + // $maj['create'] contient les directives propres a la premiere creation de base |
|
| 214 | + // c'est une operation derogatoire qui fait aboutir directement dans la version_cible |
|
| 215 | + if (isset($maj['create'])) { |
|
| 216 | + if (!isset($GLOBALS[$table_meta][$nom_meta_base_version])) { |
|
| 217 | + // installation : on ne fait que l'operation create |
|
| 218 | + $maj = ['init' => $maj['create']]; |
|
| 219 | + // et on lui ajoute un appel a inc/config |
|
| 220 | + // pour creer les metas par defaut |
|
| 221 | + $config = charger_fonction('config', 'inc'); |
|
| 222 | + $maj[$version_cible] = [[$config]]; |
|
| 223 | + } |
|
| 224 | + // dans tous les cas enlever cet index du tableau |
|
| 225 | + unset($maj['create']); |
|
| 226 | + } |
|
| 227 | + // si init, deja dans le bon ordre |
|
| 228 | + if (!isset($maj['init'])) { |
|
| 229 | + include_spip('inc/plugin'); // pour spip_version_compare |
|
| 230 | + uksort($maj, 'spip_version_compare'); |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + // la redirection se fait par defaut sur la page d'administration des plugins |
|
| 234 | + // sauf lorsque nous sommes sur l'installation de SPIP |
|
| 235 | + // ou define _REDIRECT_MAJ_PLUGIN |
|
| 236 | + $redirect = (defined('_REDIRECT_MAJ_PLUGIN') ? _REDIRECT_MAJ_PLUGIN : generer_url_ecrire('admin_plugin')); |
|
| 237 | + if (defined('_ECRIRE_INSTALL')) { |
|
| 238 | + $redirect = parametre_url(generer_url_ecrire('install'), 'etape', _request('etape')); |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + $res = maj_while($current_version, $version_cible, $maj, $nom_meta_base_version, $table_meta, $redirect); |
|
| 242 | + if ($res) { |
|
| 243 | + if (!is_array($res)) { |
|
| 244 | + spip_log("Pb d'acces SQL a la mise a jour", 'maj.' . _LOG_ERREUR); |
|
| 245 | + } else { |
|
| 246 | + echo '<p>' . _T('avis_operation_echec') . ' ' . join(' ', $res) . '</p>'; |
|
| 247 | + } |
|
| 248 | + } |
|
| 249 | + } |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -263,17 +263,17 @@ discard block |
||
| 263 | 263 | * @return void |
| 264 | 264 | */ |
| 265 | 265 | function relance_maj($meta, $table, $redirect = '') { |
| 266 | - include_spip('inc/headers'); |
|
| 267 | - if (!$redirect) { |
|
| 268 | - // recuperer la valeur installee en cours |
|
| 269 | - // on la tronque numeriquement, elle ne sert pas reellement |
|
| 270 | - // sauf pour verifier que ce n'est pas oui ou non |
|
| 271 | - // sinon is_numeric va echouer sur un numero de version 1.2.3 |
|
| 272 | - $installee = intval($GLOBALS[$table][$meta]); |
|
| 273 | - $redirect = generer_url_ecrire('upgrade', "reinstall=$installee&meta=$meta&table=$table", true); |
|
| 274 | - } |
|
| 275 | - echo redirige_formulaire($redirect); |
|
| 276 | - exit(); |
|
| 266 | + include_spip('inc/headers'); |
|
| 267 | + if (!$redirect) { |
|
| 268 | + // recuperer la valeur installee en cours |
|
| 269 | + // on la tronque numeriquement, elle ne sert pas reellement |
|
| 270 | + // sauf pour verifier que ce n'est pas oui ou non |
|
| 271 | + // sinon is_numeric va echouer sur un numero de version 1.2.3 |
|
| 272 | + $installee = intval($GLOBALS[$table][$meta]); |
|
| 273 | + $redirect = generer_url_ecrire('upgrade', "reinstall=$installee&meta=$meta&table=$table", true); |
|
| 274 | + } |
|
| 275 | + echo redirige_formulaire($redirect); |
|
| 276 | + exit(); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -286,28 +286,28 @@ discard block |
||
| 286 | 286 | * @return void |
| 287 | 287 | */ |
| 288 | 288 | function maj_debut_page($installee, $meta, $table) { |
| 289 | - static $done = false; |
|
| 290 | - if ($done) { |
|
| 291 | - return; |
|
| 292 | - } |
|
| 293 | - include_spip('inc/minipres'); |
|
| 294 | - if (function_exists('ini_set')) { |
|
| 295 | - @ini_set('zlib.output_compression', '0'); // pour permettre l'affichage au fur et a mesure |
|
| 296 | - } |
|
| 297 | - $timeout = _UPGRADE_TIME_OUT * 2; |
|
| 298 | - $titre = _T('titre_page_upgrade'); |
|
| 299 | - $balise_img = charger_filtre('balise_img'); |
|
| 300 | - $titre .= $balise_img(chemin_image('loader.svg'), '', 'loader'); |
|
| 301 | - echo(install_debut_html($titre)); |
|
| 302 | - // script de rechargement auto sur timeout |
|
| 303 | - $redirect = generer_url_ecrire('upgrade', "reinstall=$installee&meta=$meta&table=$table", true); |
|
| 304 | - echo http_script("window.setTimeout('location.href=\"" . $redirect . "\";'," . ($timeout * 1000) . ')'); |
|
| 305 | - echo "<div style='text-align: left'>\n"; |
|
| 306 | - if (ob_get_level()) { |
|
| 307 | - ob_flush(); |
|
| 308 | - } |
|
| 309 | - flush(); |
|
| 310 | - $done = true; |
|
| 289 | + static $done = false; |
|
| 290 | + if ($done) { |
|
| 291 | + return; |
|
| 292 | + } |
|
| 293 | + include_spip('inc/minipres'); |
|
| 294 | + if (function_exists('ini_set')) { |
|
| 295 | + @ini_set('zlib.output_compression', '0'); // pour permettre l'affichage au fur et a mesure |
|
| 296 | + } |
|
| 297 | + $timeout = _UPGRADE_TIME_OUT * 2; |
|
| 298 | + $titre = _T('titre_page_upgrade'); |
|
| 299 | + $balise_img = charger_filtre('balise_img'); |
|
| 300 | + $titre .= $balise_img(chemin_image('loader.svg'), '', 'loader'); |
|
| 301 | + echo(install_debut_html($titre)); |
|
| 302 | + // script de rechargement auto sur timeout |
|
| 303 | + $redirect = generer_url_ecrire('upgrade', "reinstall=$installee&meta=$meta&table=$table", true); |
|
| 304 | + echo http_script("window.setTimeout('location.href=\"" . $redirect . "\";'," . ($timeout * 1000) . ')'); |
|
| 305 | + echo "<div style='text-align: left'>\n"; |
|
| 306 | + if (ob_get_level()) { |
|
| 307 | + ob_flush(); |
|
| 308 | + } |
|
| 309 | + flush(); |
|
| 310 | + $done = true; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | |
@@ -351,64 +351,64 @@ discard block |
||
| 351 | 351 | * - tableau vide sinon. |
| 352 | 352 | */ |
| 353 | 353 | function maj_while($installee, $cible, $maj, $meta = '', $table = 'meta', $redirect = '', $debut_page = false) { |
| 354 | - # inclusions pour que les procedures d'upgrade disposent des fonctions de base |
|
| 355 | - include_spip('base/create'); |
|
| 356 | - include_spip('base/abstract_sql'); |
|
| 357 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 358 | - include_spip('inc/plugin'); // pour spip_version_compare |
|
| 359 | - $n = 0; |
|
| 360 | - $time = time(); |
|
| 361 | - |
|
| 362 | - if (!defined('_TIME_OUT')) { |
|
| 363 | - /** |
|
| 364 | - * Définir le timeout qui peut-être utilisé dans les fonctions |
|
| 365 | - * de mises à jour qui durent trop longtemps |
|
| 366 | - * |
|
| 367 | - * À utiliser tel que : `if (time() >= _TIME_OUT)` |
|
| 368 | - * |
|
| 369 | - * @var int |
|
| 370 | - */ |
|
| 371 | - define('_TIME_OUT', $time + _UPGRADE_TIME_OUT); |
|
| 372 | - } |
|
| 373 | - |
|
| 374 | - foreach ($maj as $v => $operations) { |
|
| 375 | - // si une maj pour cette version |
|
| 376 | - if ( |
|
| 377 | - $v == 'init' or |
|
| 378 | - (spip_version_compare($v, $installee, '>') |
|
| 379 | - and spip_version_compare($v, $cible, '<=')) |
|
| 380 | - ) { |
|
| 381 | - if ($debut_page) { |
|
| 382 | - maj_debut_page($v, $meta, $table); |
|
| 383 | - } |
|
| 384 | - echo "MAJ $v"; |
|
| 385 | - $etape = serie_alter($v, $operations, $meta, $table, $redirect); |
|
| 386 | - $trouver_table(''); // vider le cache des descriptions de table |
|
| 387 | - # echec sur une etape en cours ? |
|
| 388 | - # on sort |
|
| 389 | - if ($etape) { |
|
| 390 | - return [$v, $etape]; |
|
| 391 | - } |
|
| 392 | - $n = time() - $time; |
|
| 393 | - spip_log("$table $meta: $v en $n secondes", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 394 | - if ($meta) { |
|
| 395 | - ecrire_meta($meta, $installee = $v, 'oui', $table); |
|
| 396 | - } |
|
| 397 | - echo (_IS_CLI ? "\n" : '<br />'); |
|
| 398 | - } |
|
| 399 | - if (time() >= _TIME_OUT) { |
|
| 400 | - relance_maj($meta, $table, $redirect); |
|
| 401 | - } |
|
| 402 | - } |
|
| 403 | - $trouver_table(''); // vider le cache des descriptions de table |
|
| 404 | - // indispensable pour les chgt de versions qui n'ecrivent pas en base |
|
| 405 | - // tant pis pour la redondance eventuelle avec ci-dessus |
|
| 406 | - if ($meta) { |
|
| 407 | - ecrire_meta($meta, $cible, 'oui', $table); |
|
| 408 | - } |
|
| 409 | - spip_log("MAJ terminee. $meta: $installee", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 410 | - |
|
| 411 | - return []; |
|
| 354 | + # inclusions pour que les procedures d'upgrade disposent des fonctions de base |
|
| 355 | + include_spip('base/create'); |
|
| 356 | + include_spip('base/abstract_sql'); |
|
| 357 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 358 | + include_spip('inc/plugin'); // pour spip_version_compare |
|
| 359 | + $n = 0; |
|
| 360 | + $time = time(); |
|
| 361 | + |
|
| 362 | + if (!defined('_TIME_OUT')) { |
|
| 363 | + /** |
|
| 364 | + * Définir le timeout qui peut-être utilisé dans les fonctions |
|
| 365 | + * de mises à jour qui durent trop longtemps |
|
| 366 | + * |
|
| 367 | + * À utiliser tel que : `if (time() >= _TIME_OUT)` |
|
| 368 | + * |
|
| 369 | + * @var int |
|
| 370 | + */ |
|
| 371 | + define('_TIME_OUT', $time + _UPGRADE_TIME_OUT); |
|
| 372 | + } |
|
| 373 | + |
|
| 374 | + foreach ($maj as $v => $operations) { |
|
| 375 | + // si une maj pour cette version |
|
| 376 | + if ( |
|
| 377 | + $v == 'init' or |
|
| 378 | + (spip_version_compare($v, $installee, '>') |
|
| 379 | + and spip_version_compare($v, $cible, '<=')) |
|
| 380 | + ) { |
|
| 381 | + if ($debut_page) { |
|
| 382 | + maj_debut_page($v, $meta, $table); |
|
| 383 | + } |
|
| 384 | + echo "MAJ $v"; |
|
| 385 | + $etape = serie_alter($v, $operations, $meta, $table, $redirect); |
|
| 386 | + $trouver_table(''); // vider le cache des descriptions de table |
|
| 387 | + # echec sur une etape en cours ? |
|
| 388 | + # on sort |
|
| 389 | + if ($etape) { |
|
| 390 | + return [$v, $etape]; |
|
| 391 | + } |
|
| 392 | + $n = time() - $time; |
|
| 393 | + spip_log("$table $meta: $v en $n secondes", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 394 | + if ($meta) { |
|
| 395 | + ecrire_meta($meta, $installee = $v, 'oui', $table); |
|
| 396 | + } |
|
| 397 | + echo (_IS_CLI ? "\n" : '<br />'); |
|
| 398 | + } |
|
| 399 | + if (time() >= _TIME_OUT) { |
|
| 400 | + relance_maj($meta, $table, $redirect); |
|
| 401 | + } |
|
| 402 | + } |
|
| 403 | + $trouver_table(''); // vider le cache des descriptions de table |
|
| 404 | + // indispensable pour les chgt de versions qui n'ecrivent pas en base |
|
| 405 | + // tant pis pour la redondance eventuelle avec ci-dessus |
|
| 406 | + if ($meta) { |
|
| 407 | + ecrire_meta($meta, $cible, 'oui', $table); |
|
| 408 | + } |
|
| 409 | + spip_log("MAJ terminee. $meta: $installee", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 410 | + |
|
| 411 | + return []; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | /** |
@@ -431,53 +431,53 @@ discard block |
||
| 431 | 431 | * @return int |
| 432 | 432 | */ |
| 433 | 433 | function serie_alter($serie, $q = [], $meta = '', $table = 'meta', $redirect = '') { |
| 434 | - $meta2 = $meta . '_maj_' . $serie; |
|
| 435 | - $etape = 0; |
|
| 436 | - if (isset($GLOBALS[$table][$meta2])) { |
|
| 437 | - $etape = intval($GLOBALS[$table][$meta2]); |
|
| 438 | - } |
|
| 439 | - foreach ($q as $i => $r) { |
|
| 440 | - if ($i >= $etape) { |
|
| 441 | - $msg = "maj $table $meta2 etape $i"; |
|
| 442 | - if ( |
|
| 443 | - is_array($r) |
|
| 444 | - and function_exists($f = array_shift($r)) |
|
| 445 | - ) { |
|
| 446 | - // note: $r (arguments de la fonction $f) peut avoir des données tabulaires |
|
| 447 | - spip_log("$msg: $f " . @join(',', $r), 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 448 | - // pour les fonctions atomiques sql_xx |
|
| 449 | - // on enregistre le meta avant de lancer la fonction, |
|
| 450 | - // de maniere a eviter de boucler sur timeout |
|
| 451 | - // mais pour les fonctions complexes, |
|
| 452 | - // il faut les rejouer jusqu'a achevement. |
|
| 453 | - // C'est a elle d'assurer qu'elles progressent a chaque rappel |
|
| 454 | - if (strncmp($f, 'sql_', 4) == 0) { |
|
| 455 | - ecrire_meta($meta2, $i + 1, 'non', $table); |
|
| 456 | - } |
|
| 457 | - echo (_IS_CLI ? '.' : " <span title='$i'>.</span>"); |
|
| 458 | - $f(...$r); |
|
| 459 | - // si temps imparti depasse, on relance sans ecrire en meta |
|
| 460 | - // car on est peut etre sorti sur timeout si c'est une fonction longue |
|
| 461 | - if (time() >= _TIME_OUT) { |
|
| 462 | - relance_maj($meta, $table, $redirect); |
|
| 463 | - } |
|
| 464 | - ecrire_meta($meta2, $i + 1, 'non', $table); |
|
| 465 | - spip_log("$meta2: ok", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 466 | - } else { |
|
| 467 | - if (!is_array($r)) { |
|
| 468 | - spip_log("maj $i format incorrect", 'maj.' . _LOG_ERREUR); |
|
| 469 | - } else { |
|
| 470 | - spip_log("maj $i fonction $f non definie", 'maj.' . _LOG_ERREUR); |
|
| 471 | - } |
|
| 472 | - // en cas d'erreur serieuse, on s'arrete |
|
| 473 | - // mais on permet de passer par dessus en rechargeant la page. |
|
| 474 | - return $i + 1; |
|
| 475 | - } |
|
| 476 | - } |
|
| 477 | - } |
|
| 478 | - effacer_meta($meta2, $table); |
|
| 479 | - |
|
| 480 | - return 0; |
|
| 434 | + $meta2 = $meta . '_maj_' . $serie; |
|
| 435 | + $etape = 0; |
|
| 436 | + if (isset($GLOBALS[$table][$meta2])) { |
|
| 437 | + $etape = intval($GLOBALS[$table][$meta2]); |
|
| 438 | + } |
|
| 439 | + foreach ($q as $i => $r) { |
|
| 440 | + if ($i >= $etape) { |
|
| 441 | + $msg = "maj $table $meta2 etape $i"; |
|
| 442 | + if ( |
|
| 443 | + is_array($r) |
|
| 444 | + and function_exists($f = array_shift($r)) |
|
| 445 | + ) { |
|
| 446 | + // note: $r (arguments de la fonction $f) peut avoir des données tabulaires |
|
| 447 | + spip_log("$msg: $f " . @join(',', $r), 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 448 | + // pour les fonctions atomiques sql_xx |
|
| 449 | + // on enregistre le meta avant de lancer la fonction, |
|
| 450 | + // de maniere a eviter de boucler sur timeout |
|
| 451 | + // mais pour les fonctions complexes, |
|
| 452 | + // il faut les rejouer jusqu'a achevement. |
|
| 453 | + // C'est a elle d'assurer qu'elles progressent a chaque rappel |
|
| 454 | + if (strncmp($f, 'sql_', 4) == 0) { |
|
| 455 | + ecrire_meta($meta2, $i + 1, 'non', $table); |
|
| 456 | + } |
|
| 457 | + echo (_IS_CLI ? '.' : " <span title='$i'>.</span>"); |
|
| 458 | + $f(...$r); |
|
| 459 | + // si temps imparti depasse, on relance sans ecrire en meta |
|
| 460 | + // car on est peut etre sorti sur timeout si c'est une fonction longue |
|
| 461 | + if (time() >= _TIME_OUT) { |
|
| 462 | + relance_maj($meta, $table, $redirect); |
|
| 463 | + } |
|
| 464 | + ecrire_meta($meta2, $i + 1, 'non', $table); |
|
| 465 | + spip_log("$meta2: ok", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 466 | + } else { |
|
| 467 | + if (!is_array($r)) { |
|
| 468 | + spip_log("maj $i format incorrect", 'maj.' . _LOG_ERREUR); |
|
| 469 | + } else { |
|
| 470 | + spip_log("maj $i fonction $f non definie", 'maj.' . _LOG_ERREUR); |
|
| 471 | + } |
|
| 472 | + // en cas d'erreur serieuse, on s'arrete |
|
| 473 | + // mais on permet de passer par dessus en rechargeant la page. |
|
| 474 | + return $i + 1; |
|
| 475 | + } |
|
| 476 | + } |
|
| 477 | + } |
|
| 478 | + effacer_meta($meta2, $table); |
|
| 479 | + |
|
| 480 | + return 0; |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | /** |
@@ -486,16 +486,16 @@ discard block |
||
| 486 | 486 | * @return bool True si possible. |
| 487 | 487 | **/ |
| 488 | 488 | function upgrade_test() { |
| 489 | - sql_drop_table('spip_test', true); |
|
| 490 | - sql_create('spip_test', ['a' => 'int']); |
|
| 491 | - sql_alter('TABLE spip_test ADD b INT'); |
|
| 492 | - sql_insertq('spip_test', ['b' => 1], ['field' => ['b' => 'int']]); |
|
| 493 | - $result = sql_select('b', 'spip_test'); |
|
| 494 | - // ne pas garder le resultat de la requete sinon sqlite3 |
|
| 495 | - // ne peut pas supprimer la table spip_test lors du sql_alter qui suit |
|
| 496 | - // car cette table serait alors 'verouillee' |
|
| 497 | - $result = $result ? true : false; |
|
| 498 | - sql_alter('TABLE spip_test DROP b'); |
|
| 499 | - |
|
| 500 | - return $result; |
|
| 489 | + sql_drop_table('spip_test', true); |
|
| 490 | + sql_create('spip_test', ['a' => 'int']); |
|
| 491 | + sql_alter('TABLE spip_test ADD b INT'); |
|
| 492 | + sql_insertq('spip_test', ['b' => 1], ['field' => ['b' => 'int']]); |
|
| 493 | + $result = sql_select('b', 'spip_test'); |
|
| 494 | + // ne pas garder le resultat de la requete sinon sqlite3 |
|
| 495 | + // ne peut pas supprimer la table spip_test lors du sql_alter qui suit |
|
| 496 | + // car cette table serait alors 'verouillee' |
|
| 497 | + $result = $result ? true : false; |
|
| 498 | + sql_alter('TABLE spip_test DROP b'); |
|
| 499 | + |
|
| 500 | + return $result; |
|
| 501 | 501 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/charsets'); |
@@ -24,222 +24,222 @@ discard block |
||
| 24 | 24 | * @return string |
| 25 | 25 | */ |
| 26 | 26 | function xml_entites_html($texte) { |
| 27 | - if ( |
|
| 28 | - !is_string($texte) or !$texte |
|
| 29 | - or strpbrk($texte, "&\"'<>") == false |
|
| 30 | - ) { |
|
| 31 | - return $texte; |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - if (!function_exists('spip_htmlspecialchars')) { |
|
| 35 | - include_spip('inc/filtres_mini'); |
|
| 36 | - } |
|
| 37 | - $texte = spip_htmlspecialchars($texte, ENT_QUOTES); |
|
| 38 | - |
|
| 39 | - return $texte; |
|
| 27 | + if ( |
|
| 28 | + !is_string($texte) or !$texte |
|
| 29 | + or strpbrk($texte, "&\"'<>") == false |
|
| 30 | + ) { |
|
| 31 | + return $texte; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + if (!function_exists('spip_htmlspecialchars')) { |
|
| 35 | + include_spip('inc/filtres_mini'); |
|
| 36 | + } |
|
| 37 | + $texte = spip_htmlspecialchars($texte, ENT_QUOTES); |
|
| 38 | + |
|
| 39 | + return $texte; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | function xml_debutElement($phraseur, $name, $attrs) { |
| 43 | - $depth = $phraseur->depth; |
|
| 44 | - |
|
| 45 | - $t = $phraseur->ouvrant[$depth] ?? ' '; |
|
| 46 | - // espace initial signifie: deja integree au resultat |
|
| 47 | - if ($t[0] != ' ') { |
|
| 48 | - $phraseur->res .= '<' . $t . '>'; |
|
| 49 | - $phraseur->ouvrant[$depth] = ' ' . $t; |
|
| 50 | - } |
|
| 51 | - $t = $phraseur->contenu[$depth]; |
|
| 52 | - // n'indenter que s'il y a un separateur avant |
|
| 53 | - $phraseur->res .= preg_replace("/[\n\t ]+$/", "\n$depth", $t); |
|
| 54 | - $phraseur->contenu[$depth] = ''; |
|
| 55 | - $att = ''; |
|
| 56 | - $sep = ' '; |
|
| 57 | - foreach ($attrs as $k => $v) { |
|
| 58 | - $delim = strpos($v, "'") === false ? "'" : '"'; |
|
| 59 | - $val = xml_entites_html($v); |
|
| 60 | - $att .= $sep . $k . '=' . $delim |
|
| 61 | - . ($delim !== '"' ? str_replace('"', '"', $val) : $val) |
|
| 62 | - . $delim; |
|
| 63 | - $sep = "\n $depth"; |
|
| 64 | - } |
|
| 65 | - $phraseur->depth .= ' '; |
|
| 66 | - $phraseur->contenu[$phraseur->depth] = ''; |
|
| 67 | - $phraseur->ouvrant[$phraseur->depth] = $name . $att; |
|
| 68 | - $phraseur->reperes[$phraseur->depth] = xml_get_current_line_number($phraseur->sax); |
|
| 43 | + $depth = $phraseur->depth; |
|
| 44 | + |
|
| 45 | + $t = $phraseur->ouvrant[$depth] ?? ' '; |
|
| 46 | + // espace initial signifie: deja integree au resultat |
|
| 47 | + if ($t[0] != ' ') { |
|
| 48 | + $phraseur->res .= '<' . $t . '>'; |
|
| 49 | + $phraseur->ouvrant[$depth] = ' ' . $t; |
|
| 50 | + } |
|
| 51 | + $t = $phraseur->contenu[$depth]; |
|
| 52 | + // n'indenter que s'il y a un separateur avant |
|
| 53 | + $phraseur->res .= preg_replace("/[\n\t ]+$/", "\n$depth", $t); |
|
| 54 | + $phraseur->contenu[$depth] = ''; |
|
| 55 | + $att = ''; |
|
| 56 | + $sep = ' '; |
|
| 57 | + foreach ($attrs as $k => $v) { |
|
| 58 | + $delim = strpos($v, "'") === false ? "'" : '"'; |
|
| 59 | + $val = xml_entites_html($v); |
|
| 60 | + $att .= $sep . $k . '=' . $delim |
|
| 61 | + . ($delim !== '"' ? str_replace('"', '"', $val) : $val) |
|
| 62 | + . $delim; |
|
| 63 | + $sep = "\n $depth"; |
|
| 64 | + } |
|
| 65 | + $phraseur->depth .= ' '; |
|
| 66 | + $phraseur->contenu[$phraseur->depth] = ''; |
|
| 67 | + $phraseur->ouvrant[$phraseur->depth] = $name . $att; |
|
| 68 | + $phraseur->reperes[$phraseur->depth] = xml_get_current_line_number($phraseur->sax); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | function xml_finElement($phraseur, $name, $fusion_bal = false) { |
| 72 | - $ouv = $phraseur->ouvrant[$phraseur->depth]; |
|
| 73 | - |
|
| 74 | - if ($ouv[0] != ' ') { |
|
| 75 | - $phraseur->ouvrant[$phraseur->depth] = ' ' . $ouv; |
|
| 76 | - } else { |
|
| 77 | - $ouv = ''; |
|
| 78 | - } |
|
| 79 | - $t = $phraseur->contenu[$phraseur->depth]; |
|
| 80 | - $phraseur->depth = substr($phraseur->depth, 2); |
|
| 81 | - $t = preg_replace("/[\n\t ]+$/", "\n" . $phraseur->depth, $t); |
|
| 82 | - |
|
| 83 | - // fusion <balise></balise> en <balise />. |
|
| 84 | - // ATTENTION, certains clients http croient que fusion ==> pas d'atttributs |
|
| 85 | - // en particulier pour les balises Script et A. |
|
| 86 | - // en presence d'attributs ne le faire que si la DTD est dispo et d'accord |
|
| 87 | - // (param fusion_bal) |
|
| 88 | - |
|
| 89 | - if ($t || (($ouv != $name) and !$fusion_bal)) { |
|
| 90 | - $phraseur->res .= ($ouv ? ('<' . $ouv . '>') : '') . $t . '</' . $name . '>'; |
|
| 91 | - } else { |
|
| 92 | - $phraseur->res .= ($ouv ? ('<' . $ouv . ' />') : ('</' . $name . '>')); |
|
| 93 | - } |
|
| 72 | + $ouv = $phraseur->ouvrant[$phraseur->depth]; |
|
| 73 | + |
|
| 74 | + if ($ouv[0] != ' ') { |
|
| 75 | + $phraseur->ouvrant[$phraseur->depth] = ' ' . $ouv; |
|
| 76 | + } else { |
|
| 77 | + $ouv = ''; |
|
| 78 | + } |
|
| 79 | + $t = $phraseur->contenu[$phraseur->depth]; |
|
| 80 | + $phraseur->depth = substr($phraseur->depth, 2); |
|
| 81 | + $t = preg_replace("/[\n\t ]+$/", "\n" . $phraseur->depth, $t); |
|
| 82 | + |
|
| 83 | + // fusion <balise></balise> en <balise />. |
|
| 84 | + // ATTENTION, certains clients http croient que fusion ==> pas d'atttributs |
|
| 85 | + // en particulier pour les balises Script et A. |
|
| 86 | + // en presence d'attributs ne le faire que si la DTD est dispo et d'accord |
|
| 87 | + // (param fusion_bal) |
|
| 88 | + |
|
| 89 | + if ($t || (($ouv != $name) and !$fusion_bal)) { |
|
| 90 | + $phraseur->res .= ($ouv ? ('<' . $ouv . '>') : '') . $t . '</' . $name . '>'; |
|
| 91 | + } else { |
|
| 92 | + $phraseur->res .= ($ouv ? ('<' . $ouv . ' />') : ('</' . $name . '>')); |
|
| 93 | + } |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | function xml_textElement($phraseur, $data) { |
| 97 | - $depth = $phraseur->depth; |
|
| 98 | - $phraseur->contenu[$depth] .= preg_match('/^script/', $phraseur->ouvrant[$depth]) |
|
| 99 | - ? $data |
|
| 100 | - : xml_entites_html($data); |
|
| 97 | + $depth = $phraseur->depth; |
|
| 98 | + $phraseur->contenu[$depth] .= preg_match('/^script/', $phraseur->ouvrant[$depth]) |
|
| 99 | + ? $data |
|
| 100 | + : xml_entites_html($data); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | function xml_piElement($phraseur, $target, $data) { |
| 104 | - $depth = $phraseur->depth; |
|
| 105 | - |
|
| 106 | - if (strtolower($target) != 'php') { |
|
| 107 | - $phraseur->contenu[$depth] .= $data; |
|
| 108 | - } else { |
|
| 109 | - ob_start(); |
|
| 110 | - eval($data); |
|
| 111 | - $data = ob_get_contents(); |
|
| 112 | - ob_end_clean(); |
|
| 113 | - $phraseur->contenu[$depth] .= $data; |
|
| 114 | - } |
|
| 104 | + $depth = $phraseur->depth; |
|
| 105 | + |
|
| 106 | + if (strtolower($target) != 'php') { |
|
| 107 | + $phraseur->contenu[$depth] .= $data; |
|
| 108 | + } else { |
|
| 109 | + ob_start(); |
|
| 110 | + eval($data); |
|
| 111 | + $data = ob_get_contents(); |
|
| 112 | + ob_end_clean(); |
|
| 113 | + $phraseur->contenu[$depth] .= $data; |
|
| 114 | + } |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | function xml_defaultElement($phraseur, $data) { |
| 119 | - $depth = $phraseur->depth; |
|
| 119 | + $depth = $phraseur->depth; |
|
| 120 | 120 | |
| 121 | - if (!isset($phraseur->contenu[$depth])) { |
|
| 122 | - $phraseur->contenu[$depth] = ''; |
|
| 123 | - } |
|
| 124 | - $phraseur->contenu[$depth] .= $data; |
|
| 121 | + if (!isset($phraseur->contenu[$depth])) { |
|
| 122 | + $phraseur->contenu[$depth] = ''; |
|
| 123 | + } |
|
| 124 | + $phraseur->contenu[$depth] .= $data; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | function xml_parsestring($phraseur, $data) { |
| 128 | - $phraseur->contenu[$phraseur->depth] = ''; |
|
| 129 | - |
|
| 130 | - if (!xml_parse($phraseur->sax, $data, true)) { |
|
| 131 | - coordonnees_erreur( |
|
| 132 | - $phraseur, |
|
| 133 | - xml_error_string(xml_get_error_code($phraseur->sax)) |
|
| 134 | - . "<br />\n" . |
|
| 135 | - (!$phraseur->depth ? '' : |
|
| 136 | - ('(' . |
|
| 137 | - _T('erreur_balise_non_fermee') . |
|
| 138 | - ' <tt>' . |
|
| 139 | - $phraseur->ouvrant[$phraseur->depth] . |
|
| 140 | - '</tt> ' . |
|
| 141 | - _T('ligne') . |
|
| 142 | - ' ' . |
|
| 143 | - $phraseur->reperes[$phraseur->depth] . |
|
| 144 | - ") <br />\n")) |
|
| 145 | - ); |
|
| 146 | - } |
|
| 128 | + $phraseur->contenu[$phraseur->depth] = ''; |
|
| 129 | + |
|
| 130 | + if (!xml_parse($phraseur->sax, $data, true)) { |
|
| 131 | + coordonnees_erreur( |
|
| 132 | + $phraseur, |
|
| 133 | + xml_error_string(xml_get_error_code($phraseur->sax)) |
|
| 134 | + . "<br />\n" . |
|
| 135 | + (!$phraseur->depth ? '' : |
|
| 136 | + ('(' . |
|
| 137 | + _T('erreur_balise_non_fermee') . |
|
| 138 | + ' <tt>' . |
|
| 139 | + $phraseur->ouvrant[$phraseur->depth] . |
|
| 140 | + '</tt> ' . |
|
| 141 | + _T('ligne') . |
|
| 142 | + ' ' . |
|
| 143 | + $phraseur->reperes[$phraseur->depth] . |
|
| 144 | + ") <br />\n")) |
|
| 145 | + ); |
|
| 146 | + } |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | function coordonnees_erreur($phraseur, $msg) { |
| 150 | - $entete_length = substr_count($phraseur->entete, "\n"); |
|
| 151 | - $phraseur->err[] = [ |
|
| 152 | - $msg, |
|
| 153 | - xml_get_current_line_number($phraseur->sax) + $entete_length, |
|
| 154 | - xml_get_current_column_number($phraseur->sax) |
|
| 155 | - ]; |
|
| 150 | + $entete_length = substr_count($phraseur->entete, "\n"); |
|
| 151 | + $phraseur->err[] = [ |
|
| 152 | + $msg, |
|
| 153 | + xml_get_current_line_number($phraseur->sax) + $entete_length, |
|
| 154 | + xml_get_current_column_number($phraseur->sax) |
|
| 155 | + ]; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | function xml_sax_dist($page, $apply = false, $phraseur = null, $doctype = '', $charset = null) { |
| 159 | - if (is_null($charset)) { |
|
| 160 | - $charset = $GLOBALS['meta']['charset']; |
|
| 161 | - } |
|
| 162 | - if ($apply) { |
|
| 163 | - ob_start(); |
|
| 164 | - if (is_array($apply)) { |
|
| 165 | - $r = $page(...$apply); |
|
| 166 | - } else { |
|
| 167 | - $r = $page(); |
|
| 168 | - } |
|
| 169 | - $page = ob_get_contents(); |
|
| 170 | - ob_end_clean(); |
|
| 171 | - // fonction sans aucun "echo", ca doit etre le resultat |
|
| 172 | - if (!$page) { |
|
| 173 | - $page = $r; |
|
| 174 | - } |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - if (!$page) { |
|
| 178 | - return ''; |
|
| 179 | - } |
|
| 180 | - // charger la DTD et transcoder les entites, |
|
| 181 | - // et escamoter le doctype que sax mange en php5 mais pas en php4 |
|
| 182 | - if (!$doctype) { |
|
| 183 | - if (!$r = analyser_doctype($page)) { |
|
| 184 | - $page = _MESSAGE_DOCTYPE . _DOCTYPE_ECRIRE |
|
| 185 | - . preg_replace(_REGEXP_DOCTYPE, '', $page); |
|
| 186 | - $r = analyser_doctype($page); |
|
| 187 | - } |
|
| 188 | - [$entete, $avail, $grammaire, $rotlvl] = array_pad($r, 4, null); |
|
| 189 | - $page = substr($page, strlen($entete)); |
|
| 190 | - } else { |
|
| 191 | - $avail = 'SYSTEM'; |
|
| 192 | - $grammaire = $doctype; |
|
| 193 | - $rotlvl = basename($grammaire); |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - include_spip('xml/analyser_dtd'); |
|
| 197 | - $dtc = charger_dtd($grammaire, $avail, $rotlvl); |
|
| 198 | - $page = sax_bug($page, $dtc, $charset); |
|
| 199 | - |
|
| 200 | - // compatibilite Tidy espace public |
|
| 201 | - if (!$phraseur) { |
|
| 202 | - $indenter_xml = charger_fonction('indenter', 'xml'); |
|
| 203 | - |
|
| 204 | - return $indenter_xml($page, $apply); |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - $xml_parser = xml_parser_create($charset); |
|
| 208 | - |
|
| 209 | - xml_set_element_handler( |
|
| 210 | - $xml_parser, |
|
| 211 | - [$phraseur, 'debutElement'], |
|
| 212 | - [$phraseur, 'finElement'] |
|
| 213 | - ); |
|
| 214 | - |
|
| 215 | - xml_set_character_data_handler( |
|
| 216 | - $xml_parser, |
|
| 217 | - [$phraseur, 'textElement'] |
|
| 218 | - ); |
|
| 219 | - |
|
| 220 | - xml_set_processing_instruction_handler( |
|
| 221 | - $xml_parser, |
|
| 222 | - [$phraseur, 'piElement'] |
|
| 223 | - ); |
|
| 224 | - |
|
| 225 | - xml_set_default_handler( |
|
| 226 | - $xml_parser, |
|
| 227 | - [$phraseur, 'defaultElement'] |
|
| 228 | - ); |
|
| 229 | - |
|
| 230 | - xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, false); |
|
| 231 | - |
|
| 232 | - $phraseur->sax = $xml_parser; |
|
| 233 | - if (isset($entete)) { |
|
| 234 | - $phraseur->entete = $entete; |
|
| 235 | - } |
|
| 236 | - $phraseur->page = $page; |
|
| 237 | - $phraseur->dtc = $dtc; |
|
| 238 | - $phraseur->phraserTout($xml_parser, $page); |
|
| 239 | - xml_parser_free($xml_parser); |
|
| 240 | - $phraseur->sax = ''; |
|
| 241 | - |
|
| 242 | - return $phraseur; |
|
| 159 | + if (is_null($charset)) { |
|
| 160 | + $charset = $GLOBALS['meta']['charset']; |
|
| 161 | + } |
|
| 162 | + if ($apply) { |
|
| 163 | + ob_start(); |
|
| 164 | + if (is_array($apply)) { |
|
| 165 | + $r = $page(...$apply); |
|
| 166 | + } else { |
|
| 167 | + $r = $page(); |
|
| 168 | + } |
|
| 169 | + $page = ob_get_contents(); |
|
| 170 | + ob_end_clean(); |
|
| 171 | + // fonction sans aucun "echo", ca doit etre le resultat |
|
| 172 | + if (!$page) { |
|
| 173 | + $page = $r; |
|
| 174 | + } |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + if (!$page) { |
|
| 178 | + return ''; |
|
| 179 | + } |
|
| 180 | + // charger la DTD et transcoder les entites, |
|
| 181 | + // et escamoter le doctype que sax mange en php5 mais pas en php4 |
|
| 182 | + if (!$doctype) { |
|
| 183 | + if (!$r = analyser_doctype($page)) { |
|
| 184 | + $page = _MESSAGE_DOCTYPE . _DOCTYPE_ECRIRE |
|
| 185 | + . preg_replace(_REGEXP_DOCTYPE, '', $page); |
|
| 186 | + $r = analyser_doctype($page); |
|
| 187 | + } |
|
| 188 | + [$entete, $avail, $grammaire, $rotlvl] = array_pad($r, 4, null); |
|
| 189 | + $page = substr($page, strlen($entete)); |
|
| 190 | + } else { |
|
| 191 | + $avail = 'SYSTEM'; |
|
| 192 | + $grammaire = $doctype; |
|
| 193 | + $rotlvl = basename($grammaire); |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + include_spip('xml/analyser_dtd'); |
|
| 197 | + $dtc = charger_dtd($grammaire, $avail, $rotlvl); |
|
| 198 | + $page = sax_bug($page, $dtc, $charset); |
|
| 199 | + |
|
| 200 | + // compatibilite Tidy espace public |
|
| 201 | + if (!$phraseur) { |
|
| 202 | + $indenter_xml = charger_fonction('indenter', 'xml'); |
|
| 203 | + |
|
| 204 | + return $indenter_xml($page, $apply); |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + $xml_parser = xml_parser_create($charset); |
|
| 208 | + |
|
| 209 | + xml_set_element_handler( |
|
| 210 | + $xml_parser, |
|
| 211 | + [$phraseur, 'debutElement'], |
|
| 212 | + [$phraseur, 'finElement'] |
|
| 213 | + ); |
|
| 214 | + |
|
| 215 | + xml_set_character_data_handler( |
|
| 216 | + $xml_parser, |
|
| 217 | + [$phraseur, 'textElement'] |
|
| 218 | + ); |
|
| 219 | + |
|
| 220 | + xml_set_processing_instruction_handler( |
|
| 221 | + $xml_parser, |
|
| 222 | + [$phraseur, 'piElement'] |
|
| 223 | + ); |
|
| 224 | + |
|
| 225 | + xml_set_default_handler( |
|
| 226 | + $xml_parser, |
|
| 227 | + [$phraseur, 'defaultElement'] |
|
| 228 | + ); |
|
| 229 | + |
|
| 230 | + xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, false); |
|
| 231 | + |
|
| 232 | + $phraseur->sax = $xml_parser; |
|
| 233 | + if (isset($entete)) { |
|
| 234 | + $phraseur->entete = $entete; |
|
| 235 | + } |
|
| 236 | + $phraseur->page = $page; |
|
| 237 | + $phraseur->dtc = $dtc; |
|
| 238 | + $phraseur->phraserTout($xml_parser, $page); |
|
| 239 | + xml_parser_free($xml_parser); |
|
| 240 | + $phraseur->sax = ''; |
|
| 241 | + |
|
| 242 | + return $phraseur; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | // SAX ne dit pas si une Entite est dans un attribut ou non. |
@@ -250,24 +250,24 @@ discard block |
||
| 250 | 250 | // sinon on se rabat sur ce qu'en connait SPIP en standard. |
| 251 | 251 | |
| 252 | 252 | function sax_bug($data, $dtc, $charset = null) { |
| 253 | - if (is_null($charset)) { |
|
| 254 | - $charset = $GLOBALS['meta']['charset']; |
|
| 255 | - } |
|
| 256 | - |
|
| 257 | - if ($dtc) { |
|
| 258 | - $trans = []; |
|
| 259 | - |
|
| 260 | - foreach ($dtc->entites as $k => $v) { |
|
| 261 | - if (!strpos(' amp lt gt quot ', (string) $k)) { |
|
| 262 | - $trans["&$k;"] = $v; |
|
| 263 | - } |
|
| 264 | - } |
|
| 265 | - $data = strtr($data, $trans); |
|
| 266 | - } else { |
|
| 267 | - $data = html2unicode($data, true); |
|
| 268 | - } |
|
| 269 | - |
|
| 270 | - return unicode2charset($data, $charset); |
|
| 253 | + if (is_null($charset)) { |
|
| 254 | + $charset = $GLOBALS['meta']['charset']; |
|
| 255 | + } |
|
| 256 | + |
|
| 257 | + if ($dtc) { |
|
| 258 | + $trans = []; |
|
| 259 | + |
|
| 260 | + foreach ($dtc->entites as $k => $v) { |
|
| 261 | + if (!strpos(' amp lt gt quot ', (string) $k)) { |
|
| 262 | + $trans["&$k;"] = $v; |
|
| 263 | + } |
|
| 264 | + } |
|
| 265 | + $data = strtr($data, $trans); |
|
| 266 | + } else { |
|
| 267 | + $data = html2unicode($data, true); |
|
| 268 | + } |
|
| 269 | + |
|
| 270 | + return unicode2charset($data, $charset); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // Retirer < ? xml... ? > et autre PI, ainsi que les commentaires en debut |
@@ -277,52 +277,52 @@ discard block |
||
| 277 | 277 | // les autres formats RSS n'ont pas de DTD, |
| 278 | 278 | // mais un XML Schema que SPIP ne fait pas encore lire. |
| 279 | 279 | function analyser_doctype($data) { |
| 280 | - if (!preg_match(_REGEXP_DOCTYPE, $data, $page)) { |
|
| 281 | - if (preg_match(_REGEXP_XML, $data, $page)) { |
|
| 282 | - [, $entete, $topelement] = $page; |
|
| 283 | - if ($topelement == 'rss') { |
|
| 284 | - return [ |
|
| 285 | - $entete, |
|
| 286 | - 'PUBLIC', |
|
| 287 | - _DOCTYPE_RSS, |
|
| 288 | - 'rss-0.91.dtd' |
|
| 289 | - ]; |
|
| 290 | - } else { |
|
| 291 | - $dtd = $topelement . '.dtd'; |
|
| 292 | - $f = find_in_path($dtd); |
|
| 293 | - if (file_exists($f)) { |
|
| 294 | - return [$entete, 'SYSTEM', $f, $dtd]; |
|
| 295 | - } |
|
| 296 | - } |
|
| 297 | - } |
|
| 298 | - spip_log('Dtd pas vu pour ' . substr($data, 0, 100)); |
|
| 299 | - |
|
| 300 | - return []; |
|
| 301 | - } |
|
| 302 | - [$entete, , $topelement, $avail, $suite] = $page; |
|
| 303 | - |
|
| 304 | - if (!preg_match('/^"([^"]*)"\s*(.*)$/', $suite, $r)) { |
|
| 305 | - if (!preg_match("/^'([^']*)'\s*(.*)$/", $suite, $r)) { |
|
| 306 | - return []; |
|
| 307 | - } |
|
| 308 | - } |
|
| 309 | - [, $rotlvl, $suite] = $r; |
|
| 310 | - |
|
| 311 | - if (!$suite) { |
|
| 312 | - if ($avail != 'SYSTEM') { |
|
| 313 | - return []; |
|
| 314 | - } |
|
| 315 | - $grammaire = $rotlvl; |
|
| 316 | - $rotlvl = ''; |
|
| 317 | - } else { |
|
| 318 | - if (!preg_match('/^"([^"]*)"\s*$/', $suite, $r)) { |
|
| 319 | - if (!preg_match("/^'([^']*)'\s*$/", $suite, $r)) { |
|
| 320 | - return []; |
|
| 321 | - } |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - $grammaire = $r[1]; |
|
| 325 | - } |
|
| 326 | - |
|
| 327 | - return [$entete, $avail, $grammaire, $rotlvl]; |
|
| 280 | + if (!preg_match(_REGEXP_DOCTYPE, $data, $page)) { |
|
| 281 | + if (preg_match(_REGEXP_XML, $data, $page)) { |
|
| 282 | + [, $entete, $topelement] = $page; |
|
| 283 | + if ($topelement == 'rss') { |
|
| 284 | + return [ |
|
| 285 | + $entete, |
|
| 286 | + 'PUBLIC', |
|
| 287 | + _DOCTYPE_RSS, |
|
| 288 | + 'rss-0.91.dtd' |
|
| 289 | + ]; |
|
| 290 | + } else { |
|
| 291 | + $dtd = $topelement . '.dtd'; |
|
| 292 | + $f = find_in_path($dtd); |
|
| 293 | + if (file_exists($f)) { |
|
| 294 | + return [$entete, 'SYSTEM', $f, $dtd]; |
|
| 295 | + } |
|
| 296 | + } |
|
| 297 | + } |
|
| 298 | + spip_log('Dtd pas vu pour ' . substr($data, 0, 100)); |
|
| 299 | + |
|
| 300 | + return []; |
|
| 301 | + } |
|
| 302 | + [$entete, , $topelement, $avail, $suite] = $page; |
|
| 303 | + |
|
| 304 | + if (!preg_match('/^"([^"]*)"\s*(.*)$/', $suite, $r)) { |
|
| 305 | + if (!preg_match("/^'([^']*)'\s*(.*)$/", $suite, $r)) { |
|
| 306 | + return []; |
|
| 307 | + } |
|
| 308 | + } |
|
| 309 | + [, $rotlvl, $suite] = $r; |
|
| 310 | + |
|
| 311 | + if (!$suite) { |
|
| 312 | + if ($avail != 'SYSTEM') { |
|
| 313 | + return []; |
|
| 314 | + } |
|
| 315 | + $grammaire = $rotlvl; |
|
| 316 | + $rotlvl = ''; |
|
| 317 | + } else { |
|
| 318 | + if (!preg_match('/^"([^"]*)"\s*$/', $suite, $r)) { |
|
| 319 | + if (!preg_match("/^'([^']*)'\s*$/", $suite, $r)) { |
|
| 320 | + return []; |
|
| 321 | + } |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + $grammaire = $r[1]; |
|
| 325 | + } |
|
| 326 | + |
|
| 327 | + return [$entete, $avail, $grammaire, $rotlvl]; |
|
| 328 | 328 | } |
@@ -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 | /** Repérer un code ne calculant rien, meme avec commentaire */ |
@@ -58,92 +58,92 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | function argumenter_inclure( |
| 61 | - $params, |
|
| 62 | - $rejet_filtres, |
|
| 63 | - $p, |
|
| 64 | - &$boucles, |
|
| 65 | - $id_boucle, |
|
| 66 | - $echap = true, |
|
| 67 | - $lang = '', |
|
| 68 | - $fond1 = false |
|
| 61 | + $params, |
|
| 62 | + $rejet_filtres, |
|
| 63 | + $p, |
|
| 64 | + &$boucles, |
|
| 65 | + $id_boucle, |
|
| 66 | + $echap = true, |
|
| 67 | + $lang = '', |
|
| 68 | + $fond1 = false |
|
| 69 | 69 | ) { |
| 70 | - $l = []; |
|
| 71 | - $erreur_p_i_i = ''; |
|
| 72 | - if (!is_array($params)) { |
|
| 73 | - return $l; |
|
| 74 | - } |
|
| 75 | - foreach ($params as $k => $couple) { |
|
| 76 | - // la liste d'arguments d'inclusion peut se terminer par un filtre |
|
| 77 | - $filtre = array_shift($couple); |
|
| 78 | - if ($filtre) { |
|
| 79 | - break; |
|
| 80 | - } |
|
| 81 | - foreach ($couple as $n => $val) { |
|
| 82 | - $var = $val[0]; |
|
| 83 | - if ($var->type != 'texte') { |
|
| 84 | - if ($n or $k or $fond1) { |
|
| 85 | - $erreur_p_i_i = [ |
|
| 86 | - 'zbug_parametres_inclus_incorrects', |
|
| 87 | - ['param' => $var->nom_champ] |
|
| 88 | - ]; |
|
| 89 | - erreur_squelette($erreur_p_i_i, $p); |
|
| 90 | - break; |
|
| 91 | - } else { |
|
| 92 | - $l[1] = calculer_liste($val, $p->descr, $boucles, $id_boucle); |
|
| 93 | - } |
|
| 94 | - } else { |
|
| 95 | - preg_match(',^([^=]*)(=?)(.*)$,m', $var->texte, $m); |
|
| 96 | - $m = array_pad($m, 3, null); |
|
| 97 | - $var = $m[1]; |
|
| 98 | - $auto = false; |
|
| 70 | + $l = []; |
|
| 71 | + $erreur_p_i_i = ''; |
|
| 72 | + if (!is_array($params)) { |
|
| 73 | + return $l; |
|
| 74 | + } |
|
| 75 | + foreach ($params as $k => $couple) { |
|
| 76 | + // la liste d'arguments d'inclusion peut se terminer par un filtre |
|
| 77 | + $filtre = array_shift($couple); |
|
| 78 | + if ($filtre) { |
|
| 79 | + break; |
|
| 80 | + } |
|
| 81 | + foreach ($couple as $n => $val) { |
|
| 82 | + $var = $val[0]; |
|
| 83 | + if ($var->type != 'texte') { |
|
| 84 | + if ($n or $k or $fond1) { |
|
| 85 | + $erreur_p_i_i = [ |
|
| 86 | + 'zbug_parametres_inclus_incorrects', |
|
| 87 | + ['param' => $var->nom_champ] |
|
| 88 | + ]; |
|
| 89 | + erreur_squelette($erreur_p_i_i, $p); |
|
| 90 | + break; |
|
| 91 | + } else { |
|
| 92 | + $l[1] = calculer_liste($val, $p->descr, $boucles, $id_boucle); |
|
| 93 | + } |
|
| 94 | + } else { |
|
| 95 | + preg_match(',^([^=]*)(=?)(.*)$,m', $var->texte, $m); |
|
| 96 | + $m = array_pad($m, 3, null); |
|
| 97 | + $var = $m[1]; |
|
| 98 | + $auto = false; |
|
| 99 | 99 | ; |
| 100 | - if ($m[2]) { |
|
| 101 | - $v = $m[3]; |
|
| 102 | - if (preg_match(',^[\'"](.*)[\'"]$,', $v, $m)) { |
|
| 103 | - $v = $m[1]; |
|
| 104 | - } |
|
| 105 | - $val[0] = new Texte(); |
|
| 106 | - $val[0]->texte = $v; |
|
| 107 | - } elseif ($k or $n or $fond1) { |
|
| 108 | - $auto = true; |
|
| 109 | - } else { |
|
| 110 | - $var = 1; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - if ($var == 'lang') { |
|
| 114 | - $lang = !$auto |
|
| 115 | - ? calculer_liste($val, $p->descr, $boucles, $id_boucle) |
|
| 116 | - : '$GLOBALS["spip_lang"]'; |
|
| 117 | - } else { |
|
| 118 | - $val = $auto |
|
| 119 | - ? index_pile($id_boucle, $var, $boucles) |
|
| 120 | - : calculer_liste($val, $p->descr, $boucles, $id_boucle); |
|
| 121 | - if ($var !== 1) { |
|
| 122 | - $val = ($echap ? "\'$var\' => ' . argumenter_squelette(" : "'$var' => ") |
|
| 123 | - . $val . ($echap ? ") . '" : ' '); |
|
| 124 | - } else { |
|
| 125 | - $val = $echap ? "'.$val.'" : $val; |
|
| 126 | - } |
|
| 127 | - $l[$var] = $val; |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - if ($erreur_p_i_i) { |
|
| 133 | - return false; |
|
| 134 | - } |
|
| 135 | - // Cas particulier de la langue : si {lang=xx} est definie, on |
|
| 136 | - // la passe, sinon on passe la langue courante au moment du calcul |
|
| 137 | - // sauf si on n'en veut pas |
|
| 138 | - if ($lang === false) { |
|
| 139 | - return $l; |
|
| 140 | - } |
|
| 141 | - if (!$lang) { |
|
| 142 | - $lang = '$GLOBALS["spip_lang"]'; |
|
| 143 | - } |
|
| 144 | - $l['lang'] = ($echap ? "\'lang\' => ' . argumenter_squelette(" : "'lang' => ") . $lang . ($echap ? ") . '" : ' '); |
|
| 145 | - |
|
| 146 | - return $l; |
|
| 100 | + if ($m[2]) { |
|
| 101 | + $v = $m[3]; |
|
| 102 | + if (preg_match(',^[\'"](.*)[\'"]$,', $v, $m)) { |
|
| 103 | + $v = $m[1]; |
|
| 104 | + } |
|
| 105 | + $val[0] = new Texte(); |
|
| 106 | + $val[0]->texte = $v; |
|
| 107 | + } elseif ($k or $n or $fond1) { |
|
| 108 | + $auto = true; |
|
| 109 | + } else { |
|
| 110 | + $var = 1; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + if ($var == 'lang') { |
|
| 114 | + $lang = !$auto |
|
| 115 | + ? calculer_liste($val, $p->descr, $boucles, $id_boucle) |
|
| 116 | + : '$GLOBALS["spip_lang"]'; |
|
| 117 | + } else { |
|
| 118 | + $val = $auto |
|
| 119 | + ? index_pile($id_boucle, $var, $boucles) |
|
| 120 | + : calculer_liste($val, $p->descr, $boucles, $id_boucle); |
|
| 121 | + if ($var !== 1) { |
|
| 122 | + $val = ($echap ? "\'$var\' => ' . argumenter_squelette(" : "'$var' => ") |
|
| 123 | + . $val . ($echap ? ") . '" : ' '); |
|
| 124 | + } else { |
|
| 125 | + $val = $echap ? "'.$val.'" : $val; |
|
| 126 | + } |
|
| 127 | + $l[$var] = $val; |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + if ($erreur_p_i_i) { |
|
| 133 | + return false; |
|
| 134 | + } |
|
| 135 | + // Cas particulier de la langue : si {lang=xx} est definie, on |
|
| 136 | + // la passe, sinon on passe la langue courante au moment du calcul |
|
| 137 | + // sauf si on n'en veut pas |
|
| 138 | + if ($lang === false) { |
|
| 139 | + return $l; |
|
| 140 | + } |
|
| 141 | + if (!$lang) { |
|
| 142 | + $lang = '$GLOBALS["spip_lang"]'; |
|
| 143 | + } |
|
| 144 | + $l['lang'] = ($echap ? "\'lang\' => ' . argumenter_squelette(" : "'lang' => ") . $lang . ($echap ? ") . '" : ' '); |
|
| 145 | + |
|
| 146 | + return $l; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -167,84 +167,84 @@ discard block |
||
| 167 | 167 | **/ |
| 168 | 168 | function calculer_inclure($p, &$boucles, $id_boucle) { |
| 169 | 169 | |
| 170 | - $_options = []; |
|
| 171 | - $_contexte = argumenter_inclure($p->param, false, $p, $boucles, $id_boucle, true, '', true); |
|
| 172 | - if (is_string($p->texte)) { |
|
| 173 | - $fichier = $p->texte; |
|
| 174 | - $code = '"' . str_replace('"', '\"', $fichier) . '"'; |
|
| 175 | - } else { |
|
| 176 | - $code = calculer_liste($p->texte, $p->descr, $boucles, $id_boucle); |
|
| 177 | - if ($code and preg_match("/^'([^']*)'/s", $code, $r)) { |
|
| 178 | - $fichier = $r[1]; |
|
| 179 | - } else { |
|
| 180 | - $fichier = ''; |
|
| 181 | - } |
|
| 182 | - } |
|
| 183 | - if (!$code or $code === '""' or $code === "''") { |
|
| 184 | - $trace = $p->fonctions; |
|
| 185 | - while ( |
|
| 186 | - is_array($trace) |
|
| 187 | - and $trace = array_filter($trace) |
|
| 188 | - and count($trace) == 1 |
|
| 189 | - ) { |
|
| 190 | - $trace = reset($trace); |
|
| 191 | - } |
|
| 192 | - $erreur_p_i_i = [ |
|
| 193 | - 'zbug_parametres_inclus_incorrects', |
|
| 194 | - ['param' => print_r($trace, true)] |
|
| 195 | - ]; |
|
| 196 | - erreur_squelette($erreur_p_i_i, $p); |
|
| 197 | - |
|
| 198 | - return "''"; |
|
| 199 | - } |
|
| 200 | - $compil = texte_script(memoriser_contexte_compil($p)); |
|
| 201 | - |
|
| 202 | - if (is_array($_contexte)) { |
|
| 203 | - // Critere d'inclusion {env} (et {self} pour compatibilite ascendante) |
|
| 204 | - if ($env = (isset($_contexte['env']) || isset($_contexte['self']))) { |
|
| 205 | - unset($_contexte['env']); |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - // noter les doublons dans l'appel a public.php |
|
| 209 | - if (isset($_contexte['doublons'])) { |
|
| 210 | - $_contexte['doublons'] = "\\'doublons\\' => '.var_export(\$doublons,true).'"; |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - if ($ajax = isset($_contexte['ajax'])) { |
|
| 214 | - $ajax = preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 215 | - unset($_contexte['ajax']); |
|
| 216 | - } |
|
| 217 | - |
|
| 218 | - $_contexte = join(",\n\t", $_contexte); |
|
| 219 | - } else { |
|
| 220 | - return false; |
|
| 221 | - } // j'aurais voulu toucher le fond ... |
|
| 222 | - |
|
| 223 | - $contexte = 'array(' . $_contexte . ')'; |
|
| 224 | - |
|
| 225 | - if ($env) { |
|
| 226 | - $contexte = "array_merge('.var_export(\$Pile[0],1).',$contexte)"; |
|
| 227 | - } |
|
| 228 | - |
|
| 229 | - // s'il y a une extension .php, ce n'est pas un squelette |
|
| 230 | - if ($fichier and preg_match('/^.+[.]php$/s', $fichier)) { |
|
| 231 | - $code = sandbox_composer_inclure_php($fichier, $p, $contexte); |
|
| 232 | - } else { |
|
| 233 | - $_options[] = "\"compil\"=>array($compil)"; |
|
| 234 | - if ($ajax) { |
|
| 235 | - $_options[] = $ajax; |
|
| 236 | - } |
|
| 237 | - $code = " ' . argumenter_squelette($code) . '"; |
|
| 238 | - $code = 'echo ' . sprintf( |
|
| 239 | - CODE_RECUPERER_FOND, |
|
| 240 | - $code, |
|
| 241 | - $contexte, |
|
| 242 | - implode(',', $_options), |
|
| 243 | - "_request(\\'connect\\') ?? \\'\\'" |
|
| 244 | - ) . ';'; |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - return "\n'<'.'" . '?php ' . $code . "\n?'." . "'>'"; |
|
| 170 | + $_options = []; |
|
| 171 | + $_contexte = argumenter_inclure($p->param, false, $p, $boucles, $id_boucle, true, '', true); |
|
| 172 | + if (is_string($p->texte)) { |
|
| 173 | + $fichier = $p->texte; |
|
| 174 | + $code = '"' . str_replace('"', '\"', $fichier) . '"'; |
|
| 175 | + } else { |
|
| 176 | + $code = calculer_liste($p->texte, $p->descr, $boucles, $id_boucle); |
|
| 177 | + if ($code and preg_match("/^'([^']*)'/s", $code, $r)) { |
|
| 178 | + $fichier = $r[1]; |
|
| 179 | + } else { |
|
| 180 | + $fichier = ''; |
|
| 181 | + } |
|
| 182 | + } |
|
| 183 | + if (!$code or $code === '""' or $code === "''") { |
|
| 184 | + $trace = $p->fonctions; |
|
| 185 | + while ( |
|
| 186 | + is_array($trace) |
|
| 187 | + and $trace = array_filter($trace) |
|
| 188 | + and count($trace) == 1 |
|
| 189 | + ) { |
|
| 190 | + $trace = reset($trace); |
|
| 191 | + } |
|
| 192 | + $erreur_p_i_i = [ |
|
| 193 | + 'zbug_parametres_inclus_incorrects', |
|
| 194 | + ['param' => print_r($trace, true)] |
|
| 195 | + ]; |
|
| 196 | + erreur_squelette($erreur_p_i_i, $p); |
|
| 197 | + |
|
| 198 | + return "''"; |
|
| 199 | + } |
|
| 200 | + $compil = texte_script(memoriser_contexte_compil($p)); |
|
| 201 | + |
|
| 202 | + if (is_array($_contexte)) { |
|
| 203 | + // Critere d'inclusion {env} (et {self} pour compatibilite ascendante) |
|
| 204 | + if ($env = (isset($_contexte['env']) || isset($_contexte['self']))) { |
|
| 205 | + unset($_contexte['env']); |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + // noter les doublons dans l'appel a public.php |
|
| 209 | + if (isset($_contexte['doublons'])) { |
|
| 210 | + $_contexte['doublons'] = "\\'doublons\\' => '.var_export(\$doublons,true).'"; |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + if ($ajax = isset($_contexte['ajax'])) { |
|
| 214 | + $ajax = preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 215 | + unset($_contexte['ajax']); |
|
| 216 | + } |
|
| 217 | + |
|
| 218 | + $_contexte = join(",\n\t", $_contexte); |
|
| 219 | + } else { |
|
| 220 | + return false; |
|
| 221 | + } // j'aurais voulu toucher le fond ... |
|
| 222 | + |
|
| 223 | + $contexte = 'array(' . $_contexte . ')'; |
|
| 224 | + |
|
| 225 | + if ($env) { |
|
| 226 | + $contexte = "array_merge('.var_export(\$Pile[0],1).',$contexte)"; |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + // s'il y a une extension .php, ce n'est pas un squelette |
|
| 230 | + if ($fichier and preg_match('/^.+[.]php$/s', $fichier)) { |
|
| 231 | + $code = sandbox_composer_inclure_php($fichier, $p, $contexte); |
|
| 232 | + } else { |
|
| 233 | + $_options[] = "\"compil\"=>array($compil)"; |
|
| 234 | + if ($ajax) { |
|
| 235 | + $_options[] = $ajax; |
|
| 236 | + } |
|
| 237 | + $code = " ' . argumenter_squelette($code) . '"; |
|
| 238 | + $code = 'echo ' . sprintf( |
|
| 239 | + CODE_RECUPERER_FOND, |
|
| 240 | + $code, |
|
| 241 | + $contexte, |
|
| 242 | + implode(',', $_options), |
|
| 243 | + "_request(\\'connect\\') ?? \\'\\'" |
|
| 244 | + ) . ';'; |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + return "\n'<'.'" . '?php ' . $code . "\n?'." . "'>'"; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * true pour ne tester que le cas publie et ignorer l'eventuel var_mode=preview de la page |
| 263 | 263 | */ |
| 264 | 264 | function instituer_boucle(&$boucle, $echapper = true, $ignore_previsu = false) { |
| 265 | - /* |
|
| 265 | + /* |
|
| 266 | 266 | $show['statut'][] = array( |
| 267 | 267 | 'champ'=>'statut', // champ de la table sur lequel porte le filtrage par le statut |
| 268 | 268 | 'publie'=>'publie', // valeur ou liste de valeurs, qui definissent l'objet comme publie. |
@@ -286,74 +286,74 @@ discard block |
||
| 286 | 286 | champstatut est alors le champ statut sur la tablen |
| 287 | 287 | dans les jointures, clen peut etre un tableau pour une jointure complexe : array('id_objet','id_article','objet','article') |
| 288 | 288 | */ |
| 289 | - $id_table = $boucle->id_table; |
|
| 290 | - $show = $boucle->show; |
|
| 291 | - if (isset($show['statut']) and $show['statut']) { |
|
| 292 | - foreach ($show['statut'] as $k => $s) { |
|
| 293 | - // Restreindre aux elements publies si pas de {statut} ou autre dans les criteres |
|
| 294 | - $filtrer = true; |
|
| 295 | - if (isset($s['exception'])) { |
|
| 296 | - foreach (is_array($s['exception']) ? $s['exception'] : [$s['exception']] as $m) { |
|
| 297 | - if (isset($boucle->modificateur[$m]) or isset($boucle->modificateur['criteres'][$m])) { |
|
| 298 | - $filtrer = false; |
|
| 299 | - break; |
|
| 300 | - } |
|
| 301 | - } |
|
| 302 | - } |
|
| 303 | - |
|
| 304 | - if ($filtrer) { |
|
| 305 | - if (is_array($s['champ'])) { |
|
| 306 | - $statut = preg_replace(',\W,', '', array_pop($s['champ'])); // securite |
|
| 307 | - $jointures = []; |
|
| 308 | - // indiquer la description de chaque table dans le tableau de jointures, |
|
| 309 | - // ce qui permet d'eviter certains GROUP BY inutiles. |
|
| 310 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 311 | - foreach ($s['champ'] as $j) { |
|
| 312 | - $id = reset($j); |
|
| 313 | - $def = $trouver_table($id); |
|
| 314 | - $jointures[] = ['', [$id, $def], end($j)]; |
|
| 315 | - } |
|
| 316 | - $jointures[0][0] = $id_table; |
|
| 317 | - if (!array_search($id, $boucle->from)) { |
|
| 318 | - include_spip('public/jointures'); |
|
| 319 | - fabrique_jointures($boucle, $jointures, true, $boucle->show, $id_table, '', $echapper); |
|
| 320 | - } |
|
| 321 | - // trouver l'alias de la table d'arrivee qui porte le statut |
|
| 322 | - $id = array_search($id, $boucle->from); |
|
| 323 | - } else { |
|
| 324 | - $id = $id_table; |
|
| 325 | - $statut = preg_replace(',\W,', '', $s['champ']); // securite |
|
| 326 | - } |
|
| 327 | - $mstatut = $id . '.' . $statut; |
|
| 328 | - |
|
| 329 | - $arg_ignore_previsu = ($ignore_previsu ? ',true' : ''); |
|
| 330 | - include_spip('public/quete'); |
|
| 331 | - if ( |
|
| 332 | - isset($s['post_date']) and $s['post_date'] |
|
| 333 | - and $GLOBALS['meta']['post_dates'] == 'non' |
|
| 334 | - ) { |
|
| 335 | - $date = $id . '.' . preg_replace(',\W,', '', $s['post_date']); // securite |
|
| 336 | - array_unshift( |
|
| 337 | - $boucle->where, |
|
| 338 | - $echapper ? |
|
| 339 | - "\nquete_condition_postdates('$date'," . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 340 | - : |
|
| 341 | - quete_condition_postdates($date, $boucle->sql_serveur, $ignore_previsu) |
|
| 342 | - ); |
|
| 343 | - } |
|
| 344 | - array_unshift( |
|
| 345 | - $boucle->where, |
|
| 346 | - $echapper ? |
|
| 347 | - "\nquete_condition_statut('$mstatut'," |
|
| 348 | - . _q($s['previsu']) . ',' |
|
| 349 | - . _q($s['publie']) . ',' |
|
| 350 | - . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 351 | - : |
|
| 352 | - quete_condition_statut($mstatut, $s['previsu'], $s['publie'], $boucle->sql_serveur, $ignore_previsu) |
|
| 353 | - ); |
|
| 354 | - } |
|
| 355 | - } |
|
| 356 | - } |
|
| 289 | + $id_table = $boucle->id_table; |
|
| 290 | + $show = $boucle->show; |
|
| 291 | + if (isset($show['statut']) and $show['statut']) { |
|
| 292 | + foreach ($show['statut'] as $k => $s) { |
|
| 293 | + // Restreindre aux elements publies si pas de {statut} ou autre dans les criteres |
|
| 294 | + $filtrer = true; |
|
| 295 | + if (isset($s['exception'])) { |
|
| 296 | + foreach (is_array($s['exception']) ? $s['exception'] : [$s['exception']] as $m) { |
|
| 297 | + if (isset($boucle->modificateur[$m]) or isset($boucle->modificateur['criteres'][$m])) { |
|
| 298 | + $filtrer = false; |
|
| 299 | + break; |
|
| 300 | + } |
|
| 301 | + } |
|
| 302 | + } |
|
| 303 | + |
|
| 304 | + if ($filtrer) { |
|
| 305 | + if (is_array($s['champ'])) { |
|
| 306 | + $statut = preg_replace(',\W,', '', array_pop($s['champ'])); // securite |
|
| 307 | + $jointures = []; |
|
| 308 | + // indiquer la description de chaque table dans le tableau de jointures, |
|
| 309 | + // ce qui permet d'eviter certains GROUP BY inutiles. |
|
| 310 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 311 | + foreach ($s['champ'] as $j) { |
|
| 312 | + $id = reset($j); |
|
| 313 | + $def = $trouver_table($id); |
|
| 314 | + $jointures[] = ['', [$id, $def], end($j)]; |
|
| 315 | + } |
|
| 316 | + $jointures[0][0] = $id_table; |
|
| 317 | + if (!array_search($id, $boucle->from)) { |
|
| 318 | + include_spip('public/jointures'); |
|
| 319 | + fabrique_jointures($boucle, $jointures, true, $boucle->show, $id_table, '', $echapper); |
|
| 320 | + } |
|
| 321 | + // trouver l'alias de la table d'arrivee qui porte le statut |
|
| 322 | + $id = array_search($id, $boucle->from); |
|
| 323 | + } else { |
|
| 324 | + $id = $id_table; |
|
| 325 | + $statut = preg_replace(',\W,', '', $s['champ']); // securite |
|
| 326 | + } |
|
| 327 | + $mstatut = $id . '.' . $statut; |
|
| 328 | + |
|
| 329 | + $arg_ignore_previsu = ($ignore_previsu ? ',true' : ''); |
|
| 330 | + include_spip('public/quete'); |
|
| 331 | + if ( |
|
| 332 | + isset($s['post_date']) and $s['post_date'] |
|
| 333 | + and $GLOBALS['meta']['post_dates'] == 'non' |
|
| 334 | + ) { |
|
| 335 | + $date = $id . '.' . preg_replace(',\W,', '', $s['post_date']); // securite |
|
| 336 | + array_unshift( |
|
| 337 | + $boucle->where, |
|
| 338 | + $echapper ? |
|
| 339 | + "\nquete_condition_postdates('$date'," . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 340 | + : |
|
| 341 | + quete_condition_postdates($date, $boucle->sql_serveur, $ignore_previsu) |
|
| 342 | + ); |
|
| 343 | + } |
|
| 344 | + array_unshift( |
|
| 345 | + $boucle->where, |
|
| 346 | + $echapper ? |
|
| 347 | + "\nquete_condition_statut('$mstatut'," |
|
| 348 | + . _q($s['previsu']) . ',' |
|
| 349 | + . _q($s['publie']) . ',' |
|
| 350 | + . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 351 | + : |
|
| 352 | + quete_condition_statut($mstatut, $s['previsu'], $s['publie'], $boucle->sql_serveur, $ignore_previsu) |
|
| 353 | + ); |
|
| 354 | + } |
|
| 355 | + } |
|
| 356 | + } |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |
@@ -372,29 +372,29 @@ discard block |
||
| 372 | 372 | */ |
| 373 | 373 | function calculer_boucle($id_boucle, &$boucles) { |
| 374 | 374 | |
| 375 | - $boucle = &$boucles[$id_boucle]; |
|
| 376 | - instituer_boucle($boucle); |
|
| 377 | - $boucles[$id_boucle] = pipeline('post_boucle', $boucles[$id_boucle]); |
|
| 378 | - |
|
| 379 | - // en mode debug memoriser les premiers passages dans la boucle, |
|
| 380 | - // mais pas tous, sinon ca pete. |
|
| 381 | - if (_request('var_mode_affiche') != 'resultat') { |
|
| 382 | - $trace = ''; |
|
| 383 | - } else { |
|
| 384 | - $_trace = $boucles[$id_boucle]->descr['nom'] . $id_boucle; |
|
| 385 | - $_trace = "\$GLOBALS['debug_objets']['resultat']['$_trace']"; |
|
| 386 | - $trace = " |
|
| 375 | + $boucle = &$boucles[$id_boucle]; |
|
| 376 | + instituer_boucle($boucle); |
|
| 377 | + $boucles[$id_boucle] = pipeline('post_boucle', $boucles[$id_boucle]); |
|
| 378 | + |
|
| 379 | + // en mode debug memoriser les premiers passages dans la boucle, |
|
| 380 | + // mais pas tous, sinon ca pete. |
|
| 381 | + if (_request('var_mode_affiche') != 'resultat') { |
|
| 382 | + $trace = ''; |
|
| 383 | + } else { |
|
| 384 | + $_trace = $boucles[$id_boucle]->descr['nom'] . $id_boucle; |
|
| 385 | + $_trace = "\$GLOBALS['debug_objets']['resultat']['$_trace']"; |
|
| 386 | + $trace = " |
|
| 387 | 387 | if (empty($_trace)) { |
| 388 | 388 | $_trace = []; |
| 389 | 389 | } |
| 390 | 390 | if (count($_trace) < 3) { |
| 391 | 391 | $_trace" . '[] = $t0; |
| 392 | 392 | }'; |
| 393 | - } |
|
| 393 | + } |
|
| 394 | 394 | |
| 395 | - return ($boucles[$id_boucle]->type_requete == TYPE_RECURSIF) |
|
| 396 | - ? calculer_boucle_rec($id_boucle, $boucles, $trace) |
|
| 397 | - : calculer_boucle_nonrec($id_boucle, $boucles, $trace); |
|
| 395 | + return ($boucles[$id_boucle]->type_requete == TYPE_RECURSIF) |
|
| 396 | + ? calculer_boucle_rec($id_boucle, $boucles, $trace) |
|
| 397 | + : calculer_boucle_nonrec($id_boucle, $boucles, $trace); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | |
@@ -417,15 +417,15 @@ discard block |
||
| 417 | 417 | * Code PHP compilé de la boucle récursive |
| 418 | 418 | **/ |
| 419 | 419 | function calculer_boucle_rec($id_boucle, &$boucles, $trace) { |
| 420 | - $nom = $boucles[$id_boucle]->param[0]; |
|
| 421 | - |
|
| 422 | - return |
|
| 423 | - // Numrows[$nom] peut ne pas être encore defini |
|
| 424 | - "\n\t\$save_numrows = (isset(\$Numrows['$nom']) ? \$Numrows['$nom'] : array());" |
|
| 425 | - . "\n\t\$t0 = " . $boucles[$id_boucle]->return . ';' |
|
| 426 | - . "\n\t\$Numrows['$nom'] = (\$save_numrows);" |
|
| 427 | - . $trace |
|
| 428 | - . "\n\treturn \$t0;"; |
|
| 420 | + $nom = $boucles[$id_boucle]->param[0]; |
|
| 421 | + |
|
| 422 | + return |
|
| 423 | + // Numrows[$nom] peut ne pas être encore defini |
|
| 424 | + "\n\t\$save_numrows = (isset(\$Numrows['$nom']) ? \$Numrows['$nom'] : array());" |
|
| 425 | + . "\n\t\$t0 = " . $boucles[$id_boucle]->return . ';' |
|
| 426 | + . "\n\t\$Numrows['$nom'] = (\$save_numrows);" |
|
| 427 | + . $trace |
|
| 428 | + . "\n\treturn \$t0;"; |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | /** |
@@ -478,174 +478,174 @@ discard block |
||
| 478 | 478 | **/ |
| 479 | 479 | function calculer_boucle_nonrec($id_boucle, &$boucles, $trace) { |
| 480 | 480 | |
| 481 | - $code_sep = null; |
|
| 482 | - $boucle = &$boucles[$id_boucle]; |
|
| 483 | - $return = $boucle->return; |
|
| 484 | - $type_boucle = $boucle->type_requete; |
|
| 485 | - $primary = $boucle->primary; |
|
| 486 | - $constant = preg_match(CODE_MONOTONE, str_replace("\\'", '', $return)); |
|
| 487 | - $flag_cpt = $boucle->mode_partie || $boucle->cptrows; |
|
| 488 | - $corps = ''; |
|
| 489 | - |
|
| 490 | - // faudrait expanser le foreach a la compil, car y en a souvent qu'un |
|
| 491 | - // et puis faire un [] plutot qu'un "','." |
|
| 492 | - if ($boucle->doublons) { |
|
| 493 | - $corps .= "\n\t\t\tforeach(" . $boucle->doublons . ' as $k) $doublons[$k] .= "," . ' . |
|
| 494 | - index_pile($id_boucle, $primary, $boucles) |
|
| 495 | - . "; // doublons\n"; |
|
| 496 | - } |
|
| 497 | - |
|
| 498 | - // La boucle doit-elle selectionner la langue ? |
|
| 499 | - // - par defaut, les boucles suivantes le font |
|
| 500 | - // (sauf si forcer_lang==true ou si le titre contient <multi>). |
|
| 501 | - // - a moins d'une demande explicite via {!lang_select} |
|
| 502 | - if ( |
|
| 503 | - !$constant && $boucle->lang_select != 'non' && |
|
| 504 | - (($boucle->lang_select == 'oui') || |
|
| 505 | - in_array($type_boucle, [ |
|
| 506 | - 'articles', |
|
| 507 | - 'rubriques', |
|
| 508 | - 'hierarchie', |
|
| 509 | - 'breves' |
|
| 510 | - ])) |
|
| 511 | - ) { |
|
| 512 | - // Memoriser la langue avant la boucle et la restituer apres |
|
| 513 | - // afin que le corps de boucle affecte la globale directement |
|
| 514 | - $init_lang = "lang_select(\$GLOBALS['spip_lang']);\n\t"; |
|
| 515 | - $fin_lang = "lang_select();\n\t"; |
|
| 516 | - $fin_lang_select_public = "\n\t\tlang_select();"; |
|
| 517 | - |
|
| 518 | - $corps .= |
|
| 519 | - "\n\t\tlang_select_public(" |
|
| 520 | - . index_pile($id_boucle, 'lang', $boucles) |
|
| 521 | - . ", '" . $boucle->lang_select . "'" |
|
| 522 | - . (in_array($type_boucle, [ |
|
| 523 | - 'articles', |
|
| 524 | - 'rubriques', |
|
| 525 | - 'hierarchie', |
|
| 526 | - 'breves' |
|
| 527 | - ]) ? ', ' . index_pile($id_boucle, 'titre', $boucles) : '') |
|
| 528 | - . ');'; |
|
| 529 | - } else { |
|
| 530 | - $init_lang = ''; |
|
| 531 | - $fin_lang = ''; |
|
| 532 | - $fin_lang_select_public = ''; |
|
| 533 | - // sortir les appels au traducteur (invariants de boucle) |
|
| 534 | - if ( |
|
| 535 | - strpos($return, '?php') === false |
|
| 536 | - and preg_match_all("/\W(_T[(]'[^']*'[)])/", $return, $r) |
|
| 537 | - ) { |
|
| 538 | - $i = 1; |
|
| 539 | - foreach ($r[1] as $t) { |
|
| 540 | - $init_lang .= "\n\t\$l$i = $t;"; |
|
| 541 | - $return = str_replace($t, "\$l$i", $return); |
|
| 542 | - $i++; |
|
| 543 | - } |
|
| 544 | - } |
|
| 545 | - } |
|
| 546 | - |
|
| 547 | - // gestion optimale des separateurs et des boucles constantes |
|
| 548 | - if (is_countable($boucle->separateur) ? count($boucle->separateur) : 0) { |
|
| 549 | - $code_sep = ("'" . str_replace("'", "\'", join('', $boucle->separateur)) . "'"); |
|
| 550 | - } |
|
| 551 | - |
|
| 552 | - $corps .= |
|
| 553 | - ((!$boucle->separateur) ? |
|
| 554 | - (($constant && !$corps && !$flag_cpt) ? $return : |
|
| 555 | - (($return === "''") ? '' : |
|
| 556 | - ("\n\t\t" . '$t0 .= ' . $return . ';'))) : |
|
| 557 | - ("\n\t\t\$t1 " . |
|
| 558 | - ((strpos($return, '$t1.') === 0) ? |
|
| 559 | - ('.=' . substr($return, 4)) : |
|
| 560 | - ('= ' . $return)) . |
|
| 561 | - ";\n\t\t" . |
|
| 562 | - '$t0 .= ((strlen($t1) && strlen($t0)) ? ' . $code_sep . " : '') . \$t1;")); |
|
| 563 | - |
|
| 564 | - // Calculer les invalideurs si c'est une boucle non constante et si on |
|
| 565 | - // souhaite invalider ces elements |
|
| 566 | - if (!$constant and $primary) { |
|
| 567 | - include_spip('inc/invalideur'); |
|
| 568 | - $corps = calcul_invalideurs($corps, $primary, $boucles, $id_boucle); |
|
| 569 | - } |
|
| 570 | - |
|
| 571 | - // gerer le compteur de boucle |
|
| 572 | - // avec ou sans son utilisation par les criteres {1/3} {1,4} {n-2,1}... |
|
| 573 | - |
|
| 574 | - if ($boucle->partie or $boucle->cptrows) { |
|
| 575 | - $corps = "\n\t\t\$Numrows['$id_boucle']['compteur_boucle']++;" |
|
| 576 | - . $boucle->partie |
|
| 577 | - . $corps; |
|
| 578 | - } |
|
| 579 | - |
|
| 580 | - // depiler la lang de la boucle si besoin |
|
| 581 | - $corps .= $fin_lang_select_public; |
|
| 582 | - |
|
| 583 | - // si le corps est une constante, ne pas appeler le serveur N fois! |
|
| 584 | - |
|
| 585 | - if (preg_match(CODE_MONOTONE, str_replace("\\'", '', $corps), $r)) { |
|
| 586 | - if (!isset($r[2]) or (!$r[2])) { |
|
| 587 | - if (!$boucle->numrows) { |
|
| 588 | - return "\n\t\$t0 = '';"; |
|
| 589 | - } else { |
|
| 590 | - $corps = ''; |
|
| 591 | - } |
|
| 592 | - } else { |
|
| 593 | - $boucle->numrows = true; |
|
| 594 | - $corps = "\n\t\$t0 = str_repeat($corps, \$Numrows['$id_boucle']['total']);"; |
|
| 595 | - } |
|
| 596 | - } else { |
|
| 597 | - $corps = "while (\$Pile[\$SP]=\$iter->fetch()) {\n$corps\n }"; |
|
| 598 | - } |
|
| 599 | - |
|
| 600 | - $count = ''; |
|
| 601 | - if (!$boucle->select) { |
|
| 602 | - if (!$boucle->numrows or $boucle->limit or $boucle->mode_partie or $boucle->group) { |
|
| 603 | - $count = '1'; |
|
| 604 | - } else { |
|
| 605 | - $count = 'count(*)'; |
|
| 606 | - } |
|
| 607 | - $boucles[$id_boucle]->select[] = $count; |
|
| 608 | - } |
|
| 609 | - |
|
| 610 | - if ($flag_cpt) { |
|
| 611 | - $nums = "\n\t// COMPTEUR\n\t" |
|
| 612 | - . "\$Numrows['$id_boucle']['compteur_boucle'] = 0;\n\t"; |
|
| 613 | - } else { |
|
| 614 | - $nums = ''; |
|
| 615 | - } |
|
| 616 | - |
|
| 617 | - if ($boucle->numrows or $boucle->mode_partie) { |
|
| 618 | - $nums .= "\$Numrows['$id_boucle']['command'] = \$command;\n\t" |
|
| 619 | - . "\$Numrows['$id_boucle']['total'] = @intval(\$iter->count());" |
|
| 620 | - . $boucle->mode_partie |
|
| 621 | - . "\n\t"; |
|
| 622 | - } |
|
| 623 | - |
|
| 624 | - // Ne calculer la requete que maintenant |
|
| 625 | - // car ce qui precede appelle index_pile qui influe dessus |
|
| 626 | - |
|
| 627 | - $init = (($init = $boucles[$id_boucle]->doublons) |
|
| 628 | - ? ("\n\t$init = array();") : '') |
|
| 629 | - . calculer_requete_sql($boucles[$id_boucle]); |
|
| 630 | - |
|
| 631 | - $contexte = memoriser_contexte_compil($boucle); |
|
| 632 | - |
|
| 633 | - $a = sprintf( |
|
| 634 | - CODE_CORPS_BOUCLE, |
|
| 635 | - $init, |
|
| 636 | - $boucle->iterateur, |
|
| 637 | - '$command', |
|
| 638 | - $contexte, |
|
| 639 | - $nums, |
|
| 640 | - $init_lang, |
|
| 641 | - $corps, |
|
| 642 | - $fin_lang, |
|
| 643 | - $trace, |
|
| 644 | - 'BOUCLE' . $id_boucle . ' @ ' . ($boucle->descr['sourcefile']) |
|
| 645 | - ); |
|
| 481 | + $code_sep = null; |
|
| 482 | + $boucle = &$boucles[$id_boucle]; |
|
| 483 | + $return = $boucle->return; |
|
| 484 | + $type_boucle = $boucle->type_requete; |
|
| 485 | + $primary = $boucle->primary; |
|
| 486 | + $constant = preg_match(CODE_MONOTONE, str_replace("\\'", '', $return)); |
|
| 487 | + $flag_cpt = $boucle->mode_partie || $boucle->cptrows; |
|
| 488 | + $corps = ''; |
|
| 489 | + |
|
| 490 | + // faudrait expanser le foreach a la compil, car y en a souvent qu'un |
|
| 491 | + // et puis faire un [] plutot qu'un "','." |
|
| 492 | + if ($boucle->doublons) { |
|
| 493 | + $corps .= "\n\t\t\tforeach(" . $boucle->doublons . ' as $k) $doublons[$k] .= "," . ' . |
|
| 494 | + index_pile($id_boucle, $primary, $boucles) |
|
| 495 | + . "; // doublons\n"; |
|
| 496 | + } |
|
| 497 | + |
|
| 498 | + // La boucle doit-elle selectionner la langue ? |
|
| 499 | + // - par defaut, les boucles suivantes le font |
|
| 500 | + // (sauf si forcer_lang==true ou si le titre contient <multi>). |
|
| 501 | + // - a moins d'une demande explicite via {!lang_select} |
|
| 502 | + if ( |
|
| 503 | + !$constant && $boucle->lang_select != 'non' && |
|
| 504 | + (($boucle->lang_select == 'oui') || |
|
| 505 | + in_array($type_boucle, [ |
|
| 506 | + 'articles', |
|
| 507 | + 'rubriques', |
|
| 508 | + 'hierarchie', |
|
| 509 | + 'breves' |
|
| 510 | + ])) |
|
| 511 | + ) { |
|
| 512 | + // Memoriser la langue avant la boucle et la restituer apres |
|
| 513 | + // afin que le corps de boucle affecte la globale directement |
|
| 514 | + $init_lang = "lang_select(\$GLOBALS['spip_lang']);\n\t"; |
|
| 515 | + $fin_lang = "lang_select();\n\t"; |
|
| 516 | + $fin_lang_select_public = "\n\t\tlang_select();"; |
|
| 517 | + |
|
| 518 | + $corps .= |
|
| 519 | + "\n\t\tlang_select_public(" |
|
| 520 | + . index_pile($id_boucle, 'lang', $boucles) |
|
| 521 | + . ", '" . $boucle->lang_select . "'" |
|
| 522 | + . (in_array($type_boucle, [ |
|
| 523 | + 'articles', |
|
| 524 | + 'rubriques', |
|
| 525 | + 'hierarchie', |
|
| 526 | + 'breves' |
|
| 527 | + ]) ? ', ' . index_pile($id_boucle, 'titre', $boucles) : '') |
|
| 528 | + . ');'; |
|
| 529 | + } else { |
|
| 530 | + $init_lang = ''; |
|
| 531 | + $fin_lang = ''; |
|
| 532 | + $fin_lang_select_public = ''; |
|
| 533 | + // sortir les appels au traducteur (invariants de boucle) |
|
| 534 | + if ( |
|
| 535 | + strpos($return, '?php') === false |
|
| 536 | + and preg_match_all("/\W(_T[(]'[^']*'[)])/", $return, $r) |
|
| 537 | + ) { |
|
| 538 | + $i = 1; |
|
| 539 | + foreach ($r[1] as $t) { |
|
| 540 | + $init_lang .= "\n\t\$l$i = $t;"; |
|
| 541 | + $return = str_replace($t, "\$l$i", $return); |
|
| 542 | + $i++; |
|
| 543 | + } |
|
| 544 | + } |
|
| 545 | + } |
|
| 546 | + |
|
| 547 | + // gestion optimale des separateurs et des boucles constantes |
|
| 548 | + if (is_countable($boucle->separateur) ? count($boucle->separateur) : 0) { |
|
| 549 | + $code_sep = ("'" . str_replace("'", "\'", join('', $boucle->separateur)) . "'"); |
|
| 550 | + } |
|
| 551 | + |
|
| 552 | + $corps .= |
|
| 553 | + ((!$boucle->separateur) ? |
|
| 554 | + (($constant && !$corps && !$flag_cpt) ? $return : |
|
| 555 | + (($return === "''") ? '' : |
|
| 556 | + ("\n\t\t" . '$t0 .= ' . $return . ';'))) : |
|
| 557 | + ("\n\t\t\$t1 " . |
|
| 558 | + ((strpos($return, '$t1.') === 0) ? |
|
| 559 | + ('.=' . substr($return, 4)) : |
|
| 560 | + ('= ' . $return)) . |
|
| 561 | + ";\n\t\t" . |
|
| 562 | + '$t0 .= ((strlen($t1) && strlen($t0)) ? ' . $code_sep . " : '') . \$t1;")); |
|
| 563 | + |
|
| 564 | + // Calculer les invalideurs si c'est une boucle non constante et si on |
|
| 565 | + // souhaite invalider ces elements |
|
| 566 | + if (!$constant and $primary) { |
|
| 567 | + include_spip('inc/invalideur'); |
|
| 568 | + $corps = calcul_invalideurs($corps, $primary, $boucles, $id_boucle); |
|
| 569 | + } |
|
| 570 | + |
|
| 571 | + // gerer le compteur de boucle |
|
| 572 | + // avec ou sans son utilisation par les criteres {1/3} {1,4} {n-2,1}... |
|
| 573 | + |
|
| 574 | + if ($boucle->partie or $boucle->cptrows) { |
|
| 575 | + $corps = "\n\t\t\$Numrows['$id_boucle']['compteur_boucle']++;" |
|
| 576 | + . $boucle->partie |
|
| 577 | + . $corps; |
|
| 578 | + } |
|
| 579 | + |
|
| 580 | + // depiler la lang de la boucle si besoin |
|
| 581 | + $corps .= $fin_lang_select_public; |
|
| 582 | + |
|
| 583 | + // si le corps est une constante, ne pas appeler le serveur N fois! |
|
| 584 | + |
|
| 585 | + if (preg_match(CODE_MONOTONE, str_replace("\\'", '', $corps), $r)) { |
|
| 586 | + if (!isset($r[2]) or (!$r[2])) { |
|
| 587 | + if (!$boucle->numrows) { |
|
| 588 | + return "\n\t\$t0 = '';"; |
|
| 589 | + } else { |
|
| 590 | + $corps = ''; |
|
| 591 | + } |
|
| 592 | + } else { |
|
| 593 | + $boucle->numrows = true; |
|
| 594 | + $corps = "\n\t\$t0 = str_repeat($corps, \$Numrows['$id_boucle']['total']);"; |
|
| 595 | + } |
|
| 596 | + } else { |
|
| 597 | + $corps = "while (\$Pile[\$SP]=\$iter->fetch()) {\n$corps\n }"; |
|
| 598 | + } |
|
| 599 | + |
|
| 600 | + $count = ''; |
|
| 601 | + if (!$boucle->select) { |
|
| 602 | + if (!$boucle->numrows or $boucle->limit or $boucle->mode_partie or $boucle->group) { |
|
| 603 | + $count = '1'; |
|
| 604 | + } else { |
|
| 605 | + $count = 'count(*)'; |
|
| 606 | + } |
|
| 607 | + $boucles[$id_boucle]->select[] = $count; |
|
| 608 | + } |
|
| 609 | + |
|
| 610 | + if ($flag_cpt) { |
|
| 611 | + $nums = "\n\t// COMPTEUR\n\t" |
|
| 612 | + . "\$Numrows['$id_boucle']['compteur_boucle'] = 0;\n\t"; |
|
| 613 | + } else { |
|
| 614 | + $nums = ''; |
|
| 615 | + } |
|
| 616 | + |
|
| 617 | + if ($boucle->numrows or $boucle->mode_partie) { |
|
| 618 | + $nums .= "\$Numrows['$id_boucle']['command'] = \$command;\n\t" |
|
| 619 | + . "\$Numrows['$id_boucle']['total'] = @intval(\$iter->count());" |
|
| 620 | + . $boucle->mode_partie |
|
| 621 | + . "\n\t"; |
|
| 622 | + } |
|
| 623 | + |
|
| 624 | + // Ne calculer la requete que maintenant |
|
| 625 | + // car ce qui precede appelle index_pile qui influe dessus |
|
| 626 | + |
|
| 627 | + $init = (($init = $boucles[$id_boucle]->doublons) |
|
| 628 | + ? ("\n\t$init = array();") : '') |
|
| 629 | + . calculer_requete_sql($boucles[$id_boucle]); |
|
| 630 | + |
|
| 631 | + $contexte = memoriser_contexte_compil($boucle); |
|
| 632 | + |
|
| 633 | + $a = sprintf( |
|
| 634 | + CODE_CORPS_BOUCLE, |
|
| 635 | + $init, |
|
| 636 | + $boucle->iterateur, |
|
| 637 | + '$command', |
|
| 638 | + $contexte, |
|
| 639 | + $nums, |
|
| 640 | + $init_lang, |
|
| 641 | + $corps, |
|
| 642 | + $fin_lang, |
|
| 643 | + $trace, |
|
| 644 | + 'BOUCLE' . $id_boucle . ' @ ' . ($boucle->descr['sourcefile']) |
|
| 645 | + ); |
|
| 646 | 646 | |
| 647 | 647 | # var_dump($a);exit; |
| 648 | - return $a; |
|
| 648 | + return $a; |
|
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | |
@@ -661,48 +661,48 @@ discard block |
||
| 661 | 661 | * Code PHP compilé définissant les informations de requête |
| 662 | 662 | **/ |
| 663 | 663 | function calculer_requete_sql($boucle) { |
| 664 | - $init = []; |
|
| 665 | - $init[] = calculer_dec('table', "'" . $boucle->id_table . "'"); |
|
| 666 | - $init[] = calculer_dec('id', "'" . $boucle->id_boucle . "'"); |
|
| 667 | - # En absence de champ c'est un decompte : |
|
| 668 | - $init[] = calculer_dec('from', calculer_from($boucle)); |
|
| 669 | - $init[] = calculer_dec('type', calculer_from_type($boucle)); |
|
| 670 | - $init[] = calculer_dec( |
|
| 671 | - 'groupby', |
|
| 672 | - 'array(' . (($g = join("\",\n\t\t\"", $boucle->group)) ? '"' . $g . '"' : '') . ')' |
|
| 673 | - ); |
|
| 674 | - $init[] = calculer_dec('select', 'array("' . join("\",\n\t\t\"", $boucle->select) . '")'); |
|
| 675 | - $init[] = calculer_dec('orderby', 'array(' . calculer_order($boucle) . ')'); |
|
| 676 | - $init[] = calculer_dec('where', calculer_dump_array($boucle->where)); |
|
| 677 | - $init[] = calculer_dec('join', calculer_dump_join($boucle->join)); |
|
| 678 | - $init[] = calculer_dec( |
|
| 679 | - 'limit', |
|
| 680 | - ( |
|
| 681 | - strpos($boucle->limit, 'intval') === false ? |
|
| 682 | - "'" . ($boucle->limit) . "'" : |
|
| 683 | - $boucle->limit |
|
| 684 | - ) |
|
| 685 | - ); |
|
| 686 | - $init[] = calculer_dec('having', calculer_dump_array($boucle->having)); |
|
| 687 | - $s = $d = ''; |
|
| 688 | - // l'index 0 de $i indique si l'affectation est statique (contenu) |
|
| 689 | - // ou recalculée à chaque passage (vide) |
|
| 690 | - foreach ($init as $i) { |
|
| 691 | - if (reset($i)) { |
|
| 692 | - $s .= "\n\t\t" . end($i); |
|
| 693 | - } # statique |
|
| 694 | - else { |
|
| 695 | - $d .= "\n\t" . end($i); |
|
| 696 | - } # dynamique |
|
| 697 | - } |
|
| 698 | - |
|
| 699 | - return ($boucle->hierarchie ? "\n\t$boucle->hierarchie" : '') |
|
| 700 | - . $boucle->in |
|
| 701 | - . $boucle->hash |
|
| 702 | - . "\n\t" . 'if (!isset($command[\'table\'])) {' |
|
| 703 | - . $s |
|
| 704 | - . "\n\t}" |
|
| 705 | - . $d; |
|
| 664 | + $init = []; |
|
| 665 | + $init[] = calculer_dec('table', "'" . $boucle->id_table . "'"); |
|
| 666 | + $init[] = calculer_dec('id', "'" . $boucle->id_boucle . "'"); |
|
| 667 | + # En absence de champ c'est un decompte : |
|
| 668 | + $init[] = calculer_dec('from', calculer_from($boucle)); |
|
| 669 | + $init[] = calculer_dec('type', calculer_from_type($boucle)); |
|
| 670 | + $init[] = calculer_dec( |
|
| 671 | + 'groupby', |
|
| 672 | + 'array(' . (($g = join("\",\n\t\t\"", $boucle->group)) ? '"' . $g . '"' : '') . ')' |
|
| 673 | + ); |
|
| 674 | + $init[] = calculer_dec('select', 'array("' . join("\",\n\t\t\"", $boucle->select) . '")'); |
|
| 675 | + $init[] = calculer_dec('orderby', 'array(' . calculer_order($boucle) . ')'); |
|
| 676 | + $init[] = calculer_dec('where', calculer_dump_array($boucle->where)); |
|
| 677 | + $init[] = calculer_dec('join', calculer_dump_join($boucle->join)); |
|
| 678 | + $init[] = calculer_dec( |
|
| 679 | + 'limit', |
|
| 680 | + ( |
|
| 681 | + strpos($boucle->limit, 'intval') === false ? |
|
| 682 | + "'" . ($boucle->limit) . "'" : |
|
| 683 | + $boucle->limit |
|
| 684 | + ) |
|
| 685 | + ); |
|
| 686 | + $init[] = calculer_dec('having', calculer_dump_array($boucle->having)); |
|
| 687 | + $s = $d = ''; |
|
| 688 | + // l'index 0 de $i indique si l'affectation est statique (contenu) |
|
| 689 | + // ou recalculée à chaque passage (vide) |
|
| 690 | + foreach ($init as $i) { |
|
| 691 | + if (reset($i)) { |
|
| 692 | + $s .= "\n\t\t" . end($i); |
|
| 693 | + } # statique |
|
| 694 | + else { |
|
| 695 | + $d .= "\n\t" . end($i); |
|
| 696 | + } # dynamique |
|
| 697 | + } |
|
| 698 | + |
|
| 699 | + return ($boucle->hierarchie ? "\n\t$boucle->hierarchie" : '') |
|
| 700 | + . $boucle->in |
|
| 701 | + . $boucle->hash |
|
| 702 | + . "\n\t" . 'if (!isset($command[\'table\'])) {' |
|
| 703 | + . $s |
|
| 704 | + . "\n\t}" |
|
| 705 | + . $d; |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | /** |
@@ -720,13 +720,13 @@ discard block |
||
| 720 | 720 | * qui peut être utilisé pour la production d'un tableau array() |
| 721 | 721 | **/ |
| 722 | 722 | function memoriser_contexte_compil($p) { |
| 723 | - return join(',', [ |
|
| 724 | - _q($p->descr['sourcefile'] ?? ''), |
|
| 725 | - _q($p->descr['nom'] ?? ''), |
|
| 726 | - _q($p->id_boucle ?? ''), |
|
| 727 | - intval($p->ligne), |
|
| 728 | - '$GLOBALS[\'spip_lang\']' |
|
| 729 | - ]); |
|
| 723 | + return join(',', [ |
|
| 724 | + _q($p->descr['sourcefile'] ?? ''), |
|
| 725 | + _q($p->descr['nom'] ?? ''), |
|
| 726 | + _q($p->id_boucle ?? ''), |
|
| 727 | + intval($p->ligne), |
|
| 728 | + '$GLOBALS[\'spip_lang\']' |
|
| 729 | + ]); |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | /** |
@@ -744,19 +744,19 @@ discard block |
||
| 744 | 744 | * Objet Contexte |
| 745 | 745 | **/ |
| 746 | 746 | function reconstruire_contexte_compil($context_compil) { |
| 747 | - if (!is_array($context_compil)) { |
|
| 748 | - return $context_compil; |
|
| 749 | - } |
|
| 750 | - $p = new Contexte(); |
|
| 751 | - $p->descr = [ |
|
| 752 | - 'sourcefile' => $context_compil[0] ?? '', |
|
| 753 | - 'nom' => $context_compil[1] ?? '', |
|
| 754 | - ]; |
|
| 755 | - $p->id_boucle = $context_compil[2] ?? ''; |
|
| 756 | - $p->ligne = $context_compil[3] ?? ''; |
|
| 757 | - $p->lang = $context_compil[4] ?? ''; |
|
| 758 | - |
|
| 759 | - return $p; |
|
| 747 | + if (!is_array($context_compil)) { |
|
| 748 | + return $context_compil; |
|
| 749 | + } |
|
| 750 | + $p = new Contexte(); |
|
| 751 | + $p->descr = [ |
|
| 752 | + 'sourcefile' => $context_compil[0] ?? '', |
|
| 753 | + 'nom' => $context_compil[1] ?? '', |
|
| 754 | + ]; |
|
| 755 | + $p->id_boucle = $context_compil[2] ?? ''; |
|
| 756 | + $p->ligne = $context_compil[3] ?? ''; |
|
| 757 | + $p->lang = $context_compil[4] ?? ''; |
|
| 758 | + |
|
| 759 | + return $p; |
|
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | /** |
@@ -782,12 +782,12 @@ discard block |
||
| 782 | 782 | * - index 1 : Code de l'affectation |
| 783 | 783 | **/ |
| 784 | 784 | function calculer_dec($nom, $val) { |
| 785 | - $static = 'if (!isset($command[\'' . $nom . '\'])) '; |
|
| 786 | - // si une variable apparait dans le calcul de la clause |
|
| 787 | - // il faut la re-evaluer a chaque passage |
|
| 788 | - if ( |
|
| 789 | - strpos($val, '$') !== false |
|
| 790 | - /* |
|
| 785 | + $static = 'if (!isset($command[\'' . $nom . '\'])) '; |
|
| 786 | + // si une variable apparait dans le calcul de la clause |
|
| 787 | + // il faut la re-evaluer a chaque passage |
|
| 788 | + if ( |
|
| 789 | + strpos($val, '$') !== false |
|
| 790 | + /* |
|
| 791 | 791 | OR strpos($val, 'sql_') !== false |
| 792 | 792 | OR ( |
| 793 | 793 | $test = str_replace(array("array(",'\"',"\'"),array("","",""),$val) // supprimer les array( et les echappements de guillemets |
@@ -795,11 +795,11 @@ discard block |
||
| 795 | 795 | AND $test = preg_replace(",'[^']*',UimsS","",$test) // supprimer les chaines qui peuvent contenir des fonctions SQL qui ne genent pas |
| 796 | 796 | AND preg_match(",\w+\s*\(,UimsS",$test,$regs) // tester la presence de fonctions restantes |
| 797 | 797 | )*/ |
| 798 | - ) { |
|
| 799 | - $static = ''; |
|
| 800 | - } |
|
| 798 | + ) { |
|
| 799 | + $static = ''; |
|
| 800 | + } |
|
| 801 | 801 | |
| 802 | - return [$static, '$command[\'' . $nom . '\'] = ' . $val . ';']; |
|
| 802 | + return [$static, '$command[\'' . $nom . '\'] = ' . $val . ';']; |
|
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | /** |
@@ -819,32 +819,32 @@ discard block |
||
| 819 | 819 | * Expression PHP décrivant un texte ou un tableau |
| 820 | 820 | **/ |
| 821 | 821 | function calculer_dump_array($a) { |
| 822 | - if (!is_array($a)) { |
|
| 823 | - return $a; |
|
| 824 | - } |
|
| 825 | - $res = ''; |
|
| 826 | - if ($a and $a[0] == "'?'") { |
|
| 827 | - return ('(' . calculer_dump_array($a[1]) . |
|
| 828 | - ' ? ' . calculer_dump_array($a[2]) . |
|
| 829 | - ' : ' . calculer_dump_array($a[3]) . |
|
| 830 | - ')'); |
|
| 831 | - } else { |
|
| 832 | - foreach ($a as $k => $v) { |
|
| 833 | - $showk = (is_numeric($k) ? '' : sql_quote($k) . ' => '); |
|
| 834 | - $res .= ', ' . $showk . calculer_dump_array($v); |
|
| 835 | - } |
|
| 836 | - |
|
| 837 | - return "\n\t\t\tarray(" . substr($res, 2) . ')'; |
|
| 838 | - } |
|
| 822 | + if (!is_array($a)) { |
|
| 823 | + return $a; |
|
| 824 | + } |
|
| 825 | + $res = ''; |
|
| 826 | + if ($a and $a[0] == "'?'") { |
|
| 827 | + return ('(' . calculer_dump_array($a[1]) . |
|
| 828 | + ' ? ' . calculer_dump_array($a[2]) . |
|
| 829 | + ' : ' . calculer_dump_array($a[3]) . |
|
| 830 | + ')'); |
|
| 831 | + } else { |
|
| 832 | + foreach ($a as $k => $v) { |
|
| 833 | + $showk = (is_numeric($k) ? '' : sql_quote($k) . ' => '); |
|
| 834 | + $res .= ', ' . $showk . calculer_dump_array($v); |
|
| 835 | + } |
|
| 836 | + |
|
| 837 | + return "\n\t\t\tarray(" . substr($res, 2) . ')'; |
|
| 838 | + } |
|
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | function calculer_dump_join($a) { |
| 842 | - $res = ''; |
|
| 843 | - foreach ($a as $k => $v) { |
|
| 844 | - $res .= ", '$k' => array(" . implode(',', $v) . ')'; |
|
| 845 | - } |
|
| 842 | + $res = ''; |
|
| 843 | + foreach ($a as $k => $v) { |
|
| 844 | + $res .= ", '$k' => array(" . implode(',', $v) . ')'; |
|
| 845 | + } |
|
| 846 | 846 | |
| 847 | - return 'array(' . substr($res, 2) . ')'; |
|
| 847 | + return 'array(' . substr($res, 2) . ')'; |
|
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | /** |
@@ -856,12 +856,12 @@ discard block |
||
| 856 | 856 | * Code PHP construisant un tableau des alias et noms des tables du FROM |
| 857 | 857 | **/ |
| 858 | 858 | function calculer_from(&$boucle) { |
| 859 | - $res = ''; |
|
| 860 | - foreach ($boucle->from as $k => $v) { |
|
| 861 | - $res .= ",'$k' => '$v'"; |
|
| 862 | - } |
|
| 859 | + $res = ''; |
|
| 860 | + foreach ($boucle->from as $k => $v) { |
|
| 861 | + $res .= ",'$k' => '$v'"; |
|
| 862 | + } |
|
| 863 | 863 | |
| 864 | - return 'array(' . substr($res, 1) . ')'; |
|
| 864 | + return 'array(' . substr($res, 1) . ')'; |
|
| 865 | 865 | } |
| 866 | 866 | |
| 867 | 867 | /** |
@@ -874,30 +874,30 @@ discard block |
||
| 874 | 874 | * Code PHP construisant un tableau des alias et type de jointure du FROM |
| 875 | 875 | **/ |
| 876 | 876 | function calculer_from_type(&$boucle) { |
| 877 | - $res = ''; |
|
| 878 | - foreach ($boucle->from_type as $k => $v) { |
|
| 879 | - $res .= ",'$k' => '$v'"; |
|
| 880 | - } |
|
| 877 | + $res = ''; |
|
| 878 | + foreach ($boucle->from_type as $k => $v) { |
|
| 879 | + $res .= ",'$k' => '$v'"; |
|
| 880 | + } |
|
| 881 | 881 | |
| 882 | - return 'array(' . substr($res, 1) . ')'; |
|
| 882 | + return 'array(' . substr($res, 1) . ')'; |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | 885 | function calculer_order(&$boucle) { |
| 886 | - if ( |
|
| 887 | - !$order = $boucle->order |
|
| 888 | - and !$order = $boucle->default_order |
|
| 889 | - ) { |
|
| 890 | - $order = []; |
|
| 891 | - } |
|
| 892 | - |
|
| 893 | - /*if (isset($boucle->modificateur['collate'])){ |
|
| 886 | + if ( |
|
| 887 | + !$order = $boucle->order |
|
| 888 | + and !$order = $boucle->default_order |
|
| 889 | + ) { |
|
| 890 | + $order = []; |
|
| 891 | + } |
|
| 892 | + |
|
| 893 | + /*if (isset($boucle->modificateur['collate'])){ |
|
| 894 | 894 | $col = "." . $boucle->modificateur['collate']; |
| 895 | 895 | foreach($order as $k=>$o) |
| 896 | 896 | if (strpos($order[$k],'COLLATE')===false) |
| 897 | 897 | $order[$k].= $col; |
| 898 | 898 | }*/ |
| 899 | 899 | |
| 900 | - return join(', ', $order); |
|
| 900 | + return join(', ', $order); |
|
| 901 | 901 | } |
| 902 | 902 | |
| 903 | 903 | // Production du code PHP a partir de la sequence livree par le phraseur |
@@ -906,62 +906,62 @@ discard block |
||
| 906 | 906 | // (qui sera argument d'un Return ou la partie droite d'une affectation). |
| 907 | 907 | |
| 908 | 908 | function calculer_liste($tableau, $descr, &$boucles, $id_boucle = '') { |
| 909 | - if (!$tableau) { |
|
| 910 | - return "''"; |
|
| 911 | - } |
|
| 912 | - if (is_string($descr)) { |
|
| 913 | - if (isset($boucles[$descr])) { |
|
| 914 | - $idb = $descr; |
|
| 915 | - $descr = []; |
|
| 916 | - if (isset($boucles[$idb]->descr['id_mere_contexte'])) { |
|
| 917 | - $descr['id_mere'] = $boucles[$idb]->descr['id_mere_contexte']; |
|
| 918 | - } |
|
| 919 | - if (isset($boucles[$idb]->descr['sourcefile'])) { |
|
| 920 | - $descr['sourcefile'] = $boucles[$idb]->descr['sourcefile']; |
|
| 921 | - } |
|
| 922 | - } |
|
| 923 | - else { |
|
| 924 | - $descr = []; |
|
| 925 | - } |
|
| 926 | - } |
|
| 927 | - if (!isset($descr['niv'])) { |
|
| 928 | - $descr['niv'] = 0; |
|
| 929 | - } |
|
| 930 | - $codes = compile_cas($tableau, $descr, $boucles, $id_boucle); |
|
| 931 | - if ($codes === false) { |
|
| 932 | - return false; |
|
| 933 | - } |
|
| 934 | - $n = is_countable($codes) ? count($codes) : 0; |
|
| 935 | - if (!$n) { |
|
| 936 | - return "''"; |
|
| 937 | - } |
|
| 938 | - $tab = str_repeat("\t", $descr['niv']); |
|
| 939 | - if (_request('var_mode_affiche') != 'validation') { |
|
| 940 | - if ($n == 1) { |
|
| 941 | - return $codes[0]; |
|
| 942 | - } else { |
|
| 943 | - $res = ''; |
|
| 944 | - foreach ($codes as $code) { |
|
| 945 | - if ( |
|
| 946 | - !preg_match("/^'[^']*'$/", $code) |
|
| 947 | - or substr($res, -1, 1) !== "'" |
|
| 948 | - ) { |
|
| 949 | - $res .= " .\n$tab$code"; |
|
| 950 | - } else { |
|
| 951 | - $res = substr($res, 0, -1) . substr($code, 1); |
|
| 952 | - } |
|
| 953 | - } |
|
| 954 | - |
|
| 955 | - return '(' . substr($res, 2 + $descr['niv']) . ')'; |
|
| 956 | - } |
|
| 957 | - } else { |
|
| 958 | - $nom = $descr['nom'] . $id_boucle . ($descr['niv'] ?: ''); |
|
| 959 | - |
|
| 960 | - return "join('', array_map('array_shift', \$GLOBALS['debug_objets']['sequence']['$nom'] = array(" . join( |
|
| 961 | - " ,\n$tab", |
|
| 962 | - $codes |
|
| 963 | - ) . ')))'; |
|
| 964 | - } |
|
| 909 | + if (!$tableau) { |
|
| 910 | + return "''"; |
|
| 911 | + } |
|
| 912 | + if (is_string($descr)) { |
|
| 913 | + if (isset($boucles[$descr])) { |
|
| 914 | + $idb = $descr; |
|
| 915 | + $descr = []; |
|
| 916 | + if (isset($boucles[$idb]->descr['id_mere_contexte'])) { |
|
| 917 | + $descr['id_mere'] = $boucles[$idb]->descr['id_mere_contexte']; |
|
| 918 | + } |
|
| 919 | + if (isset($boucles[$idb]->descr['sourcefile'])) { |
|
| 920 | + $descr['sourcefile'] = $boucles[$idb]->descr['sourcefile']; |
|
| 921 | + } |
|
| 922 | + } |
|
| 923 | + else { |
|
| 924 | + $descr = []; |
|
| 925 | + } |
|
| 926 | + } |
|
| 927 | + if (!isset($descr['niv'])) { |
|
| 928 | + $descr['niv'] = 0; |
|
| 929 | + } |
|
| 930 | + $codes = compile_cas($tableau, $descr, $boucles, $id_boucle); |
|
| 931 | + if ($codes === false) { |
|
| 932 | + return false; |
|
| 933 | + } |
|
| 934 | + $n = is_countable($codes) ? count($codes) : 0; |
|
| 935 | + if (!$n) { |
|
| 936 | + return "''"; |
|
| 937 | + } |
|
| 938 | + $tab = str_repeat("\t", $descr['niv']); |
|
| 939 | + if (_request('var_mode_affiche') != 'validation') { |
|
| 940 | + if ($n == 1) { |
|
| 941 | + return $codes[0]; |
|
| 942 | + } else { |
|
| 943 | + $res = ''; |
|
| 944 | + foreach ($codes as $code) { |
|
| 945 | + if ( |
|
| 946 | + !preg_match("/^'[^']*'$/", $code) |
|
| 947 | + or substr($res, -1, 1) !== "'" |
|
| 948 | + ) { |
|
| 949 | + $res .= " .\n$tab$code"; |
|
| 950 | + } else { |
|
| 951 | + $res = substr($res, 0, -1) . substr($code, 1); |
|
| 952 | + } |
|
| 953 | + } |
|
| 954 | + |
|
| 955 | + return '(' . substr($res, 2 + $descr['niv']) . ')'; |
|
| 956 | + } |
|
| 957 | + } else { |
|
| 958 | + $nom = $descr['nom'] . $id_boucle . ($descr['niv'] ?: ''); |
|
| 959 | + |
|
| 960 | + return "join('', array_map('array_shift', \$GLOBALS['debug_objets']['sequence']['$nom'] = array(" . join( |
|
| 961 | + " ,\n$tab", |
|
| 962 | + $codes |
|
| 963 | + ) . ')))'; |
|
| 964 | + } |
|
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | |
@@ -971,213 +971,213 @@ discard block |
||
| 971 | 971 | |
| 972 | 972 | function compile_cas($tableau, $descr, &$boucles, $id_boucle) { |
| 973 | 973 | |
| 974 | - $codes = []; |
|
| 975 | - // cas de la boucle recursive |
|
| 976 | - if (is_array($id_boucle)) { |
|
| 977 | - $id_boucle = $id_boucle[0]; |
|
| 978 | - } |
|
| 979 | - $type = !$id_boucle ? '' : $boucles[$id_boucle]->type_requete; |
|
| 980 | - $tab = str_repeat("\t", ++$descr['niv']); |
|
| 981 | - $mode = _request('var_mode_affiche'); |
|
| 982 | - $err_e_c = ''; |
|
| 983 | - // chaque commentaire introduit dans le code doit commencer |
|
| 984 | - // par un caractere distinguant le cas, pour exploitation par debug. |
|
| 985 | - foreach ($tableau as $p) { |
|
| 986 | - switch ($p->type) { |
|
| 987 | - // texte seul |
|
| 988 | - case 'texte': |
|
| 989 | - $code = sandbox_composer_texte($p->texte, $p); |
|
| 990 | - $commentaire = strlen($p->texte) . ' signes'; |
|
| 991 | - $avant = ''; |
|
| 992 | - $apres = ''; |
|
| 993 | - $altern = "''"; |
|
| 994 | - break; |
|
| 995 | - |
|
| 996 | - case 'polyglotte': |
|
| 997 | - $code = ''; |
|
| 998 | - foreach ($p->traductions as $k => $v) { |
|
| 999 | - $code .= ",'" . |
|
| 1000 | - str_replace(['\\', "'"], ['\\\\', "\\'"], $k) . |
|
| 1001 | - "' => '" . |
|
| 1002 | - str_replace(['\\', "'"], ['\\\\', "\\'"], $v) . |
|
| 1003 | - "'"; |
|
| 1004 | - } |
|
| 1005 | - $code = 'choisir_traduction(array(' . |
|
| 1006 | - substr($code, 1) . |
|
| 1007 | - '))'; |
|
| 1008 | - $commentaire = '&'; |
|
| 1009 | - $avant = ''; |
|
| 1010 | - $apres = ''; |
|
| 1011 | - $altern = "''"; |
|
| 1012 | - break; |
|
| 1013 | - |
|
| 1014 | - // inclure |
|
| 1015 | - case 'include': |
|
| 1016 | - $p->descr = $descr; |
|
| 1017 | - $code = calculer_inclure($p, $boucles, $id_boucle); |
|
| 1018 | - if ($code === false) { |
|
| 1019 | - $err_e_c = true; |
|
| 1020 | - $code = "''"; |
|
| 1021 | - } else { |
|
| 1022 | - $commentaire = '<INCLURE ' . addslashes(str_replace("\n", ' ', $code)) . '>'; |
|
| 1023 | - $avant = ''; |
|
| 1024 | - $apres = ''; |
|
| 1025 | - $altern = "''"; |
|
| 1026 | - } |
|
| 1027 | - break; |
|
| 1028 | - |
|
| 1029 | - // boucle |
|
| 1030 | - case TYPE_RECURSIF: |
|
| 1031 | - $nom = $p->id_boucle; |
|
| 1032 | - $newdescr = $descr; |
|
| 1033 | - $newdescr['id_mere'] = $nom; |
|
| 1034 | - $newdescr['niv']++; |
|
| 1035 | - $preaff = calculer_liste($p->preaff, $newdescr, $boucles, $id_boucle); |
|
| 1036 | - $avant = calculer_liste($p->avant, $newdescr, $boucles, $id_boucle); |
|
| 1037 | - $apres = calculer_liste($p->apres, $newdescr, $boucles, $id_boucle); |
|
| 1038 | - $postaff = calculer_liste($p->postaff, $newdescr, $boucles, $id_boucle); |
|
| 1039 | - $newdescr['niv']--; |
|
| 1040 | - $altern = calculer_liste($p->altern, $newdescr, $boucles, $id_boucle); |
|
| 1041 | - if ( |
|
| 1042 | - $preaff === false |
|
| 1043 | - or $avant === false |
|
| 1044 | - or $apres === false |
|
| 1045 | - or $altern === false |
|
| 1046 | - or $postaff === false |
|
| 1047 | - ) { |
|
| 1048 | - $err_e_c = true; |
|
| 1049 | - $code = "''"; |
|
| 1050 | - } else { |
|
| 1051 | - $code = 'BOUCLE' . |
|
| 1052 | - str_replace('-', '_', $nom) . $descr['nom'] . |
|
| 1053 | - '($Cache, $Pile, $doublons, $Numrows, $SP)'; |
|
| 1054 | - $commentaire = "?$nom"; |
|
| 1055 | - if ( |
|
| 1056 | - !$boucles[$nom]->milieu |
|
| 1057 | - and $boucles[$nom]->type_requete <> TYPE_RECURSIF |
|
| 1058 | - ) { |
|
| 1059 | - if ($preaff != "''") { |
|
| 1060 | - $code .= "\n. $preaff"; |
|
| 1061 | - } |
|
| 1062 | - if ($altern != "''") { |
|
| 1063 | - $code .= "\n. $altern"; |
|
| 1064 | - } |
|
| 1065 | - if ($postaff != "''") { |
|
| 1066 | - $code .= "\n. $postaff"; |
|
| 1067 | - } |
|
| 1068 | - if ($avant <> "''" or $apres <> "''") { |
|
| 1069 | - spip_log("boucle $nom toujours vide, code superflu dans $descr[sourcefile]"); |
|
| 1070 | - } |
|
| 1071 | - $avant = $apres = $altern = "''"; |
|
| 1072 | - } else { |
|
| 1073 | - if ($preaff != "''") { |
|
| 1074 | - $avant = compile_concatene_parties_codes($preaff, $avant); |
|
| 1075 | - $altern = compile_concatene_parties_codes($preaff, $altern); |
|
| 1076 | - } |
|
| 1077 | - if ($postaff != "''") { |
|
| 1078 | - $apres = compile_concatene_parties_codes($apres, $postaff); |
|
| 1079 | - $altern = compile_concatene_parties_codes($altern, $postaff); |
|
| 1080 | - } |
|
| 1081 | - if ($altern != "''") { |
|
| 1082 | - $altern = "($altern)"; |
|
| 1083 | - } |
|
| 1084 | - } |
|
| 1085 | - } |
|
| 1086 | - break; |
|
| 1087 | - |
|
| 1088 | - case 'idiome': |
|
| 1089 | - $l = []; |
|
| 1090 | - $code = ''; |
|
| 1091 | - foreach ($p->arg as $k => $v) { |
|
| 1092 | - $_v = calculer_liste($v, $descr, $boucles, $id_boucle); |
|
| 1093 | - if ($k) { |
|
| 1094 | - $l[] = _q($k) . ' => ' . $_v; |
|
| 1095 | - } else { |
|
| 1096 | - $code = $_v; |
|
| 1097 | - } |
|
| 1098 | - } |
|
| 1099 | - // Si le module n'est pas fourni, l'expliciter sauf si calculé |
|
| 1100 | - if ($p->module) { |
|
| 1101 | - $m = $p->module . ':' . $p->nom_champ; |
|
| 1102 | - } elseif ($p->nom_champ) { |
|
| 1103 | - $m = MODULES_IDIOMES . ':' . $p->nom_champ; |
|
| 1104 | - } else { |
|
| 1105 | - $m = ''; |
|
| 1106 | - } |
|
| 1107 | - |
|
| 1108 | - $code = (!$code ? "'$m'" : |
|
| 1109 | - ($m ? "'$m' . $code" : |
|
| 1110 | - ("(strpos(\$x=$code, ':') ? \$x : ('" . MODULES_IDIOMES . ":' . \$x))"))) |
|
| 1111 | - . (!$l ? '' : (', array(' . implode(",\n", $l) . ')')); |
|
| 1112 | - $code = "_T($code)"; |
|
| 1113 | - if ($p->param) { |
|
| 1114 | - $p->id_boucle = $id_boucle; |
|
| 1115 | - $p->boucles = &$boucles; |
|
| 1116 | - $code = compose_filtres($p, $code); |
|
| 1117 | - } |
|
| 1118 | - $commentaire = ':'; |
|
| 1119 | - $avant = ''; |
|
| 1120 | - $apres = ''; |
|
| 1121 | - $altern = "''"; |
|
| 1122 | - break; |
|
| 1123 | - |
|
| 1124 | - case 'champ': |
|
| 1125 | - // cette structure pourrait etre completee des le phrase' (a faire) |
|
| 1126 | - $p->id_boucle = $id_boucle; |
|
| 1127 | - $p->boucles = &$boucles; |
|
| 1128 | - $p->descr = $descr; |
|
| 1129 | - #$p->interdire_scripts = true; |
|
| 1130 | - $p->type_requete = $type; |
|
| 1131 | - |
|
| 1132 | - $code = calculer_champ($p); |
|
| 1133 | - $commentaire = '#' . $p->nom_champ . $p->etoile; |
|
| 1134 | - $avant = calculer_liste( |
|
| 1135 | - $p->avant, |
|
| 1136 | - $descr, |
|
| 1137 | - $boucles, |
|
| 1138 | - $id_boucle |
|
| 1139 | - ); |
|
| 1140 | - $apres = calculer_liste( |
|
| 1141 | - $p->apres, |
|
| 1142 | - $descr, |
|
| 1143 | - $boucles, |
|
| 1144 | - $id_boucle |
|
| 1145 | - ); |
|
| 1146 | - $altern = "''"; |
|
| 1147 | - // Si la valeur est destinee a une comparaison a '' |
|
| 1148 | - // forcer la conversion en une chaine par strval |
|
| 1149 | - // si ca peut etre autre chose qu'une chaine |
|
| 1150 | - if ( |
|
| 1151 | - ($avant != "''" or $apres != "''") |
|
| 1152 | - and $code[0] != "'" |
|
| 974 | + $codes = []; |
|
| 975 | + // cas de la boucle recursive |
|
| 976 | + if (is_array($id_boucle)) { |
|
| 977 | + $id_boucle = $id_boucle[0]; |
|
| 978 | + } |
|
| 979 | + $type = !$id_boucle ? '' : $boucles[$id_boucle]->type_requete; |
|
| 980 | + $tab = str_repeat("\t", ++$descr['niv']); |
|
| 981 | + $mode = _request('var_mode_affiche'); |
|
| 982 | + $err_e_c = ''; |
|
| 983 | + // chaque commentaire introduit dans le code doit commencer |
|
| 984 | + // par un caractere distinguant le cas, pour exploitation par debug. |
|
| 985 | + foreach ($tableau as $p) { |
|
| 986 | + switch ($p->type) { |
|
| 987 | + // texte seul |
|
| 988 | + case 'texte': |
|
| 989 | + $code = sandbox_composer_texte($p->texte, $p); |
|
| 990 | + $commentaire = strlen($p->texte) . ' signes'; |
|
| 991 | + $avant = ''; |
|
| 992 | + $apres = ''; |
|
| 993 | + $altern = "''"; |
|
| 994 | + break; |
|
| 995 | + |
|
| 996 | + case 'polyglotte': |
|
| 997 | + $code = ''; |
|
| 998 | + foreach ($p->traductions as $k => $v) { |
|
| 999 | + $code .= ",'" . |
|
| 1000 | + str_replace(['\\', "'"], ['\\\\', "\\'"], $k) . |
|
| 1001 | + "' => '" . |
|
| 1002 | + str_replace(['\\', "'"], ['\\\\', "\\'"], $v) . |
|
| 1003 | + "'"; |
|
| 1004 | + } |
|
| 1005 | + $code = 'choisir_traduction(array(' . |
|
| 1006 | + substr($code, 1) . |
|
| 1007 | + '))'; |
|
| 1008 | + $commentaire = '&'; |
|
| 1009 | + $avant = ''; |
|
| 1010 | + $apres = ''; |
|
| 1011 | + $altern = "''"; |
|
| 1012 | + break; |
|
| 1013 | + |
|
| 1014 | + // inclure |
|
| 1015 | + case 'include': |
|
| 1016 | + $p->descr = $descr; |
|
| 1017 | + $code = calculer_inclure($p, $boucles, $id_boucle); |
|
| 1018 | + if ($code === false) { |
|
| 1019 | + $err_e_c = true; |
|
| 1020 | + $code = "''"; |
|
| 1021 | + } else { |
|
| 1022 | + $commentaire = '<INCLURE ' . addslashes(str_replace("\n", ' ', $code)) . '>'; |
|
| 1023 | + $avant = ''; |
|
| 1024 | + $apres = ''; |
|
| 1025 | + $altern = "''"; |
|
| 1026 | + } |
|
| 1027 | + break; |
|
| 1028 | + |
|
| 1029 | + // boucle |
|
| 1030 | + case TYPE_RECURSIF: |
|
| 1031 | + $nom = $p->id_boucle; |
|
| 1032 | + $newdescr = $descr; |
|
| 1033 | + $newdescr['id_mere'] = $nom; |
|
| 1034 | + $newdescr['niv']++; |
|
| 1035 | + $preaff = calculer_liste($p->preaff, $newdescr, $boucles, $id_boucle); |
|
| 1036 | + $avant = calculer_liste($p->avant, $newdescr, $boucles, $id_boucle); |
|
| 1037 | + $apres = calculer_liste($p->apres, $newdescr, $boucles, $id_boucle); |
|
| 1038 | + $postaff = calculer_liste($p->postaff, $newdescr, $boucles, $id_boucle); |
|
| 1039 | + $newdescr['niv']--; |
|
| 1040 | + $altern = calculer_liste($p->altern, $newdescr, $boucles, $id_boucle); |
|
| 1041 | + if ( |
|
| 1042 | + $preaff === false |
|
| 1043 | + or $avant === false |
|
| 1044 | + or $apres === false |
|
| 1045 | + or $altern === false |
|
| 1046 | + or $postaff === false |
|
| 1047 | + ) { |
|
| 1048 | + $err_e_c = true; |
|
| 1049 | + $code = "''"; |
|
| 1050 | + } else { |
|
| 1051 | + $code = 'BOUCLE' . |
|
| 1052 | + str_replace('-', '_', $nom) . $descr['nom'] . |
|
| 1053 | + '($Cache, $Pile, $doublons, $Numrows, $SP)'; |
|
| 1054 | + $commentaire = "?$nom"; |
|
| 1055 | + if ( |
|
| 1056 | + !$boucles[$nom]->milieu |
|
| 1057 | + and $boucles[$nom]->type_requete <> TYPE_RECURSIF |
|
| 1058 | + ) { |
|
| 1059 | + if ($preaff != "''") { |
|
| 1060 | + $code .= "\n. $preaff"; |
|
| 1061 | + } |
|
| 1062 | + if ($altern != "''") { |
|
| 1063 | + $code .= "\n. $altern"; |
|
| 1064 | + } |
|
| 1065 | + if ($postaff != "''") { |
|
| 1066 | + $code .= "\n. $postaff"; |
|
| 1067 | + } |
|
| 1068 | + if ($avant <> "''" or $apres <> "''") { |
|
| 1069 | + spip_log("boucle $nom toujours vide, code superflu dans $descr[sourcefile]"); |
|
| 1070 | + } |
|
| 1071 | + $avant = $apres = $altern = "''"; |
|
| 1072 | + } else { |
|
| 1073 | + if ($preaff != "''") { |
|
| 1074 | + $avant = compile_concatene_parties_codes($preaff, $avant); |
|
| 1075 | + $altern = compile_concatene_parties_codes($preaff, $altern); |
|
| 1076 | + } |
|
| 1077 | + if ($postaff != "''") { |
|
| 1078 | + $apres = compile_concatene_parties_codes($apres, $postaff); |
|
| 1079 | + $altern = compile_concatene_parties_codes($altern, $postaff); |
|
| 1080 | + } |
|
| 1081 | + if ($altern != "''") { |
|
| 1082 | + $altern = "($altern)"; |
|
| 1083 | + } |
|
| 1084 | + } |
|
| 1085 | + } |
|
| 1086 | + break; |
|
| 1087 | + |
|
| 1088 | + case 'idiome': |
|
| 1089 | + $l = []; |
|
| 1090 | + $code = ''; |
|
| 1091 | + foreach ($p->arg as $k => $v) { |
|
| 1092 | + $_v = calculer_liste($v, $descr, $boucles, $id_boucle); |
|
| 1093 | + if ($k) { |
|
| 1094 | + $l[] = _q($k) . ' => ' . $_v; |
|
| 1095 | + } else { |
|
| 1096 | + $code = $_v; |
|
| 1097 | + } |
|
| 1098 | + } |
|
| 1099 | + // Si le module n'est pas fourni, l'expliciter sauf si calculé |
|
| 1100 | + if ($p->module) { |
|
| 1101 | + $m = $p->module . ':' . $p->nom_champ; |
|
| 1102 | + } elseif ($p->nom_champ) { |
|
| 1103 | + $m = MODULES_IDIOMES . ':' . $p->nom_champ; |
|
| 1104 | + } else { |
|
| 1105 | + $m = ''; |
|
| 1106 | + } |
|
| 1107 | + |
|
| 1108 | + $code = (!$code ? "'$m'" : |
|
| 1109 | + ($m ? "'$m' . $code" : |
|
| 1110 | + ("(strpos(\$x=$code, ':') ? \$x : ('" . MODULES_IDIOMES . ":' . \$x))"))) |
|
| 1111 | + . (!$l ? '' : (', array(' . implode(",\n", $l) . ')')); |
|
| 1112 | + $code = "_T($code)"; |
|
| 1113 | + if ($p->param) { |
|
| 1114 | + $p->id_boucle = $id_boucle; |
|
| 1115 | + $p->boucles = &$boucles; |
|
| 1116 | + $code = compose_filtres($p, $code); |
|
| 1117 | + } |
|
| 1118 | + $commentaire = ':'; |
|
| 1119 | + $avant = ''; |
|
| 1120 | + $apres = ''; |
|
| 1121 | + $altern = "''"; |
|
| 1122 | + break; |
|
| 1123 | + |
|
| 1124 | + case 'champ': |
|
| 1125 | + // cette structure pourrait etre completee des le phrase' (a faire) |
|
| 1126 | + $p->id_boucle = $id_boucle; |
|
| 1127 | + $p->boucles = &$boucles; |
|
| 1128 | + $p->descr = $descr; |
|
| 1129 | + #$p->interdire_scripts = true; |
|
| 1130 | + $p->type_requete = $type; |
|
| 1131 | + |
|
| 1132 | + $code = calculer_champ($p); |
|
| 1133 | + $commentaire = '#' . $p->nom_champ . $p->etoile; |
|
| 1134 | + $avant = calculer_liste( |
|
| 1135 | + $p->avant, |
|
| 1136 | + $descr, |
|
| 1137 | + $boucles, |
|
| 1138 | + $id_boucle |
|
| 1139 | + ); |
|
| 1140 | + $apres = calculer_liste( |
|
| 1141 | + $p->apres, |
|
| 1142 | + $descr, |
|
| 1143 | + $boucles, |
|
| 1144 | + $id_boucle |
|
| 1145 | + ); |
|
| 1146 | + $altern = "''"; |
|
| 1147 | + // Si la valeur est destinee a une comparaison a '' |
|
| 1148 | + // forcer la conversion en une chaine par strval |
|
| 1149 | + // si ca peut etre autre chose qu'une chaine |
|
| 1150 | + if ( |
|
| 1151 | + ($avant != "''" or $apres != "''") |
|
| 1152 | + and $code[0] != "'" |
|
| 1153 | 1153 | # AND (strpos($code,'interdire_scripts') !== 0) |
| 1154 | - and !preg_match(_REGEXP_COND_VIDE_NONVIDE, $code) |
|
| 1155 | - and !preg_match(_REGEXP_COND_NONVIDE_VIDE, $code) |
|
| 1156 | - and !preg_match(_REGEXP_CONCAT_NON_VIDE, $code) |
|
| 1157 | - ) { |
|
| 1158 | - $code = "strval($code)"; |
|
| 1159 | - } |
|
| 1160 | - break; |
|
| 1161 | - |
|
| 1162 | - default: |
|
| 1163 | - // Erreur de construction de l'arbre de syntaxe abstraite |
|
| 1164 | - $code = "''"; |
|
| 1165 | - $p->descr = $descr; |
|
| 1166 | - $err_e_c = _T('zbug_erreur_compilation'); |
|
| 1167 | - erreur_squelette($err_e_c, $p); |
|
| 1168 | - } // switch |
|
| 1169 | - |
|
| 1170 | - if ($code != "''") { |
|
| 1171 | - $code = compile_retour($code, $avant, $apres, $altern, $tab, $descr['niv']); |
|
| 1172 | - $codes[] = (($mode == 'validation') ? |
|
| 1173 | - "array($code, '$commentaire', " . $p->ligne . ')' |
|
| 1174 | - : (($mode == 'code') ? |
|
| 1175 | - "\n// $commentaire\n$code" : |
|
| 1176 | - $code)); |
|
| 1177 | - } |
|
| 1178 | - } // foreach |
|
| 1179 | - |
|
| 1180 | - return $err_e_c ? false : $codes; |
|
| 1154 | + and !preg_match(_REGEXP_COND_VIDE_NONVIDE, $code) |
|
| 1155 | + and !preg_match(_REGEXP_COND_NONVIDE_VIDE, $code) |
|
| 1156 | + and !preg_match(_REGEXP_CONCAT_NON_VIDE, $code) |
|
| 1157 | + ) { |
|
| 1158 | + $code = "strval($code)"; |
|
| 1159 | + } |
|
| 1160 | + break; |
|
| 1161 | + |
|
| 1162 | + default: |
|
| 1163 | + // Erreur de construction de l'arbre de syntaxe abstraite |
|
| 1164 | + $code = "''"; |
|
| 1165 | + $p->descr = $descr; |
|
| 1166 | + $err_e_c = _T('zbug_erreur_compilation'); |
|
| 1167 | + erreur_squelette($err_e_c, $p); |
|
| 1168 | + } // switch |
|
| 1169 | + |
|
| 1170 | + if ($code != "''") { |
|
| 1171 | + $code = compile_retour($code, $avant, $apres, $altern, $tab, $descr['niv']); |
|
| 1172 | + $codes[] = (($mode == 'validation') ? |
|
| 1173 | + "array($code, '$commentaire', " . $p->ligne . ')' |
|
| 1174 | + : (($mode == 'code') ? |
|
| 1175 | + "\n// $commentaire\n$code" : |
|
| 1176 | + $code)); |
|
| 1177 | + } |
|
| 1178 | + } // foreach |
|
| 1179 | + |
|
| 1180 | + return $err_e_c ? false : $codes; |
|
| 1181 | 1181 | } |
| 1182 | 1182 | |
| 1183 | 1183 | /** |
@@ -1187,13 +1187,13 @@ discard block |
||
| 1187 | 1187 | * @return string |
| 1188 | 1188 | */ |
| 1189 | 1189 | function compile_concatene_parties_codes($partie1, $partie2) { |
| 1190 | - if ($partie1 === "''") { |
|
| 1191 | - return $partie2; |
|
| 1192 | - } |
|
| 1193 | - if ($partie2 === "''") { |
|
| 1194 | - return $partie1; |
|
| 1195 | - } |
|
| 1196 | - return "$partie1\n. $partie2"; |
|
| 1190 | + if ($partie1 === "''") { |
|
| 1191 | + return $partie2; |
|
| 1192 | + } |
|
| 1193 | + if ($partie2 === "''") { |
|
| 1194 | + return $partie1; |
|
| 1195 | + } |
|
| 1196 | + return "$partie1\n. $partie2"; |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | |
@@ -1217,56 +1217,56 @@ discard block |
||
| 1217 | 1217 | * @return mixed|string |
| 1218 | 1218 | */ |
| 1219 | 1219 | function compile_retour($code, $avant, $apres, $altern, $tab, $n) { |
| 1220 | - if ($avant === "''") { |
|
| 1221 | - $avant = ''; |
|
| 1222 | - } |
|
| 1223 | - if ($apres === "''") { |
|
| 1224 | - $apres = ''; |
|
| 1225 | - } |
|
| 1226 | - if ($avant or $apres or ($altern !== "''")) { |
|
| 1227 | - if (preg_match(_REGEXP_CONCAT_NON_VIDE, $code)) { |
|
| 1228 | - $t = $code; |
|
| 1229 | - $cond = ''; |
|
| 1230 | - } elseif (preg_match(_REGEXP_COND_VIDE_NONVIDE, $code, $r)) { |
|
| 1231 | - $t = $r[2]; |
|
| 1232 | - $cond = '!' . $r[1]; |
|
| 1233 | - } else { |
|
| 1234 | - if (preg_match(_REGEXP_COND_NONVIDE_VIDE, $code, $r)) { |
|
| 1235 | - $t = $r[2]; |
|
| 1236 | - $cond = $r[1]; |
|
| 1237 | - } else { |
|
| 1238 | - $t = '$t' . $n; |
|
| 1239 | - $cond = "($t = $code)!==''"; |
|
| 1240 | - } |
|
| 1241 | - } |
|
| 1242 | - |
|
| 1243 | - $res = (!$avant ? '' : "$avant . ") . |
|
| 1244 | - $t . |
|
| 1245 | - (!$apres ? '' : " . $apres"); |
|
| 1246 | - |
|
| 1247 | - if ($res !== $t) { |
|
| 1248 | - $res = "($res)"; |
|
| 1249 | - } |
|
| 1250 | - |
|
| 1251 | - $code = (!$cond ? $res : "($cond ?\n\t$tab$res :\n\t$tab$altern)"); |
|
| 1252 | - } |
|
| 1253 | - |
|
| 1254 | - return $code; |
|
| 1220 | + if ($avant === "''") { |
|
| 1221 | + $avant = ''; |
|
| 1222 | + } |
|
| 1223 | + if ($apres === "''") { |
|
| 1224 | + $apres = ''; |
|
| 1225 | + } |
|
| 1226 | + if ($avant or $apres or ($altern !== "''")) { |
|
| 1227 | + if (preg_match(_REGEXP_CONCAT_NON_VIDE, $code)) { |
|
| 1228 | + $t = $code; |
|
| 1229 | + $cond = ''; |
|
| 1230 | + } elseif (preg_match(_REGEXP_COND_VIDE_NONVIDE, $code, $r)) { |
|
| 1231 | + $t = $r[2]; |
|
| 1232 | + $cond = '!' . $r[1]; |
|
| 1233 | + } else { |
|
| 1234 | + if (preg_match(_REGEXP_COND_NONVIDE_VIDE, $code, $r)) { |
|
| 1235 | + $t = $r[2]; |
|
| 1236 | + $cond = $r[1]; |
|
| 1237 | + } else { |
|
| 1238 | + $t = '$t' . $n; |
|
| 1239 | + $cond = "($t = $code)!==''"; |
|
| 1240 | + } |
|
| 1241 | + } |
|
| 1242 | + |
|
| 1243 | + $res = (!$avant ? '' : "$avant . ") . |
|
| 1244 | + $t . |
|
| 1245 | + (!$apres ? '' : " . $apres"); |
|
| 1246 | + |
|
| 1247 | + if ($res !== $t) { |
|
| 1248 | + $res = "($res)"; |
|
| 1249 | + } |
|
| 1250 | + |
|
| 1251 | + $code = (!$cond ? $res : "($cond ?\n\t$tab$res :\n\t$tab$altern)"); |
|
| 1252 | + } |
|
| 1253 | + |
|
| 1254 | + return $code; |
|
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | 1257 | |
| 1258 | 1258 | function compile_inclure_doublons($lexemes) { |
| 1259 | - foreach ($lexemes as $v) { |
|
| 1260 | - if ($v->type === 'include' and $v->param) { |
|
| 1261 | - foreach ($v->param as $r) { |
|
| 1262 | - if (trim($r[0]) === 'doublons') { |
|
| 1263 | - return true; |
|
| 1264 | - } |
|
| 1265 | - } |
|
| 1266 | - } |
|
| 1267 | - } |
|
| 1268 | - |
|
| 1269 | - return false; |
|
| 1259 | + foreach ($lexemes as $v) { |
|
| 1260 | + if ($v->type === 'include' and $v->param) { |
|
| 1261 | + foreach ($v->param as $r) { |
|
| 1262 | + if (trim($r[0]) === 'doublons') { |
|
| 1263 | + return true; |
|
| 1264 | + } |
|
| 1265 | + } |
|
| 1266 | + } |
|
| 1267 | + } |
|
| 1268 | + |
|
| 1269 | + return false; |
|
| 1270 | 1270 | } |
| 1271 | 1271 | |
| 1272 | 1272 | // Prend en argument le texte d'un squelette, le nom de son fichier d'origine, |
@@ -1285,354 +1285,354 @@ discard block |
||
| 1285 | 1285 | // En cas d'erreur, elle retournera un tableau des 2 premiers elements seulement |
| 1286 | 1286 | |
| 1287 | 1287 | function public_compiler_dist($squelette, $nom, $gram, $sourcefile, string $connect = '') { |
| 1288 | - // Pre-traitement : reperer le charset du squelette, et le convertir |
|
| 1289 | - // Bonus : supprime le BOM |
|
| 1290 | - include_spip('inc/charsets'); |
|
| 1291 | - $squelette = transcoder_page($squelette); |
|
| 1292 | - |
|
| 1293 | - // rendre inertes les echappements de #[](){}<> |
|
| 1294 | - $i = 0; |
|
| 1295 | - while (false !== strpos($squelette, $inerte = '-INERTE' . $i)) { |
|
| 1296 | - $i++; |
|
| 1297 | - } |
|
| 1298 | - $squelette = preg_replace_callback( |
|
| 1299 | - ',\\\\([#[()\]{}<>]),', |
|
| 1300 | - fn($a) => "$inerte-" . ord($a[1]) . '-', |
|
| 1301 | - $squelette, |
|
| 1302 | - -1, |
|
| 1303 | - $esc |
|
| 1304 | - ); |
|
| 1305 | - |
|
| 1306 | - $descr = [ |
|
| 1307 | - 'nom' => $nom, |
|
| 1308 | - 'gram' => $gram, |
|
| 1309 | - 'sourcefile' => $sourcefile, |
|
| 1310 | - 'squelette' => $squelette |
|
| 1311 | - ]; |
|
| 1312 | - |
|
| 1313 | - // Phraser le squelette, selon sa grammaire |
|
| 1314 | - |
|
| 1315 | - $boucles = []; |
|
| 1316 | - $f = charger_fonction('phraser_' . $gram, 'public'); |
|
| 1317 | - |
|
| 1318 | - $squelette = $f($squelette, '', $boucles, $descr); |
|
| 1319 | - |
|
| 1320 | - $boucles = compiler_squelette($squelette, $boucles, $nom, $descr, $sourcefile, $connect); |
|
| 1321 | - |
|
| 1322 | - // restituer les echappements |
|
| 1323 | - if ($esc) { |
|
| 1324 | - foreach ($boucles as $i => $boucle) { |
|
| 1325 | - $boucles[$i]->return = preg_replace_callback( |
|
| 1326 | - ",$inerte-(\d+)-,", |
|
| 1327 | - fn($a) => chr($a[1]), |
|
| 1328 | - $boucle->return |
|
| 1329 | - ); |
|
| 1330 | - $boucles[$i]->descr['squelette'] = preg_replace_callback( |
|
| 1331 | - ",$inerte-(\d+)-,", |
|
| 1332 | - fn($a) => '\\\\' . chr($a[1]), |
|
| 1333 | - $boucle->descr['squelette'] |
|
| 1334 | - ); |
|
| 1335 | - } |
|
| 1336 | - } |
|
| 1337 | - |
|
| 1338 | - $debug = ($boucles and defined('_VAR_MODE') and _VAR_MODE == 'debug'); |
|
| 1339 | - if ($debug) { |
|
| 1340 | - include_spip('public/decompiler'); |
|
| 1341 | - foreach ($boucles as $id => $boucle) { |
|
| 1342 | - if ($id) { |
|
| 1343 | - $decomp = "\n/* BOUCLE " . |
|
| 1344 | - $boucle->type_requete . |
|
| 1345 | - ' ' . |
|
| 1346 | - str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')) . |
|
| 1347 | - ($boucle->debug ? "\n *\n * " . implode("\n * ", $boucle->debug) . "\n" : '') . |
|
| 1348 | - " */\n"; |
|
| 1349 | - } else { |
|
| 1350 | - $decomp = ("\n/*\n" . |
|
| 1351 | - str_replace('*/', '* /', public_decompiler($squelette, $gram)) |
|
| 1352 | - . "\n*/"); |
|
| 1353 | - } |
|
| 1354 | - $boucles[$id]->return = $decomp . $boucle->return; |
|
| 1355 | - $GLOBALS['debug_objets']['code'][$nom . $id] = $boucle->return; |
|
| 1356 | - } |
|
| 1357 | - } |
|
| 1358 | - |
|
| 1359 | - return $boucles; |
|
| 1288 | + // Pre-traitement : reperer le charset du squelette, et le convertir |
|
| 1289 | + // Bonus : supprime le BOM |
|
| 1290 | + include_spip('inc/charsets'); |
|
| 1291 | + $squelette = transcoder_page($squelette); |
|
| 1292 | + |
|
| 1293 | + // rendre inertes les echappements de #[](){}<> |
|
| 1294 | + $i = 0; |
|
| 1295 | + while (false !== strpos($squelette, $inerte = '-INERTE' . $i)) { |
|
| 1296 | + $i++; |
|
| 1297 | + } |
|
| 1298 | + $squelette = preg_replace_callback( |
|
| 1299 | + ',\\\\([#[()\]{}<>]),', |
|
| 1300 | + fn($a) => "$inerte-" . ord($a[1]) . '-', |
|
| 1301 | + $squelette, |
|
| 1302 | + -1, |
|
| 1303 | + $esc |
|
| 1304 | + ); |
|
| 1305 | + |
|
| 1306 | + $descr = [ |
|
| 1307 | + 'nom' => $nom, |
|
| 1308 | + 'gram' => $gram, |
|
| 1309 | + 'sourcefile' => $sourcefile, |
|
| 1310 | + 'squelette' => $squelette |
|
| 1311 | + ]; |
|
| 1312 | + |
|
| 1313 | + // Phraser le squelette, selon sa grammaire |
|
| 1314 | + |
|
| 1315 | + $boucles = []; |
|
| 1316 | + $f = charger_fonction('phraser_' . $gram, 'public'); |
|
| 1317 | + |
|
| 1318 | + $squelette = $f($squelette, '', $boucles, $descr); |
|
| 1319 | + |
|
| 1320 | + $boucles = compiler_squelette($squelette, $boucles, $nom, $descr, $sourcefile, $connect); |
|
| 1321 | + |
|
| 1322 | + // restituer les echappements |
|
| 1323 | + if ($esc) { |
|
| 1324 | + foreach ($boucles as $i => $boucle) { |
|
| 1325 | + $boucles[$i]->return = preg_replace_callback( |
|
| 1326 | + ",$inerte-(\d+)-,", |
|
| 1327 | + fn($a) => chr($a[1]), |
|
| 1328 | + $boucle->return |
|
| 1329 | + ); |
|
| 1330 | + $boucles[$i]->descr['squelette'] = preg_replace_callback( |
|
| 1331 | + ",$inerte-(\d+)-,", |
|
| 1332 | + fn($a) => '\\\\' . chr($a[1]), |
|
| 1333 | + $boucle->descr['squelette'] |
|
| 1334 | + ); |
|
| 1335 | + } |
|
| 1336 | + } |
|
| 1337 | + |
|
| 1338 | + $debug = ($boucles and defined('_VAR_MODE') and _VAR_MODE == 'debug'); |
|
| 1339 | + if ($debug) { |
|
| 1340 | + include_spip('public/decompiler'); |
|
| 1341 | + foreach ($boucles as $id => $boucle) { |
|
| 1342 | + if ($id) { |
|
| 1343 | + $decomp = "\n/* BOUCLE " . |
|
| 1344 | + $boucle->type_requete . |
|
| 1345 | + ' ' . |
|
| 1346 | + str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')) . |
|
| 1347 | + ($boucle->debug ? "\n *\n * " . implode("\n * ", $boucle->debug) . "\n" : '') . |
|
| 1348 | + " */\n"; |
|
| 1349 | + } else { |
|
| 1350 | + $decomp = ("\n/*\n" . |
|
| 1351 | + str_replace('*/', '* /', public_decompiler($squelette, $gram)) |
|
| 1352 | + . "\n*/"); |
|
| 1353 | + } |
|
| 1354 | + $boucles[$id]->return = $decomp . $boucle->return; |
|
| 1355 | + $GLOBALS['debug_objets']['code'][$nom . $id] = $boucle->return; |
|
| 1356 | + } |
|
| 1357 | + } |
|
| 1358 | + |
|
| 1359 | + return $boucles; |
|
| 1360 | 1360 | } |
| 1361 | 1361 | |
| 1362 | 1362 | // Point d'entree pour arbre de syntaxe abstraite fourni en premier argument |
| 1363 | 1363 | // Autres specifications comme ci-dessus |
| 1364 | 1364 | |
| 1365 | 1365 | function compiler_squelette($squelette, $boucles, $nom, $descr, $sourcefile, string $connect = '') { |
| 1366 | - static $trouver_table; |
|
| 1367 | - spip_timer('calcul_skel'); |
|
| 1368 | - |
|
| 1369 | - if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
|
| 1370 | - $GLOBALS['debug_objets']['squelette'][$nom] = $descr['squelette']; |
|
| 1371 | - $GLOBALS['debug_objets']['sourcefile'][$nom] = $sourcefile; |
|
| 1372 | - |
|
| 1373 | - if (!isset($GLOBALS['debug_objets']['principal'])) { |
|
| 1374 | - $GLOBALS['debug_objets']['principal'] = $nom; |
|
| 1375 | - } |
|
| 1376 | - } |
|
| 1377 | - foreach ($boucles as $id => $boucle) { |
|
| 1378 | - $GLOBALS['debug_objets']['boucle'][$nom . $id] = $boucle; |
|
| 1379 | - } |
|
| 1380 | - $descr['documents'] = compile_inclure_doublons($squelette); |
|
| 1381 | - |
|
| 1382 | - // Demander la description des tables une fois pour toutes |
|
| 1383 | - if (!$trouver_table) { |
|
| 1384 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 1385 | - } |
|
| 1386 | - |
|
| 1387 | - // reperer si les doublons sont demandes |
|
| 1388 | - // pour un inclure ou une boucle document |
|
| 1389 | - // c'est utile a la fonction champs_traitements |
|
| 1390 | - foreach ($boucles as $id => $boucle) { |
|
| 1391 | - if (!($type = $boucle->type_requete)) { |
|
| 1392 | - continue; |
|
| 1393 | - } |
|
| 1394 | - if ( |
|
| 1395 | - !$descr['documents'] and ( |
|
| 1396 | - (($type == 'documents') and $boucle->doublons) or |
|
| 1397 | - compile_inclure_doublons($boucle->avant) or |
|
| 1398 | - compile_inclure_doublons($boucle->apres) or |
|
| 1399 | - compile_inclure_doublons($boucle->milieu) or |
|
| 1400 | - compile_inclure_doublons($boucle->altern)) |
|
| 1401 | - ) { |
|
| 1402 | - $descr['documents'] = true; |
|
| 1403 | - } |
|
| 1404 | - if ($type != TYPE_RECURSIF) { |
|
| 1405 | - if (!$boucles[$id]->sql_serveur and $connect) { |
|
| 1406 | - $boucles[$id]->sql_serveur = $connect; |
|
| 1407 | - } |
|
| 1408 | - |
|
| 1409 | - // chercher dans les iterateurs du repertoire iterateur/ |
|
| 1410 | - if ( |
|
| 1411 | - $g = charger_fonction( |
|
| 1412 | - preg_replace('/\W/', '_', $boucle->type_requete), |
|
| 1413 | - 'iterateur', |
|
| 1414 | - true |
|
| 1415 | - ) |
|
| 1416 | - ) { |
|
| 1417 | - $boucles[$id] = $g($boucle); |
|
| 1418 | - |
|
| 1419 | - // sinon, en cas de requeteur d'un type predefini, |
|
| 1420 | - // utiliser les informations donnees par le requeteur |
|
| 1421 | - // cas "php:xx" et "data:xx". |
|
| 1422 | - } else { |
|
| 1423 | - if ($boucle->sql_serveur and $requeteur = charger_fonction($boucle->sql_serveur, 'requeteur', true)) { |
|
| 1424 | - $requeteur($boucles, $boucle, $id); |
|
| 1425 | - |
|
| 1426 | - // utiliser la description des champs transmis |
|
| 1427 | - } else { |
|
| 1428 | - $show = $trouver_table($type, $boucles[$id]->sql_serveur); |
|
| 1429 | - // si la table n'existe pas avec le connecteur par defaut, |
|
| 1430 | - // c'est peut etre une table qui necessite son connecteur dedie fourni |
|
| 1431 | - // permet une ecriture allegee (GEO) -> (geo:GEO) |
|
| 1432 | - if ( |
|
| 1433 | - !$show |
|
| 1434 | - and $show = $trouver_table($type, strtolower($type)) |
|
| 1435 | - ) { |
|
| 1436 | - $boucles[$id]->sql_serveur = strtolower($type); |
|
| 1437 | - } |
|
| 1438 | - if ($show) { |
|
| 1439 | - $boucles[$id]->show = $show; |
|
| 1440 | - // recopie les infos les plus importantes |
|
| 1441 | - $boucles[$id]->primary = $show['key']['PRIMARY KEY'] ?? ''; |
|
| 1442 | - $boucles[$id]->id_table = $x = preg_replace(',^spip_,', '', $show['id_table']); |
|
| 1443 | - $boucles[$id]->from[$x] = $nom_table = $show['table']; |
|
| 1444 | - $boucles[$id]->iterateur = 'SQL'; |
|
| 1445 | - |
|
| 1446 | - if (empty($boucles[$id]->descr)) { |
|
| 1447 | - $boucles[$id]->descr = &$descr; |
|
| 1448 | - } |
|
| 1449 | - if ( |
|
| 1450 | - (!$boucles[$id]->jointures) |
|
| 1451 | - and is_array($show['tables_jointures']) |
|
| 1452 | - and count($x = $show['tables_jointures']) |
|
| 1453 | - ) { |
|
| 1454 | - $boucles[$id]->jointures = $x; |
|
| 1455 | - } |
|
| 1456 | - if ($boucles[$id]->jointures_explicites) { |
|
| 1457 | - $jointures = preg_split('/\s+/', $boucles[$id]->jointures_explicites); |
|
| 1458 | - while ($j = array_pop($jointures)) { |
|
| 1459 | - array_unshift($boucles[$id]->jointures, $j); |
|
| 1460 | - } |
|
| 1461 | - } |
|
| 1462 | - } else { |
|
| 1463 | - // Pas une erreur si la table est optionnelle |
|
| 1464 | - if ($boucles[$id]->table_optionnelle) { |
|
| 1465 | - $boucles[$id]->type_requete = ''; |
|
| 1466 | - } else { |
|
| 1467 | - $boucles[$id]->type_requete = false; |
|
| 1468 | - $boucle = $boucles[$id]; |
|
| 1469 | - $x = (!$boucle->sql_serveur ? '' : |
|
| 1470 | - ($boucle->sql_serveur . ':')) . |
|
| 1471 | - $type; |
|
| 1472 | - $msg = [ |
|
| 1473 | - 'zbug_table_inconnue', |
|
| 1474 | - ['table' => $x] |
|
| 1475 | - ]; |
|
| 1476 | - erreur_squelette($msg, $boucle); |
|
| 1477 | - } |
|
| 1478 | - } |
|
| 1479 | - } |
|
| 1480 | - } |
|
| 1481 | - } |
|
| 1482 | - } |
|
| 1483 | - |
|
| 1484 | - // Commencer par reperer les boucles appelees explicitement |
|
| 1485 | - // car elles indexent les arguments de maniere derogatoire |
|
| 1486 | - foreach ($boucles as $id => $boucle) { |
|
| 1487 | - if ($boucle->type_requete == TYPE_RECURSIF and $boucle->param) { |
|
| 1488 | - $boucles[$id]->descr = &$descr; |
|
| 1489 | - $rec = &$boucles[$boucle->param[0]]; |
|
| 1490 | - if (!$rec) { |
|
| 1491 | - $msg = [ |
|
| 1492 | - 'zbug_boucle_recursive_undef', |
|
| 1493 | - ['nom' => $boucle->param[0]] |
|
| 1494 | - ]; |
|
| 1495 | - erreur_squelette($msg, $boucle); |
|
| 1496 | - $boucles[$id]->type_requete = false; |
|
| 1497 | - } else { |
|
| 1498 | - $rec->externe = $id; |
|
| 1499 | - $descr['id_mere'] = $id; |
|
| 1500 | - $boucles[$id]->return = |
|
| 1501 | - calculer_liste( |
|
| 1502 | - [$rec], |
|
| 1503 | - $descr, |
|
| 1504 | - $boucles, |
|
| 1505 | - $boucle->param |
|
| 1506 | - ); |
|
| 1507 | - } |
|
| 1508 | - } |
|
| 1509 | - } |
|
| 1510 | - foreach ($boucles as $id => $boucle) { |
|
| 1511 | - $id = strval($id); // attention au type dans index_pile |
|
| 1512 | - $type = $boucle->type_requete; |
|
| 1513 | - if ($type and $type != TYPE_RECURSIF) { |
|
| 1514 | - $res = ''; |
|
| 1515 | - if ($boucle->param) { |
|
| 1516 | - // retourne un tableau en cas d'erreur |
|
| 1517 | - $res = calculer_criteres($id, $boucles); |
|
| 1518 | - } |
|
| 1519 | - $descr['id_mere'] = $id; |
|
| 1520 | - $boucles[$id]->return = |
|
| 1521 | - calculer_liste( |
|
| 1522 | - $boucle->milieu, |
|
| 1523 | - $descr, |
|
| 1524 | - $boucles, |
|
| 1525 | - $id |
|
| 1526 | - ); |
|
| 1527 | - // Si les criteres se sont mal compiles |
|
| 1528 | - // ne pas tenter d'assembler le code final |
|
| 1529 | - // (mais compiler le corps pour detection d'erreurs) |
|
| 1530 | - if (is_array($res)) { |
|
| 1531 | - $boucles[$id]->type_requete = false; |
|
| 1532 | - } |
|
| 1533 | - } |
|
| 1534 | - } |
|
| 1535 | - |
|
| 1536 | - // idem pour la racine |
|
| 1537 | - $descr['id_mere'] = ''; |
|
| 1538 | - $corps = calculer_liste($squelette, $descr, $boucles); |
|
| 1539 | - |
|
| 1540 | - |
|
| 1541 | - // Calcul du corps de toutes les fonctions PHP, |
|
| 1542 | - // en particulier les requetes SQL et TOTAL_BOUCLE |
|
| 1543 | - // de'terminables seulement maintenant |
|
| 1544 | - |
|
| 1545 | - foreach ($boucles as $id => $boucle) { |
|
| 1546 | - $boucle = $boucles[$id] = pipeline('pre_boucle', $boucle); |
|
| 1547 | - if ($boucle->return === false) { |
|
| 1548 | - $corps = false; |
|
| 1549 | - continue; |
|
| 1550 | - } |
|
| 1551 | - // appeler la fonction de definition de la boucle |
|
| 1552 | - |
|
| 1553 | - if ($req = $boucle->type_requete) { |
|
| 1554 | - // boucle personnalisée ? |
|
| 1555 | - $table = strtoupper($boucle->type_requete); |
|
| 1556 | - $serveur = strtolower($boucle->sql_serveur); |
|
| 1557 | - if ( |
|
| 1558 | - // fonction de boucle avec serveur & table |
|
| 1559 | - (!$serveur or |
|
| 1560 | - ((!function_exists($f = 'boucle_' . $serveur . '_' . $table)) |
|
| 1561 | - and (!function_exists($f = $f . '_dist')) |
|
| 1562 | - ) |
|
| 1563 | - ) |
|
| 1564 | - // fonction de boucle avec table |
|
| 1565 | - and (!function_exists($f = 'boucle_' . $table)) |
|
| 1566 | - and (!function_exists($f = $f . '_dist')) |
|
| 1567 | - ) { |
|
| 1568 | - // fonction de boucle standard |
|
| 1569 | - if (!function_exists($f = 'boucle_DEFAUT')) { |
|
| 1570 | - $f = 'boucle_DEFAUT_dist'; |
|
| 1571 | - } |
|
| 1572 | - } |
|
| 1573 | - |
|
| 1574 | - $req = "\n\n\tstatic \$command = array();\n\t" . |
|
| 1575 | - "static \$connect;\n\t" . |
|
| 1576 | - "\$command['connect'] = \$connect = " . |
|
| 1577 | - _q($boucle->sql_serveur) . |
|
| 1578 | - ';' . |
|
| 1579 | - $f($id, $boucles); |
|
| 1580 | - } else { |
|
| 1581 | - $req = ("\n\treturn '';"); |
|
| 1582 | - } |
|
| 1583 | - |
|
| 1584 | - $boucles[$id]->return = |
|
| 1585 | - "\n\nfunction BOUCLE" . strtr($id, '-', '_') . $nom . |
|
| 1586 | - '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {' . |
|
| 1587 | - $req . |
|
| 1588 | - "\n}\n"; |
|
| 1589 | - } |
|
| 1590 | - |
|
| 1591 | - // Au final, si le corps ou un critere au moins s'est mal compile |
|
| 1592 | - // retourner False, sinon inserer leur decompilation |
|
| 1593 | - if (is_bool($corps)) { |
|
| 1594 | - return false; |
|
| 1595 | - } |
|
| 1596 | - |
|
| 1597 | - $principal = "\nfunction " . $nom . '($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1366 | + static $trouver_table; |
|
| 1367 | + spip_timer('calcul_skel'); |
|
| 1368 | + |
|
| 1369 | + if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
|
| 1370 | + $GLOBALS['debug_objets']['squelette'][$nom] = $descr['squelette']; |
|
| 1371 | + $GLOBALS['debug_objets']['sourcefile'][$nom] = $sourcefile; |
|
| 1372 | + |
|
| 1373 | + if (!isset($GLOBALS['debug_objets']['principal'])) { |
|
| 1374 | + $GLOBALS['debug_objets']['principal'] = $nom; |
|
| 1375 | + } |
|
| 1376 | + } |
|
| 1377 | + foreach ($boucles as $id => $boucle) { |
|
| 1378 | + $GLOBALS['debug_objets']['boucle'][$nom . $id] = $boucle; |
|
| 1379 | + } |
|
| 1380 | + $descr['documents'] = compile_inclure_doublons($squelette); |
|
| 1381 | + |
|
| 1382 | + // Demander la description des tables une fois pour toutes |
|
| 1383 | + if (!$trouver_table) { |
|
| 1384 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 1385 | + } |
|
| 1386 | + |
|
| 1387 | + // reperer si les doublons sont demandes |
|
| 1388 | + // pour un inclure ou une boucle document |
|
| 1389 | + // c'est utile a la fonction champs_traitements |
|
| 1390 | + foreach ($boucles as $id => $boucle) { |
|
| 1391 | + if (!($type = $boucle->type_requete)) { |
|
| 1392 | + continue; |
|
| 1393 | + } |
|
| 1394 | + if ( |
|
| 1395 | + !$descr['documents'] and ( |
|
| 1396 | + (($type == 'documents') and $boucle->doublons) or |
|
| 1397 | + compile_inclure_doublons($boucle->avant) or |
|
| 1398 | + compile_inclure_doublons($boucle->apres) or |
|
| 1399 | + compile_inclure_doublons($boucle->milieu) or |
|
| 1400 | + compile_inclure_doublons($boucle->altern)) |
|
| 1401 | + ) { |
|
| 1402 | + $descr['documents'] = true; |
|
| 1403 | + } |
|
| 1404 | + if ($type != TYPE_RECURSIF) { |
|
| 1405 | + if (!$boucles[$id]->sql_serveur and $connect) { |
|
| 1406 | + $boucles[$id]->sql_serveur = $connect; |
|
| 1407 | + } |
|
| 1408 | + |
|
| 1409 | + // chercher dans les iterateurs du repertoire iterateur/ |
|
| 1410 | + if ( |
|
| 1411 | + $g = charger_fonction( |
|
| 1412 | + preg_replace('/\W/', '_', $boucle->type_requete), |
|
| 1413 | + 'iterateur', |
|
| 1414 | + true |
|
| 1415 | + ) |
|
| 1416 | + ) { |
|
| 1417 | + $boucles[$id] = $g($boucle); |
|
| 1418 | + |
|
| 1419 | + // sinon, en cas de requeteur d'un type predefini, |
|
| 1420 | + // utiliser les informations donnees par le requeteur |
|
| 1421 | + // cas "php:xx" et "data:xx". |
|
| 1422 | + } else { |
|
| 1423 | + if ($boucle->sql_serveur and $requeteur = charger_fonction($boucle->sql_serveur, 'requeteur', true)) { |
|
| 1424 | + $requeteur($boucles, $boucle, $id); |
|
| 1425 | + |
|
| 1426 | + // utiliser la description des champs transmis |
|
| 1427 | + } else { |
|
| 1428 | + $show = $trouver_table($type, $boucles[$id]->sql_serveur); |
|
| 1429 | + // si la table n'existe pas avec le connecteur par defaut, |
|
| 1430 | + // c'est peut etre une table qui necessite son connecteur dedie fourni |
|
| 1431 | + // permet une ecriture allegee (GEO) -> (geo:GEO) |
|
| 1432 | + if ( |
|
| 1433 | + !$show |
|
| 1434 | + and $show = $trouver_table($type, strtolower($type)) |
|
| 1435 | + ) { |
|
| 1436 | + $boucles[$id]->sql_serveur = strtolower($type); |
|
| 1437 | + } |
|
| 1438 | + if ($show) { |
|
| 1439 | + $boucles[$id]->show = $show; |
|
| 1440 | + // recopie les infos les plus importantes |
|
| 1441 | + $boucles[$id]->primary = $show['key']['PRIMARY KEY'] ?? ''; |
|
| 1442 | + $boucles[$id]->id_table = $x = preg_replace(',^spip_,', '', $show['id_table']); |
|
| 1443 | + $boucles[$id]->from[$x] = $nom_table = $show['table']; |
|
| 1444 | + $boucles[$id]->iterateur = 'SQL'; |
|
| 1445 | + |
|
| 1446 | + if (empty($boucles[$id]->descr)) { |
|
| 1447 | + $boucles[$id]->descr = &$descr; |
|
| 1448 | + } |
|
| 1449 | + if ( |
|
| 1450 | + (!$boucles[$id]->jointures) |
|
| 1451 | + and is_array($show['tables_jointures']) |
|
| 1452 | + and count($x = $show['tables_jointures']) |
|
| 1453 | + ) { |
|
| 1454 | + $boucles[$id]->jointures = $x; |
|
| 1455 | + } |
|
| 1456 | + if ($boucles[$id]->jointures_explicites) { |
|
| 1457 | + $jointures = preg_split('/\s+/', $boucles[$id]->jointures_explicites); |
|
| 1458 | + while ($j = array_pop($jointures)) { |
|
| 1459 | + array_unshift($boucles[$id]->jointures, $j); |
|
| 1460 | + } |
|
| 1461 | + } |
|
| 1462 | + } else { |
|
| 1463 | + // Pas une erreur si la table est optionnelle |
|
| 1464 | + if ($boucles[$id]->table_optionnelle) { |
|
| 1465 | + $boucles[$id]->type_requete = ''; |
|
| 1466 | + } else { |
|
| 1467 | + $boucles[$id]->type_requete = false; |
|
| 1468 | + $boucle = $boucles[$id]; |
|
| 1469 | + $x = (!$boucle->sql_serveur ? '' : |
|
| 1470 | + ($boucle->sql_serveur . ':')) . |
|
| 1471 | + $type; |
|
| 1472 | + $msg = [ |
|
| 1473 | + 'zbug_table_inconnue', |
|
| 1474 | + ['table' => $x] |
|
| 1475 | + ]; |
|
| 1476 | + erreur_squelette($msg, $boucle); |
|
| 1477 | + } |
|
| 1478 | + } |
|
| 1479 | + } |
|
| 1480 | + } |
|
| 1481 | + } |
|
| 1482 | + } |
|
| 1483 | + |
|
| 1484 | + // Commencer par reperer les boucles appelees explicitement |
|
| 1485 | + // car elles indexent les arguments de maniere derogatoire |
|
| 1486 | + foreach ($boucles as $id => $boucle) { |
|
| 1487 | + if ($boucle->type_requete == TYPE_RECURSIF and $boucle->param) { |
|
| 1488 | + $boucles[$id]->descr = &$descr; |
|
| 1489 | + $rec = &$boucles[$boucle->param[0]]; |
|
| 1490 | + if (!$rec) { |
|
| 1491 | + $msg = [ |
|
| 1492 | + 'zbug_boucle_recursive_undef', |
|
| 1493 | + ['nom' => $boucle->param[0]] |
|
| 1494 | + ]; |
|
| 1495 | + erreur_squelette($msg, $boucle); |
|
| 1496 | + $boucles[$id]->type_requete = false; |
|
| 1497 | + } else { |
|
| 1498 | + $rec->externe = $id; |
|
| 1499 | + $descr['id_mere'] = $id; |
|
| 1500 | + $boucles[$id]->return = |
|
| 1501 | + calculer_liste( |
|
| 1502 | + [$rec], |
|
| 1503 | + $descr, |
|
| 1504 | + $boucles, |
|
| 1505 | + $boucle->param |
|
| 1506 | + ); |
|
| 1507 | + } |
|
| 1508 | + } |
|
| 1509 | + } |
|
| 1510 | + foreach ($boucles as $id => $boucle) { |
|
| 1511 | + $id = strval($id); // attention au type dans index_pile |
|
| 1512 | + $type = $boucle->type_requete; |
|
| 1513 | + if ($type and $type != TYPE_RECURSIF) { |
|
| 1514 | + $res = ''; |
|
| 1515 | + if ($boucle->param) { |
|
| 1516 | + // retourne un tableau en cas d'erreur |
|
| 1517 | + $res = calculer_criteres($id, $boucles); |
|
| 1518 | + } |
|
| 1519 | + $descr['id_mere'] = $id; |
|
| 1520 | + $boucles[$id]->return = |
|
| 1521 | + calculer_liste( |
|
| 1522 | + $boucle->milieu, |
|
| 1523 | + $descr, |
|
| 1524 | + $boucles, |
|
| 1525 | + $id |
|
| 1526 | + ); |
|
| 1527 | + // Si les criteres se sont mal compiles |
|
| 1528 | + // ne pas tenter d'assembler le code final |
|
| 1529 | + // (mais compiler le corps pour detection d'erreurs) |
|
| 1530 | + if (is_array($res)) { |
|
| 1531 | + $boucles[$id]->type_requete = false; |
|
| 1532 | + } |
|
| 1533 | + } |
|
| 1534 | + } |
|
| 1535 | + |
|
| 1536 | + // idem pour la racine |
|
| 1537 | + $descr['id_mere'] = ''; |
|
| 1538 | + $corps = calculer_liste($squelette, $descr, $boucles); |
|
| 1539 | + |
|
| 1540 | + |
|
| 1541 | + // Calcul du corps de toutes les fonctions PHP, |
|
| 1542 | + // en particulier les requetes SQL et TOTAL_BOUCLE |
|
| 1543 | + // de'terminables seulement maintenant |
|
| 1544 | + |
|
| 1545 | + foreach ($boucles as $id => $boucle) { |
|
| 1546 | + $boucle = $boucles[$id] = pipeline('pre_boucle', $boucle); |
|
| 1547 | + if ($boucle->return === false) { |
|
| 1548 | + $corps = false; |
|
| 1549 | + continue; |
|
| 1550 | + } |
|
| 1551 | + // appeler la fonction de definition de la boucle |
|
| 1552 | + |
|
| 1553 | + if ($req = $boucle->type_requete) { |
|
| 1554 | + // boucle personnalisée ? |
|
| 1555 | + $table = strtoupper($boucle->type_requete); |
|
| 1556 | + $serveur = strtolower($boucle->sql_serveur); |
|
| 1557 | + if ( |
|
| 1558 | + // fonction de boucle avec serveur & table |
|
| 1559 | + (!$serveur or |
|
| 1560 | + ((!function_exists($f = 'boucle_' . $serveur . '_' . $table)) |
|
| 1561 | + and (!function_exists($f = $f . '_dist')) |
|
| 1562 | + ) |
|
| 1563 | + ) |
|
| 1564 | + // fonction de boucle avec table |
|
| 1565 | + and (!function_exists($f = 'boucle_' . $table)) |
|
| 1566 | + and (!function_exists($f = $f . '_dist')) |
|
| 1567 | + ) { |
|
| 1568 | + // fonction de boucle standard |
|
| 1569 | + if (!function_exists($f = 'boucle_DEFAUT')) { |
|
| 1570 | + $f = 'boucle_DEFAUT_dist'; |
|
| 1571 | + } |
|
| 1572 | + } |
|
| 1573 | + |
|
| 1574 | + $req = "\n\n\tstatic \$command = array();\n\t" . |
|
| 1575 | + "static \$connect;\n\t" . |
|
| 1576 | + "\$command['connect'] = \$connect = " . |
|
| 1577 | + _q($boucle->sql_serveur) . |
|
| 1578 | + ';' . |
|
| 1579 | + $f($id, $boucles); |
|
| 1580 | + } else { |
|
| 1581 | + $req = ("\n\treturn '';"); |
|
| 1582 | + } |
|
| 1583 | + |
|
| 1584 | + $boucles[$id]->return = |
|
| 1585 | + "\n\nfunction BOUCLE" . strtr($id, '-', '_') . $nom . |
|
| 1586 | + '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {' . |
|
| 1587 | + $req . |
|
| 1588 | + "\n}\n"; |
|
| 1589 | + } |
|
| 1590 | + |
|
| 1591 | + // Au final, si le corps ou un critere au moins s'est mal compile |
|
| 1592 | + // retourner False, sinon inserer leur decompilation |
|
| 1593 | + if (is_bool($corps)) { |
|
| 1594 | + return false; |
|
| 1595 | + } |
|
| 1596 | + |
|
| 1597 | + $principal = "\nfunction " . $nom . '($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1598 | 1598 | ' |
| 1599 | - // reporter de maniere securisee les doublons inclus |
|
| 1600 | - . ' |
|
| 1599 | + // reporter de maniere securisee les doublons inclus |
|
| 1600 | + . ' |
|
| 1601 | 1601 | if (isset($Pile[0]["doublons"]) AND is_array($Pile[0]["doublons"])) |
| 1602 | 1602 | $doublons = nettoyer_env_doublons($Pile[0]["doublons"]); |
| 1603 | 1603 | |
| 1604 | 1604 | $connect = ' . |
| 1605 | - _q($connect) . '; |
|
| 1605 | + _q($connect) . '; |
|
| 1606 | 1606 | $page = ' . |
| 1607 | - // ATTENTION, le calcul de l'expression $corps affectera $Cache |
|
| 1608 | - // c'est pourquoi on l'affecte a la variable auxiliaire $page. |
|
| 1609 | - // avant de referencer $Cache |
|
| 1610 | - $corps . '; |
|
| 1607 | + // ATTENTION, le calcul de l'expression $corps affectera $Cache |
|
| 1608 | + // c'est pourquoi on l'affecte a la variable auxiliaire $page. |
|
| 1609 | + // avant de referencer $Cache |
|
| 1610 | + $corps . '; |
|
| 1611 | 1611 | |
| 1612 | 1612 | return analyse_resultat_skel(' . var_export($nom, true) |
| 1613 | - . ', $Cache, $page, ' . var_export($sourcefile, true) . '); |
|
| 1613 | + . ', $Cache, $page, ' . var_export($sourcefile, true) . '); |
|
| 1614 | 1614 | }'; |
| 1615 | 1615 | |
| 1616 | - $secondes = spip_timer('calcul_skel'); |
|
| 1617 | - spip_log("COMPIL ($secondes) [$sourcefile] $nom.php"); |
|
| 1618 | - // $connect n'est pas sûr : on nettoie |
|
| 1619 | - $connect = preg_replace(',[^\w],', '', $connect); |
|
| 1616 | + $secondes = spip_timer('calcul_skel'); |
|
| 1617 | + spip_log("COMPIL ($secondes) [$sourcefile] $nom.php"); |
|
| 1618 | + // $connect n'est pas sûr : on nettoie |
|
| 1619 | + $connect = preg_replace(',[^\w],', '', $connect); |
|
| 1620 | 1620 | |
| 1621 | - // Assimiler la fct principale a une boucle anonyme, pour retourner un resultat simple |
|
| 1622 | - $code = new Boucle(); |
|
| 1623 | - $code->descr = $descr; |
|
| 1624 | - $code->return = ' |
|
| 1621 | + // Assimiler la fct principale a une boucle anonyme, pour retourner un resultat simple |
|
| 1622 | + $code = new Boucle(); |
|
| 1623 | + $code->descr = $descr; |
|
| 1624 | + $code->return = ' |
|
| 1625 | 1625 | // |
| 1626 | 1626 | // Fonction principale du squelette ' . |
| 1627 | - $sourcefile . |
|
| 1628 | - ($connect ? " pour $connect" : '') . |
|
| 1629 | - (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes") . |
|
| 1630 | - "\n//\n" . |
|
| 1631 | - $principal; |
|
| 1627 | + $sourcefile . |
|
| 1628 | + ($connect ? " pour $connect" : '') . |
|
| 1629 | + (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes") . |
|
| 1630 | + "\n//\n" . |
|
| 1631 | + $principal; |
|
| 1632 | 1632 | |
| 1633 | - $boucles[''] = $code; |
|
| 1633 | + $boucles[''] = $code; |
|
| 1634 | 1634 | |
| 1635 | - return $boucles; |
|
| 1635 | + return $boucles; |
|
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | 1638 | |
@@ -1649,18 +1649,18 @@ discard block |
||
| 1649 | 1649 | * |
| 1650 | 1650 | **/ |
| 1651 | 1651 | function requeteur_php_dist(&$boucles, &$boucle, &$id) { |
| 1652 | - if (class_exists($boucle->type_requete)) { |
|
| 1653 | - $g = charger_fonction('php', 'iterateur'); |
|
| 1654 | - $boucles[$id] = $g($boucle, $boucle->type_requete); |
|
| 1655 | - } else { |
|
| 1656 | - $x = $boucle->type_requete; |
|
| 1657 | - $boucle->type_requete = false; |
|
| 1658 | - $msg = [ |
|
| 1659 | - 'zbug_iterateur_inconnu', |
|
| 1660 | - ['iterateur' => $x] |
|
| 1661 | - ]; |
|
| 1662 | - erreur_squelette($msg, $boucle); |
|
| 1663 | - } |
|
| 1652 | + if (class_exists($boucle->type_requete)) { |
|
| 1653 | + $g = charger_fonction('php', 'iterateur'); |
|
| 1654 | + $boucles[$id] = $g($boucle, $boucle->type_requete); |
|
| 1655 | + } else { |
|
| 1656 | + $x = $boucle->type_requete; |
|
| 1657 | + $boucle->type_requete = false; |
|
| 1658 | + $msg = [ |
|
| 1659 | + 'zbug_iterateur_inconnu', |
|
| 1660 | + ['iterateur' => $x] |
|
| 1661 | + ]; |
|
| 1662 | + erreur_squelette($msg, $boucle); |
|
| 1663 | + } |
|
| 1664 | 1664 | } |
| 1665 | 1665 | |
| 1666 | 1666 | |
@@ -1678,22 +1678,22 @@ discard block |
||
| 1678 | 1678 | * |
| 1679 | 1679 | **/ |
| 1680 | 1680 | function requeteur_data_dist(&$boucles, &$boucle, &$id) { |
| 1681 | - include_spip('iterateur/data'); |
|
| 1682 | - if ($h = charger_fonction($boucle->type_requete . '_to_array', 'inc', true)) { |
|
| 1683 | - $g = charger_fonction('data', 'iterateur'); |
|
| 1684 | - $boucles[$id] = $g($boucle); |
|
| 1685 | - // from[0] stocke le type de data (rss, yql, ...) |
|
| 1686 | - $boucles[$id]->from[] = $boucle->type_requete; |
|
| 1687 | - } else { |
|
| 1688 | - $x = $boucle->type_requete; |
|
| 1689 | - $boucle->type_requete = false; |
|
| 1690 | - $msg = [ |
|
| 1691 | - 'zbug_requeteur_inconnu', |
|
| 1692 | - [ |
|
| 1693 | - 'requeteur' => 'data', |
|
| 1694 | - 'type' => $x |
|
| 1695 | - ] |
|
| 1696 | - ]; |
|
| 1697 | - erreur_squelette($msg, $boucle); |
|
| 1698 | - } |
|
| 1681 | + include_spip('iterateur/data'); |
|
| 1682 | + if ($h = charger_fonction($boucle->type_requete . '_to_array', 'inc', true)) { |
|
| 1683 | + $g = charger_fonction('data', 'iterateur'); |
|
| 1684 | + $boucles[$id] = $g($boucle); |
|
| 1685 | + // from[0] stocke le type de data (rss, yql, ...) |
|
| 1686 | + $boucles[$id]->from[] = $boucle->type_requete; |
|
| 1687 | + } else { |
|
| 1688 | + $x = $boucle->type_requete; |
|
| 1689 | + $boucle->type_requete = false; |
|
| 1690 | + $msg = [ |
|
| 1691 | + 'zbug_requeteur_inconnu', |
|
| 1692 | + [ |
|
| 1693 | + 'requeteur' => 'data', |
|
| 1694 | + 'type' => $x |
|
| 1695 | + ] |
|
| 1696 | + ]; |
|
| 1697 | + erreur_squelette($msg, $boucle); |
|
| 1698 | + } |
|
| 1699 | 1699 | } |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if (!defined('_DATA_SOURCE_MAX_SIZE')) { |
| 24 | - define('_DATA_SOURCE_MAX_SIZE', 2 * 1_048_576); |
|
| 24 | + define('_DATA_SOURCE_MAX_SIZE', 2 * 1_048_576); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
@@ -42,17 +42,17 @@ discard block |
||
| 42 | 42 | * Description de la boucle complétée des champs |
| 43 | 43 | */ |
| 44 | 44 | function iterateur_DATA_dist($b) { |
| 45 | - $b->iterateur = 'DATA'; # designe la classe d'iterateur |
|
| 46 | - $b->show = [ |
|
| 47 | - 'field' => [ |
|
| 48 | - 'cle' => 'STRING', |
|
| 49 | - 'valeur' => 'STRING', |
|
| 50 | - '*' => 'ALL' // Champ joker * |
|
| 51 | - ] |
|
| 52 | - ]; |
|
| 53 | - $b->select[] = '.valeur'; |
|
| 54 | - |
|
| 55 | - return $b; |
|
| 45 | + $b->iterateur = 'DATA'; # designe la classe d'iterateur |
|
| 46 | + $b->show = [ |
|
| 47 | + 'field' => [ |
|
| 48 | + 'cle' => 'STRING', |
|
| 49 | + 'valeur' => 'STRING', |
|
| 50 | + '*' => 'ALL' // Champ joker * |
|
| 51 | + ] |
|
| 52 | + ]; |
|
| 53 | + $b->select[] = '.valeur'; |
|
| 54 | + |
|
| 55 | + return $b; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -62,522 +62,522 @@ discard block |
||
| 62 | 62 | * Pour itérer sur des données quelconques (transformables en tableau) |
| 63 | 63 | */ |
| 64 | 64 | class IterateurDATA implements Iterator { |
| 65 | - /** |
|
| 66 | - * tableau de donnees |
|
| 67 | - * |
|
| 68 | - * @var array |
|
| 69 | - */ |
|
| 70 | - protected $tableau = []; |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * Conditions de filtrage |
|
| 74 | - * ie criteres de selection |
|
| 75 | - * |
|
| 76 | - * @var array |
|
| 77 | - */ |
|
| 78 | - protected $filtre = []; |
|
| 79 | - |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * Cle courante |
|
| 83 | - * |
|
| 84 | - * @var null |
|
| 85 | - */ |
|
| 86 | - protected $cle = null; |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Valeur courante |
|
| 90 | - * |
|
| 91 | - * @var null |
|
| 92 | - */ |
|
| 93 | - protected $valeur = null; |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * Erreur presente ? |
|
| 97 | - * |
|
| 98 | - * @var bool |
|
| 99 | - **/ |
|
| 100 | - public $err = false; |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * Calcul du total des elements |
|
| 104 | - * |
|
| 105 | - * @var int|null |
|
| 106 | - **/ |
|
| 107 | - public $total = null; |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Constructeur |
|
| 111 | - * |
|
| 112 | - * @param $command |
|
| 113 | - * @param array $info |
|
| 114 | - */ |
|
| 115 | - public function __construct($command, $info = []) { |
|
| 116 | - $this->type = 'DATA'; |
|
| 117 | - $this->command = $command; |
|
| 118 | - $this->info = $info; |
|
| 119 | - |
|
| 120 | - $this->select($command); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * Revenir au depart |
|
| 125 | - * |
|
| 126 | - * @return void |
|
| 127 | - */ |
|
| 128 | - public function rewind(): void { |
|
| 129 | - reset($this->tableau); |
|
| 130 | - $this->cle = array_key_first($this->tableau); |
|
| 131 | - $this->valeur = current($this->tableau); |
|
| 132 | - next($this->tableau); |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Déclarer les critères exceptions |
|
| 137 | - * |
|
| 138 | - * @return array |
|
| 139 | - */ |
|
| 140 | - public function exception_des_criteres() { |
|
| 141 | - return ['tableau']; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - /** |
|
| 145 | - * Récupérer depuis le cache si possible |
|
| 146 | - * |
|
| 147 | - * @param string $cle |
|
| 148 | - * @return mixed |
|
| 149 | - */ |
|
| 150 | - protected function cache_get($cle) { |
|
| 151 | - if (!$cle) { |
|
| 152 | - return; |
|
| 153 | - } |
|
| 154 | - # utiliser memoization si dispo |
|
| 155 | - if (!function_exists('cache_get')) { |
|
| 156 | - return; |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - return cache_get($cle); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * Stocker en cache si possible |
|
| 164 | - * |
|
| 165 | - * @param string $cle |
|
| 166 | - * @param int $ttl |
|
| 167 | - * @param null|mixed $valeur |
|
| 168 | - * @return bool |
|
| 169 | - */ |
|
| 170 | - protected function cache_set($cle, $ttl, $valeur = null) { |
|
| 171 | - if (!$cle) { |
|
| 172 | - return; |
|
| 173 | - } |
|
| 174 | - if (is_null($valeur)) { |
|
| 175 | - $valeur = $this->tableau; |
|
| 176 | - } |
|
| 177 | - # utiliser memoization si dispo |
|
| 178 | - if (!function_exists('cache_set')) { |
|
| 179 | - return; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - return cache_set( |
|
| 183 | - $cle, |
|
| 184 | - [ |
|
| 185 | - 'data' => $valeur, |
|
| 186 | - 'time' => time(), |
|
| 187 | - 'ttl' => $ttl |
|
| 188 | - ], |
|
| 189 | - 3600 + $ttl |
|
| 190 | - ); |
|
| 191 | - # conserver le cache 1h de plus que la validite demandee, |
|
| 192 | - # pour le cas ou le serveur distant ne reponde plus |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * Aller chercher les données de la boucle DATA |
|
| 197 | - * |
|
| 198 | - * @throws Exception |
|
| 199 | - * @param array $command |
|
| 200 | - * @return void |
|
| 201 | - */ |
|
| 202 | - protected function select($command) { |
|
| 203 | - |
|
| 204 | - // l'iterateur DATA peut etre appele en passant (data:type) |
|
| 205 | - // le type se retrouve dans la commande 'from' |
|
| 206 | - // dans ce cas la le critere {source}, si present, n'a pas besoin du 1er argument |
|
| 207 | - if (isset($this->command['from'][0])) { |
|
| 208 | - if (isset($this->command['source']) and is_array($this->command['source'])) { |
|
| 209 | - array_unshift($this->command['source'], $this->command['sourcemode']); |
|
| 210 | - } |
|
| 211 | - $this->command['sourcemode'] = $this->command['from'][0]; |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - // cherchons differents moyens de creer le tableau de donnees |
|
| 215 | - // les commandes connues pour l'iterateur DATA |
|
| 216 | - // sont : {tableau #ARRAY} ; {cle=...} ; {valeur=...} |
|
| 217 | - |
|
| 218 | - // {source format, [URL], [arg2]...} |
|
| 219 | - if ( |
|
| 220 | - isset($this->command['source']) |
|
| 221 | - and isset($this->command['sourcemode']) |
|
| 222 | - ) { |
|
| 223 | - $this->select_source(); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - // Critere {liste X1, X2, X3} |
|
| 227 | - if (isset($this->command['liste'])) { |
|
| 228 | - $this->select_liste(); |
|
| 229 | - } |
|
| 230 | - if (isset($this->command['enum'])) { |
|
| 231 | - $this->select_enum(); |
|
| 232 | - } |
|
| 233 | - |
|
| 234 | - // Si a ce stade on n'a pas de table, il y a un bug |
|
| 235 | - if (!is_array($this->tableau)) { |
|
| 236 | - $this->err = true; |
|
| 237 | - spip_log('erreur datasource ' . var_export($command, true)); |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - // {datapath query.results} |
|
| 241 | - // extraire le chemin "query.results" du tableau de donnees |
|
| 242 | - if ( |
|
| 243 | - !$this->err |
|
| 244 | - and isset($this->command['datapath']) |
|
| 245 | - and is_array($this->command['datapath']) |
|
| 246 | - ) { |
|
| 247 | - $this->select_datapath(); |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - // tri {par x} |
|
| 251 | - if ($this->command['orderby']) { |
|
| 252 | - $this->select_orderby(); |
|
| 253 | - } |
|
| 254 | - |
|
| 255 | - // grouper les resultats {fusion /x/y/z} ; |
|
| 256 | - if ($this->command['groupby']) { |
|
| 257 | - $this->select_groupby(); |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - $this->rewind(); |
|
| 261 | - #var_dump($this->tableau); |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - |
|
| 265 | - /** |
|
| 266 | - * Aller chercher les donnees de la boucle DATA |
|
| 267 | - * depuis une source |
|
| 268 | - * {source format, [URL], [arg2]...} |
|
| 269 | - */ |
|
| 270 | - protected function select_source() { |
|
| 271 | - # un peu crado : avant de charger le cache il faut charger |
|
| 272 | - # les class indispensables, sinon PHP ne saura pas gerer |
|
| 273 | - # l'objet en cache ; cf plugins/icalendar |
|
| 274 | - # perf : pas de fonction table_to_array ! (table est deja un array) |
|
| 275 | - if ( |
|
| 276 | - isset($this->command['sourcemode']) |
|
| 277 | - and !in_array($this->command['sourcemode'], ['table', 'array', 'tableau']) |
|
| 278 | - ) { |
|
| 279 | - charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true); |
|
| 280 | - } |
|
| 281 | - |
|
| 282 | - # le premier argument peut etre un array, une URL etc. |
|
| 283 | - $src = $this->command['source'][0]; |
|
| 284 | - |
|
| 285 | - # avons-nous un cache dispo ? |
|
| 286 | - $cle = null; |
|
| 287 | - if (is_string($src)) { |
|
| 288 | - $cle = 'datasource_' . md5($this->command['sourcemode'] . ':' . var_export($this->command['source'], true)); |
|
| 289 | - } |
|
| 290 | - |
|
| 291 | - $cache = $this->cache_get($cle); |
|
| 292 | - if (isset($this->command['datacache'])) { |
|
| 293 | - $ttl = intval($this->command['datacache']); |
|
| 294 | - } |
|
| 295 | - if ( |
|
| 296 | - $cache |
|
| 297 | - and ($cache['time'] + ($ttl ?? $cache['ttl']) |
|
| 298 | - > time()) |
|
| 299 | - and !(_request('var_mode') === 'recalcul' |
|
| 300 | - and include_spip('inc/autoriser') |
|
| 301 | - and autoriser('recalcul') |
|
| 302 | - ) |
|
| 303 | - ) { |
|
| 304 | - $this->tableau = $cache['data']; |
|
| 305 | - } else { |
|
| 306 | - try { |
|
| 307 | - if ( |
|
| 308 | - isset($this->command['sourcemode']) |
|
| 309 | - and in_array( |
|
| 310 | - $this->command['sourcemode'], |
|
| 311 | - ['table', 'array', 'tableau'] |
|
| 312 | - ) |
|
| 313 | - ) { |
|
| 314 | - if ( |
|
| 315 | - is_array($a = $src) |
|
| 316 | - or (is_string($a) |
|
| 317 | - and $a = str_replace('"', '"', $a) # fragile! |
|
| 318 | - and is_array($a = @unserialize($a))) |
|
| 319 | - ) { |
|
| 320 | - $this->tableau = $a; |
|
| 321 | - } |
|
| 322 | - } else { |
|
| 323 | - $data = $src; |
|
| 324 | - if (is_string($src)) { |
|
| 325 | - if (tester_url_absolue($src)) { |
|
| 326 | - include_spip('inc/distant'); |
|
| 327 | - $data = recuperer_url($src, ['taille_max' => _DATA_SOURCE_MAX_SIZE]); |
|
| 328 | - $data = $data['page'] ?? ''; |
|
| 329 | - if (!$data) { |
|
| 330 | - throw new Exception('404'); |
|
| 331 | - } |
|
| 332 | - if (!isset($ttl)) { |
|
| 333 | - $ttl = 24 * 3600; |
|
| 334 | - } |
|
| 335 | - } elseif (@is_dir($src)) { |
|
| 336 | - $data = $src; |
|
| 337 | - } elseif (@is_readable($src) && @is_file($src)) { |
|
| 338 | - $data = spip_file_get_contents($src); |
|
| 339 | - } |
|
| 340 | - if (!isset($ttl)) { |
|
| 341 | - $ttl = 10; |
|
| 342 | - } |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - if ( |
|
| 346 | - !$this->err |
|
| 347 | - and $data_to_array = charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true) |
|
| 348 | - ) { |
|
| 349 | - $args = $this->command['source']; |
|
| 350 | - $args[0] = $data; |
|
| 351 | - if (is_array($a = $data_to_array(...$args))) { |
|
| 352 | - $this->tableau = $a; |
|
| 353 | - } |
|
| 354 | - } |
|
| 355 | - } |
|
| 356 | - |
|
| 357 | - if (!is_array($this->tableau)) { |
|
| 358 | - $this->err = true; |
|
| 359 | - } |
|
| 360 | - |
|
| 361 | - if (!$this->err and isset($ttl) and $ttl > 0) { |
|
| 362 | - $this->cache_set($cle, $ttl); |
|
| 363 | - } |
|
| 364 | - } catch (Exception $e) { |
|
| 365 | - $e = $e->getMessage(); |
|
| 366 | - $err = sprintf( |
|
| 367 | - "[%s, %s] $e", |
|
| 368 | - $src, |
|
| 369 | - $this->command['sourcemode'] |
|
| 370 | - ); |
|
| 371 | - erreur_squelette([$err, []]); |
|
| 372 | - $this->err = true; |
|
| 373 | - } |
|
| 374 | - } |
|
| 375 | - |
|
| 376 | - # en cas d'erreur, utiliser le cache si encore dispo |
|
| 377 | - if ( |
|
| 378 | - $this->err |
|
| 379 | - and $cache |
|
| 380 | - ) { |
|
| 381 | - $this->tableau = $cache['data']; |
|
| 382 | - $this->err = false; |
|
| 383 | - } |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - |
|
| 387 | - /** |
|
| 388 | - * Retourne un tableau donne depuis un critère liste |
|
| 389 | - * |
|
| 390 | - * Critère `{liste X1, X2, X3}` |
|
| 391 | - * |
|
| 392 | - * @see critere_DATA_liste_dist() |
|
| 393 | - * |
|
| 394 | - **/ |
|
| 395 | - protected function select_liste() { |
|
| 396 | - # s'il n'y a qu'une valeur dans la liste, sans doute une #BALISE |
|
| 397 | - if (!isset($this->command['liste'][1])) { |
|
| 398 | - if (!is_array($this->command['liste'][0])) { |
|
| 399 | - $this->command['liste'] = explode(',', $this->command['liste'][0]); |
|
| 400 | - } else { |
|
| 401 | - $this->command['liste'] = $this->command['liste'][0]; |
|
| 402 | - } |
|
| 403 | - } |
|
| 404 | - $this->tableau = $this->command['liste']; |
|
| 405 | - } |
|
| 406 | - |
|
| 407 | - /** |
|
| 408 | - * Retourne un tableau donne depuis un critere liste |
|
| 409 | - * Critere {enum Xmin, Xmax} |
|
| 410 | - * |
|
| 411 | - **/ |
|
| 412 | - protected function select_enum() { |
|
| 413 | - # s'il n'y a qu'une valeur dans la liste, sans doute une #BALISE |
|
| 414 | - if (!isset($this->command['enum'][1])) { |
|
| 415 | - if (!is_array($this->command['enum'][0])) { |
|
| 416 | - $this->command['enum'] = explode(',', $this->command['enum'][0]); |
|
| 417 | - } else { |
|
| 418 | - $this->command['enum'] = $this->command['enum'][0]; |
|
| 419 | - } |
|
| 420 | - } |
|
| 421 | - if ((is_countable($this->command['enum']) ? count($this->command['enum']) : 0) >= 3) { |
|
| 422 | - $enum = range( |
|
| 423 | - array_shift($this->command['enum']), |
|
| 424 | - array_shift($this->command['enum']), |
|
| 425 | - array_shift($this->command['enum']) |
|
| 426 | - ); |
|
| 427 | - } else { |
|
| 428 | - $enum = range(array_shift($this->command['enum']), array_shift($this->command['enum'])); |
|
| 429 | - } |
|
| 430 | - $this->tableau = $enum; |
|
| 431 | - } |
|
| 432 | - |
|
| 433 | - |
|
| 434 | - /** |
|
| 435 | - * extraire le chemin "query.results" du tableau de donnees |
|
| 436 | - * {datapath query.results} |
|
| 437 | - * |
|
| 438 | - **/ |
|
| 439 | - protected function select_datapath() { |
|
| 440 | - $base = reset($this->command['datapath']); |
|
| 441 | - if (strlen($base = ltrim(trim($base), '/'))) { |
|
| 442 | - $this->tableau = table_valeur($this->tableau, $base); |
|
| 443 | - if (!is_array($this->tableau)) { |
|
| 444 | - $this->tableau = []; |
|
| 445 | - $this->err = true; |
|
| 446 | - spip_log("datapath '$base' absent"); |
|
| 447 | - } |
|
| 448 | - } |
|
| 449 | - } |
|
| 450 | - |
|
| 451 | - /** |
|
| 452 | - * Ordonner les resultats |
|
| 453 | - * {par x} |
|
| 454 | - * |
|
| 455 | - **/ |
|
| 456 | - protected function select_orderby() { |
|
| 457 | - $sortfunc = ''; |
|
| 458 | - $aleas = 0; |
|
| 459 | - foreach ($this->command['orderby'] as $tri) { |
|
| 460 | - // virer le / initial pour les criteres de la forme {par /xx} |
|
| 461 | - if (preg_match(',^\.?([/\w:_-]+)( DESC)?$,iS', ltrim($tri, '/'), $r)) { |
|
| 462 | - $r = array_pad($r, 3, null); |
|
| 463 | - |
|
| 464 | - // tri par cle |
|
| 465 | - if ($r[1] == 'cle') { |
|
| 466 | - if (isset($r[2]) and $r[2]) { |
|
| 467 | - krsort($this->tableau); |
|
| 468 | - } else { |
|
| 469 | - ksort($this->tableau); |
|
| 470 | - } |
|
| 471 | - } # {par hasard} |
|
| 472 | - else { |
|
| 473 | - if ($r[1] == 'hasard') { |
|
| 474 | - $k = array_keys($this->tableau); |
|
| 475 | - shuffle($k); |
|
| 476 | - $v = []; |
|
| 477 | - foreach ($k as $cle) { |
|
| 478 | - $v[$cle] = $this->tableau[$cle]; |
|
| 479 | - } |
|
| 480 | - $this->tableau = $v; |
|
| 481 | - } else { |
|
| 482 | - # {par valeur} |
|
| 483 | - if ($r[1] == 'valeur') { |
|
| 484 | - $tv = '%s'; |
|
| 485 | - } # {par valeur/xx/yy} ?? |
|
| 486 | - else { |
|
| 487 | - $tv = 'table_valeur(%s, ' . var_export($r[1], true) . ')'; |
|
| 488 | - } |
|
| 489 | - $sortfunc .= ' |
|
| 65 | + /** |
|
| 66 | + * tableau de donnees |
|
| 67 | + * |
|
| 68 | + * @var array |
|
| 69 | + */ |
|
| 70 | + protected $tableau = []; |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * Conditions de filtrage |
|
| 74 | + * ie criteres de selection |
|
| 75 | + * |
|
| 76 | + * @var array |
|
| 77 | + */ |
|
| 78 | + protected $filtre = []; |
|
| 79 | + |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * Cle courante |
|
| 83 | + * |
|
| 84 | + * @var null |
|
| 85 | + */ |
|
| 86 | + protected $cle = null; |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Valeur courante |
|
| 90 | + * |
|
| 91 | + * @var null |
|
| 92 | + */ |
|
| 93 | + protected $valeur = null; |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Erreur presente ? |
|
| 97 | + * |
|
| 98 | + * @var bool |
|
| 99 | + **/ |
|
| 100 | + public $err = false; |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * Calcul du total des elements |
|
| 104 | + * |
|
| 105 | + * @var int|null |
|
| 106 | + **/ |
|
| 107 | + public $total = null; |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Constructeur |
|
| 111 | + * |
|
| 112 | + * @param $command |
|
| 113 | + * @param array $info |
|
| 114 | + */ |
|
| 115 | + public function __construct($command, $info = []) { |
|
| 116 | + $this->type = 'DATA'; |
|
| 117 | + $this->command = $command; |
|
| 118 | + $this->info = $info; |
|
| 119 | + |
|
| 120 | + $this->select($command); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * Revenir au depart |
|
| 125 | + * |
|
| 126 | + * @return void |
|
| 127 | + */ |
|
| 128 | + public function rewind(): void { |
|
| 129 | + reset($this->tableau); |
|
| 130 | + $this->cle = array_key_first($this->tableau); |
|
| 131 | + $this->valeur = current($this->tableau); |
|
| 132 | + next($this->tableau); |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Déclarer les critères exceptions |
|
| 137 | + * |
|
| 138 | + * @return array |
|
| 139 | + */ |
|
| 140 | + public function exception_des_criteres() { |
|
| 141 | + return ['tableau']; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + /** |
|
| 145 | + * Récupérer depuis le cache si possible |
|
| 146 | + * |
|
| 147 | + * @param string $cle |
|
| 148 | + * @return mixed |
|
| 149 | + */ |
|
| 150 | + protected function cache_get($cle) { |
|
| 151 | + if (!$cle) { |
|
| 152 | + return; |
|
| 153 | + } |
|
| 154 | + # utiliser memoization si dispo |
|
| 155 | + if (!function_exists('cache_get')) { |
|
| 156 | + return; |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + return cache_get($cle); |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * Stocker en cache si possible |
|
| 164 | + * |
|
| 165 | + * @param string $cle |
|
| 166 | + * @param int $ttl |
|
| 167 | + * @param null|mixed $valeur |
|
| 168 | + * @return bool |
|
| 169 | + */ |
|
| 170 | + protected function cache_set($cle, $ttl, $valeur = null) { |
|
| 171 | + if (!$cle) { |
|
| 172 | + return; |
|
| 173 | + } |
|
| 174 | + if (is_null($valeur)) { |
|
| 175 | + $valeur = $this->tableau; |
|
| 176 | + } |
|
| 177 | + # utiliser memoization si dispo |
|
| 178 | + if (!function_exists('cache_set')) { |
|
| 179 | + return; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + return cache_set( |
|
| 183 | + $cle, |
|
| 184 | + [ |
|
| 185 | + 'data' => $valeur, |
|
| 186 | + 'time' => time(), |
|
| 187 | + 'ttl' => $ttl |
|
| 188 | + ], |
|
| 189 | + 3600 + $ttl |
|
| 190 | + ); |
|
| 191 | + # conserver le cache 1h de plus que la validite demandee, |
|
| 192 | + # pour le cas ou le serveur distant ne reponde plus |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * Aller chercher les données de la boucle DATA |
|
| 197 | + * |
|
| 198 | + * @throws Exception |
|
| 199 | + * @param array $command |
|
| 200 | + * @return void |
|
| 201 | + */ |
|
| 202 | + protected function select($command) { |
|
| 203 | + |
|
| 204 | + // l'iterateur DATA peut etre appele en passant (data:type) |
|
| 205 | + // le type se retrouve dans la commande 'from' |
|
| 206 | + // dans ce cas la le critere {source}, si present, n'a pas besoin du 1er argument |
|
| 207 | + if (isset($this->command['from'][0])) { |
|
| 208 | + if (isset($this->command['source']) and is_array($this->command['source'])) { |
|
| 209 | + array_unshift($this->command['source'], $this->command['sourcemode']); |
|
| 210 | + } |
|
| 211 | + $this->command['sourcemode'] = $this->command['from'][0]; |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + // cherchons differents moyens de creer le tableau de donnees |
|
| 215 | + // les commandes connues pour l'iterateur DATA |
|
| 216 | + // sont : {tableau #ARRAY} ; {cle=...} ; {valeur=...} |
|
| 217 | + |
|
| 218 | + // {source format, [URL], [arg2]...} |
|
| 219 | + if ( |
|
| 220 | + isset($this->command['source']) |
|
| 221 | + and isset($this->command['sourcemode']) |
|
| 222 | + ) { |
|
| 223 | + $this->select_source(); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + // Critere {liste X1, X2, X3} |
|
| 227 | + if (isset($this->command['liste'])) { |
|
| 228 | + $this->select_liste(); |
|
| 229 | + } |
|
| 230 | + if (isset($this->command['enum'])) { |
|
| 231 | + $this->select_enum(); |
|
| 232 | + } |
|
| 233 | + |
|
| 234 | + // Si a ce stade on n'a pas de table, il y a un bug |
|
| 235 | + if (!is_array($this->tableau)) { |
|
| 236 | + $this->err = true; |
|
| 237 | + spip_log('erreur datasource ' . var_export($command, true)); |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + // {datapath query.results} |
|
| 241 | + // extraire le chemin "query.results" du tableau de donnees |
|
| 242 | + if ( |
|
| 243 | + !$this->err |
|
| 244 | + and isset($this->command['datapath']) |
|
| 245 | + and is_array($this->command['datapath']) |
|
| 246 | + ) { |
|
| 247 | + $this->select_datapath(); |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + // tri {par x} |
|
| 251 | + if ($this->command['orderby']) { |
|
| 252 | + $this->select_orderby(); |
|
| 253 | + } |
|
| 254 | + |
|
| 255 | + // grouper les resultats {fusion /x/y/z} ; |
|
| 256 | + if ($this->command['groupby']) { |
|
| 257 | + $this->select_groupby(); |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + $this->rewind(); |
|
| 261 | + #var_dump($this->tableau); |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + |
|
| 265 | + /** |
|
| 266 | + * Aller chercher les donnees de la boucle DATA |
|
| 267 | + * depuis une source |
|
| 268 | + * {source format, [URL], [arg2]...} |
|
| 269 | + */ |
|
| 270 | + protected function select_source() { |
|
| 271 | + # un peu crado : avant de charger le cache il faut charger |
|
| 272 | + # les class indispensables, sinon PHP ne saura pas gerer |
|
| 273 | + # l'objet en cache ; cf plugins/icalendar |
|
| 274 | + # perf : pas de fonction table_to_array ! (table est deja un array) |
|
| 275 | + if ( |
|
| 276 | + isset($this->command['sourcemode']) |
|
| 277 | + and !in_array($this->command['sourcemode'], ['table', 'array', 'tableau']) |
|
| 278 | + ) { |
|
| 279 | + charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true); |
|
| 280 | + } |
|
| 281 | + |
|
| 282 | + # le premier argument peut etre un array, une URL etc. |
|
| 283 | + $src = $this->command['source'][0]; |
|
| 284 | + |
|
| 285 | + # avons-nous un cache dispo ? |
|
| 286 | + $cle = null; |
|
| 287 | + if (is_string($src)) { |
|
| 288 | + $cle = 'datasource_' . md5($this->command['sourcemode'] . ':' . var_export($this->command['source'], true)); |
|
| 289 | + } |
|
| 290 | + |
|
| 291 | + $cache = $this->cache_get($cle); |
|
| 292 | + if (isset($this->command['datacache'])) { |
|
| 293 | + $ttl = intval($this->command['datacache']); |
|
| 294 | + } |
|
| 295 | + if ( |
|
| 296 | + $cache |
|
| 297 | + and ($cache['time'] + ($ttl ?? $cache['ttl']) |
|
| 298 | + > time()) |
|
| 299 | + and !(_request('var_mode') === 'recalcul' |
|
| 300 | + and include_spip('inc/autoriser') |
|
| 301 | + and autoriser('recalcul') |
|
| 302 | + ) |
|
| 303 | + ) { |
|
| 304 | + $this->tableau = $cache['data']; |
|
| 305 | + } else { |
|
| 306 | + try { |
|
| 307 | + if ( |
|
| 308 | + isset($this->command['sourcemode']) |
|
| 309 | + and in_array( |
|
| 310 | + $this->command['sourcemode'], |
|
| 311 | + ['table', 'array', 'tableau'] |
|
| 312 | + ) |
|
| 313 | + ) { |
|
| 314 | + if ( |
|
| 315 | + is_array($a = $src) |
|
| 316 | + or (is_string($a) |
|
| 317 | + and $a = str_replace('"', '"', $a) # fragile! |
|
| 318 | + and is_array($a = @unserialize($a))) |
|
| 319 | + ) { |
|
| 320 | + $this->tableau = $a; |
|
| 321 | + } |
|
| 322 | + } else { |
|
| 323 | + $data = $src; |
|
| 324 | + if (is_string($src)) { |
|
| 325 | + if (tester_url_absolue($src)) { |
|
| 326 | + include_spip('inc/distant'); |
|
| 327 | + $data = recuperer_url($src, ['taille_max' => _DATA_SOURCE_MAX_SIZE]); |
|
| 328 | + $data = $data['page'] ?? ''; |
|
| 329 | + if (!$data) { |
|
| 330 | + throw new Exception('404'); |
|
| 331 | + } |
|
| 332 | + if (!isset($ttl)) { |
|
| 333 | + $ttl = 24 * 3600; |
|
| 334 | + } |
|
| 335 | + } elseif (@is_dir($src)) { |
|
| 336 | + $data = $src; |
|
| 337 | + } elseif (@is_readable($src) && @is_file($src)) { |
|
| 338 | + $data = spip_file_get_contents($src); |
|
| 339 | + } |
|
| 340 | + if (!isset($ttl)) { |
|
| 341 | + $ttl = 10; |
|
| 342 | + } |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + if ( |
|
| 346 | + !$this->err |
|
| 347 | + and $data_to_array = charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true) |
|
| 348 | + ) { |
|
| 349 | + $args = $this->command['source']; |
|
| 350 | + $args[0] = $data; |
|
| 351 | + if (is_array($a = $data_to_array(...$args))) { |
|
| 352 | + $this->tableau = $a; |
|
| 353 | + } |
|
| 354 | + } |
|
| 355 | + } |
|
| 356 | + |
|
| 357 | + if (!is_array($this->tableau)) { |
|
| 358 | + $this->err = true; |
|
| 359 | + } |
|
| 360 | + |
|
| 361 | + if (!$this->err and isset($ttl) and $ttl > 0) { |
|
| 362 | + $this->cache_set($cle, $ttl); |
|
| 363 | + } |
|
| 364 | + } catch (Exception $e) { |
|
| 365 | + $e = $e->getMessage(); |
|
| 366 | + $err = sprintf( |
|
| 367 | + "[%s, %s] $e", |
|
| 368 | + $src, |
|
| 369 | + $this->command['sourcemode'] |
|
| 370 | + ); |
|
| 371 | + erreur_squelette([$err, []]); |
|
| 372 | + $this->err = true; |
|
| 373 | + } |
|
| 374 | + } |
|
| 375 | + |
|
| 376 | + # en cas d'erreur, utiliser le cache si encore dispo |
|
| 377 | + if ( |
|
| 378 | + $this->err |
|
| 379 | + and $cache |
|
| 380 | + ) { |
|
| 381 | + $this->tableau = $cache['data']; |
|
| 382 | + $this->err = false; |
|
| 383 | + } |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + |
|
| 387 | + /** |
|
| 388 | + * Retourne un tableau donne depuis un critère liste |
|
| 389 | + * |
|
| 390 | + * Critère `{liste X1, X2, X3}` |
|
| 391 | + * |
|
| 392 | + * @see critere_DATA_liste_dist() |
|
| 393 | + * |
|
| 394 | + **/ |
|
| 395 | + protected function select_liste() { |
|
| 396 | + # s'il n'y a qu'une valeur dans la liste, sans doute une #BALISE |
|
| 397 | + if (!isset($this->command['liste'][1])) { |
|
| 398 | + if (!is_array($this->command['liste'][0])) { |
|
| 399 | + $this->command['liste'] = explode(',', $this->command['liste'][0]); |
|
| 400 | + } else { |
|
| 401 | + $this->command['liste'] = $this->command['liste'][0]; |
|
| 402 | + } |
|
| 403 | + } |
|
| 404 | + $this->tableau = $this->command['liste']; |
|
| 405 | + } |
|
| 406 | + |
|
| 407 | + /** |
|
| 408 | + * Retourne un tableau donne depuis un critere liste |
|
| 409 | + * Critere {enum Xmin, Xmax} |
|
| 410 | + * |
|
| 411 | + **/ |
|
| 412 | + protected function select_enum() { |
|
| 413 | + # s'il n'y a qu'une valeur dans la liste, sans doute une #BALISE |
|
| 414 | + if (!isset($this->command['enum'][1])) { |
|
| 415 | + if (!is_array($this->command['enum'][0])) { |
|
| 416 | + $this->command['enum'] = explode(',', $this->command['enum'][0]); |
|
| 417 | + } else { |
|
| 418 | + $this->command['enum'] = $this->command['enum'][0]; |
|
| 419 | + } |
|
| 420 | + } |
|
| 421 | + if ((is_countable($this->command['enum']) ? count($this->command['enum']) : 0) >= 3) { |
|
| 422 | + $enum = range( |
|
| 423 | + array_shift($this->command['enum']), |
|
| 424 | + array_shift($this->command['enum']), |
|
| 425 | + array_shift($this->command['enum']) |
|
| 426 | + ); |
|
| 427 | + } else { |
|
| 428 | + $enum = range(array_shift($this->command['enum']), array_shift($this->command['enum'])); |
|
| 429 | + } |
|
| 430 | + $this->tableau = $enum; |
|
| 431 | + } |
|
| 432 | + |
|
| 433 | + |
|
| 434 | + /** |
|
| 435 | + * extraire le chemin "query.results" du tableau de donnees |
|
| 436 | + * {datapath query.results} |
|
| 437 | + * |
|
| 438 | + **/ |
|
| 439 | + protected function select_datapath() { |
|
| 440 | + $base = reset($this->command['datapath']); |
|
| 441 | + if (strlen($base = ltrim(trim($base), '/'))) { |
|
| 442 | + $this->tableau = table_valeur($this->tableau, $base); |
|
| 443 | + if (!is_array($this->tableau)) { |
|
| 444 | + $this->tableau = []; |
|
| 445 | + $this->err = true; |
|
| 446 | + spip_log("datapath '$base' absent"); |
|
| 447 | + } |
|
| 448 | + } |
|
| 449 | + } |
|
| 450 | + |
|
| 451 | + /** |
|
| 452 | + * Ordonner les resultats |
|
| 453 | + * {par x} |
|
| 454 | + * |
|
| 455 | + **/ |
|
| 456 | + protected function select_orderby() { |
|
| 457 | + $sortfunc = ''; |
|
| 458 | + $aleas = 0; |
|
| 459 | + foreach ($this->command['orderby'] as $tri) { |
|
| 460 | + // virer le / initial pour les criteres de la forme {par /xx} |
|
| 461 | + if (preg_match(',^\.?([/\w:_-]+)( DESC)?$,iS', ltrim($tri, '/'), $r)) { |
|
| 462 | + $r = array_pad($r, 3, null); |
|
| 463 | + |
|
| 464 | + // tri par cle |
|
| 465 | + if ($r[1] == 'cle') { |
|
| 466 | + if (isset($r[2]) and $r[2]) { |
|
| 467 | + krsort($this->tableau); |
|
| 468 | + } else { |
|
| 469 | + ksort($this->tableau); |
|
| 470 | + } |
|
| 471 | + } # {par hasard} |
|
| 472 | + else { |
|
| 473 | + if ($r[1] == 'hasard') { |
|
| 474 | + $k = array_keys($this->tableau); |
|
| 475 | + shuffle($k); |
|
| 476 | + $v = []; |
|
| 477 | + foreach ($k as $cle) { |
|
| 478 | + $v[$cle] = $this->tableau[$cle]; |
|
| 479 | + } |
|
| 480 | + $this->tableau = $v; |
|
| 481 | + } else { |
|
| 482 | + # {par valeur} |
|
| 483 | + if ($r[1] == 'valeur') { |
|
| 484 | + $tv = '%s'; |
|
| 485 | + } # {par valeur/xx/yy} ?? |
|
| 486 | + else { |
|
| 487 | + $tv = 'table_valeur(%s, ' . var_export($r[1], true) . ')'; |
|
| 488 | + } |
|
| 489 | + $sortfunc .= ' |
|
| 490 | 490 | $a = ' . sprintf($tv, '$aa') . '; |
| 491 | 491 | $b = ' . sprintf($tv, '$bb') . '; |
| 492 | 492 | if ($a <> $b) |
| 493 | 493 | return ($a ' . (!empty($r[2]) ? '>' : '<') . ' $b) ? -1 : 1;'; |
| 494 | - } |
|
| 495 | - } |
|
| 496 | - } |
|
| 497 | - } |
|
| 498 | - |
|
| 499 | - if ($sortfunc) { |
|
| 500 | - $sortfunc .= "\n return 0;"; |
|
| 501 | - uasort($this->tableau, fn($aa, $bb) => eval($sortfunc)); |
|
| 502 | - } |
|
| 503 | - } |
|
| 504 | - |
|
| 505 | - |
|
| 506 | - /** |
|
| 507 | - * Grouper les resultats |
|
| 508 | - * {fusion /x/y/z} |
|
| 509 | - * |
|
| 510 | - **/ |
|
| 511 | - protected function select_groupby() { |
|
| 512 | - // virer le / initial pour les criteres de la forme {fusion /xx} |
|
| 513 | - if (strlen($fusion = ltrim($this->command['groupby'][0], '/'))) { |
|
| 514 | - $vu = []; |
|
| 515 | - foreach ($this->tableau as $k => $v) { |
|
| 516 | - $val = table_valeur($v, $fusion); |
|
| 517 | - if (isset($vu[$val])) { |
|
| 518 | - unset($this->tableau[$k]); |
|
| 519 | - } else { |
|
| 520 | - $vu[$val] = true; |
|
| 521 | - } |
|
| 522 | - } |
|
| 523 | - } |
|
| 524 | - } |
|
| 525 | - |
|
| 526 | - |
|
| 527 | - /** |
|
| 528 | - * L'iterateur est-il encore valide ? |
|
| 529 | - * |
|
| 530 | - * @return bool |
|
| 531 | - */ |
|
| 532 | - public function valid(): bool { |
|
| 533 | - return !is_null($this->cle); |
|
| 534 | - } |
|
| 535 | - |
|
| 536 | - /** |
|
| 537 | - * Retourner la valeur |
|
| 538 | - * |
|
| 539 | - * @return mixed |
|
| 540 | - */ |
|
| 541 | - #[\ReturnTypeWillChange] |
|
| 542 | - public function current() { |
|
| 543 | - return $this->valeur; |
|
| 544 | - } |
|
| 545 | - |
|
| 546 | - /** |
|
| 547 | - * Retourner la cle |
|
| 548 | - * |
|
| 549 | - * @return mixed |
|
| 550 | - */ |
|
| 551 | - #[\ReturnTypeWillChange] |
|
| 552 | - public function key() { |
|
| 553 | - return $this->cle; |
|
| 554 | - } |
|
| 555 | - |
|
| 556 | - /** |
|
| 557 | - * Passer a la valeur suivante |
|
| 558 | - * |
|
| 559 | - * @return void |
|
| 560 | - */ |
|
| 561 | - public function next(): void { |
|
| 562 | - if ($this->valid()) { |
|
| 563 | - $this->cle = key($this->tableau); |
|
| 564 | - $this->valeur = current($this->tableau); |
|
| 565 | - next($this->tableau); |
|
| 566 | - } |
|
| 567 | - } |
|
| 568 | - |
|
| 569 | - /** |
|
| 570 | - * Compter le nombre total de resultats |
|
| 571 | - * |
|
| 572 | - * @return int |
|
| 573 | - */ |
|
| 574 | - public function count() { |
|
| 575 | - if (is_null($this->total)) { |
|
| 576 | - $this->total = count($this->tableau); |
|
| 577 | - } |
|
| 578 | - |
|
| 579 | - return $this->total; |
|
| 580 | - } |
|
| 494 | + } |
|
| 495 | + } |
|
| 496 | + } |
|
| 497 | + } |
|
| 498 | + |
|
| 499 | + if ($sortfunc) { |
|
| 500 | + $sortfunc .= "\n return 0;"; |
|
| 501 | + uasort($this->tableau, fn($aa, $bb) => eval($sortfunc)); |
|
| 502 | + } |
|
| 503 | + } |
|
| 504 | + |
|
| 505 | + |
|
| 506 | + /** |
|
| 507 | + * Grouper les resultats |
|
| 508 | + * {fusion /x/y/z} |
|
| 509 | + * |
|
| 510 | + **/ |
|
| 511 | + protected function select_groupby() { |
|
| 512 | + // virer le / initial pour les criteres de la forme {fusion /xx} |
|
| 513 | + if (strlen($fusion = ltrim($this->command['groupby'][0], '/'))) { |
|
| 514 | + $vu = []; |
|
| 515 | + foreach ($this->tableau as $k => $v) { |
|
| 516 | + $val = table_valeur($v, $fusion); |
|
| 517 | + if (isset($vu[$val])) { |
|
| 518 | + unset($this->tableau[$k]); |
|
| 519 | + } else { |
|
| 520 | + $vu[$val] = true; |
|
| 521 | + } |
|
| 522 | + } |
|
| 523 | + } |
|
| 524 | + } |
|
| 525 | + |
|
| 526 | + |
|
| 527 | + /** |
|
| 528 | + * L'iterateur est-il encore valide ? |
|
| 529 | + * |
|
| 530 | + * @return bool |
|
| 531 | + */ |
|
| 532 | + public function valid(): bool { |
|
| 533 | + return !is_null($this->cle); |
|
| 534 | + } |
|
| 535 | + |
|
| 536 | + /** |
|
| 537 | + * Retourner la valeur |
|
| 538 | + * |
|
| 539 | + * @return mixed |
|
| 540 | + */ |
|
| 541 | + #[\ReturnTypeWillChange] |
|
| 542 | + public function current() { |
|
| 543 | + return $this->valeur; |
|
| 544 | + } |
|
| 545 | + |
|
| 546 | + /** |
|
| 547 | + * Retourner la cle |
|
| 548 | + * |
|
| 549 | + * @return mixed |
|
| 550 | + */ |
|
| 551 | + #[\ReturnTypeWillChange] |
|
| 552 | + public function key() { |
|
| 553 | + return $this->cle; |
|
| 554 | + } |
|
| 555 | + |
|
| 556 | + /** |
|
| 557 | + * Passer a la valeur suivante |
|
| 558 | + * |
|
| 559 | + * @return void |
|
| 560 | + */ |
|
| 561 | + public function next(): void { |
|
| 562 | + if ($this->valid()) { |
|
| 563 | + $this->cle = key($this->tableau); |
|
| 564 | + $this->valeur = current($this->tableau); |
|
| 565 | + next($this->tableau); |
|
| 566 | + } |
|
| 567 | + } |
|
| 568 | + |
|
| 569 | + /** |
|
| 570 | + * Compter le nombre total de resultats |
|
| 571 | + * |
|
| 572 | + * @return int |
|
| 573 | + */ |
|
| 574 | + public function count() { |
|
| 575 | + if (is_null($this->total)) { |
|
| 576 | + $this->total = count($this->tableau); |
|
| 577 | + } |
|
| 578 | + |
|
| 579 | + return $this->total; |
|
| 580 | + } |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | /* |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | * @return array |
| 592 | 592 | */ |
| 593 | 593 | function inc_file_to_array_dist($data) { |
| 594 | - return preg_split('/\r?\n/', $data); |
|
| 594 | + return preg_split('/\r?\n/', $data); |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | /** |
@@ -600,9 +600,9 @@ discard block |
||
| 600 | 600 | * @return array |
| 601 | 601 | */ |
| 602 | 602 | function inc_plugins_to_array_dist() { |
| 603 | - include_spip('inc/plugin'); |
|
| 603 | + include_spip('inc/plugin'); |
|
| 604 | 604 | |
| 605 | - return liste_chemin_plugin_actifs(); |
|
| 605 | + return liste_chemin_plugin_actifs(); |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | /** |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | * @return array |
| 613 | 613 | */ |
| 614 | 614 | function inc_xml_to_array_dist($data) { |
| 615 | - return @XMLObjectToArray(new SimpleXmlIterator($data)); |
|
| 615 | + return @XMLObjectToArray(new SimpleXmlIterator($data)); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | /** |
@@ -624,14 +624,14 @@ discard block |
||
| 624 | 624 | * |
| 625 | 625 | */ |
| 626 | 626 | function inc_object_to_array($object) { |
| 627 | - if (!is_object($object) && !is_array($object)) { |
|
| 628 | - return $object; |
|
| 629 | - } |
|
| 630 | - if (is_object($object)) { |
|
| 631 | - $object = get_object_vars($object); |
|
| 632 | - } |
|
| 633 | - |
|
| 634 | - return array_map('inc_object_to_array', $object); |
|
| 627 | + if (!is_object($object) && !is_array($object)) { |
|
| 628 | + return $object; |
|
| 629 | + } |
|
| 630 | + if (is_object($object)) { |
|
| 631 | + $object = get_object_vars($object); |
|
| 632 | + } |
|
| 633 | + |
|
| 634 | + return array_map('inc_object_to_array', $object); |
|
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | /** |
@@ -641,20 +641,20 @@ discard block |
||
| 641 | 641 | * @return array|bool |
| 642 | 642 | */ |
| 643 | 643 | function inc_sql_to_array_dist($data) { |
| 644 | - # sortir le connecteur de $data |
|
| 645 | - preg_match(',^(?:(\w+):)?(.*)$,Sm', $data, $v); |
|
| 646 | - $serveur = (string)$v[1]; |
|
| 647 | - $req = trim($v[2]); |
|
| 648 | - if ($s = sql_query($req, $serveur)) { |
|
| 649 | - $r = []; |
|
| 650 | - while ($t = sql_fetch($s)) { |
|
| 651 | - $r[] = $t; |
|
| 652 | - } |
|
| 653 | - |
|
| 654 | - return $r; |
|
| 655 | - } |
|
| 656 | - |
|
| 657 | - return false; |
|
| 644 | + # sortir le connecteur de $data |
|
| 645 | + preg_match(',^(?:(\w+):)?(.*)$,Sm', $data, $v); |
|
| 646 | + $serveur = (string)$v[1]; |
|
| 647 | + $req = trim($v[2]); |
|
| 648 | + if ($s = sql_query($req, $serveur)) { |
|
| 649 | + $r = []; |
|
| 650 | + while ($t = sql_fetch($s)) { |
|
| 651 | + $r[] = $t; |
|
| 652 | + } |
|
| 653 | + |
|
| 654 | + return $r; |
|
| 655 | + } |
|
| 656 | + |
|
| 657 | + return false; |
|
| 658 | 658 | } |
| 659 | 659 | |
| 660 | 660 | /** |
@@ -664,13 +664,13 @@ discard block |
||
| 664 | 664 | * @return array|bool |
| 665 | 665 | */ |
| 666 | 666 | function inc_json_to_array_dist($data) { |
| 667 | - try { |
|
| 668 | - $json = json_decode($data, true, 512, JSON_THROW_ON_ERROR); |
|
| 669 | - } catch (JsonException $e) { |
|
| 670 | - $json = null; |
|
| 671 | - spip_log('Failed to parse Json data : ' . $e->getMessage(), _LOG_INFO); |
|
| 672 | - } |
|
| 673 | - return is_array($json) ? (array) $json : []; |
|
| 667 | + try { |
|
| 668 | + $json = json_decode($data, true, 512, JSON_THROW_ON_ERROR); |
|
| 669 | + } catch (JsonException $e) { |
|
| 670 | + $json = null; |
|
| 671 | + spip_log('Failed to parse Json data : ' . $e->getMessage(), _LOG_INFO); |
|
| 672 | + } |
|
| 673 | + return is_array($json) ? (array) $json : []; |
|
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | /** |
@@ -680,30 +680,30 @@ discard block |
||
| 680 | 680 | * @return array|bool |
| 681 | 681 | */ |
| 682 | 682 | function inc_csv_to_array_dist($data) { |
| 683 | - include_spip('inc/csv'); |
|
| 684 | - [$entete, $csv] = analyse_csv($data); |
|
| 685 | - array_unshift($csv, $entete); |
|
| 686 | - |
|
| 687 | - include_spip('inc/charsets'); |
|
| 688 | - $i = 1; |
|
| 689 | - foreach ($entete as $k => $v) { |
|
| 690 | - if (trim($v) == '') { |
|
| 691 | - $v = 'col' . $i; |
|
| 692 | - } // reperer des eventuelles cases vides |
|
| 693 | - if (is_numeric($v) and $v < 0) { |
|
| 694 | - $v = '__' . $v; |
|
| 695 | - } // ne pas risquer d'ecraser une cle numerique |
|
| 696 | - if (is_numeric($v)) { |
|
| 697 | - $v = '_' . $v; |
|
| 698 | - } // ne pas risquer d'ecraser une cle numerique |
|
| 699 | - $v = strtolower(preg_replace(',\W+,', '_', translitteration($v))); |
|
| 700 | - foreach ($csv as &$item) { |
|
| 701 | - $item[$v] = &$item[$k]; |
|
| 702 | - } |
|
| 703 | - $i++; |
|
| 704 | - } |
|
| 705 | - |
|
| 706 | - return $csv; |
|
| 683 | + include_spip('inc/csv'); |
|
| 684 | + [$entete, $csv] = analyse_csv($data); |
|
| 685 | + array_unshift($csv, $entete); |
|
| 686 | + |
|
| 687 | + include_spip('inc/charsets'); |
|
| 688 | + $i = 1; |
|
| 689 | + foreach ($entete as $k => $v) { |
|
| 690 | + if (trim($v) == '') { |
|
| 691 | + $v = 'col' . $i; |
|
| 692 | + } // reperer des eventuelles cases vides |
|
| 693 | + if (is_numeric($v) and $v < 0) { |
|
| 694 | + $v = '__' . $v; |
|
| 695 | + } // ne pas risquer d'ecraser une cle numerique |
|
| 696 | + if (is_numeric($v)) { |
|
| 697 | + $v = '_' . $v; |
|
| 698 | + } // ne pas risquer d'ecraser une cle numerique |
|
| 699 | + $v = strtolower(preg_replace(',\W+,', '_', translitteration($v))); |
|
| 700 | + foreach ($csv as &$item) { |
|
| 701 | + $item[$v] = &$item[$k]; |
|
| 702 | + } |
|
| 703 | + $i++; |
|
| 704 | + } |
|
| 705 | + |
|
| 706 | + return $csv; |
|
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | /** |
@@ -713,13 +713,13 @@ discard block |
||
| 713 | 713 | * @return array|bool |
| 714 | 714 | */ |
| 715 | 715 | function inc_rss_to_array_dist($data) { |
| 716 | - $tableau = null; |
|
| 717 | - include_spip('inc/syndic'); |
|
| 718 | - if (is_array($rss = analyser_backend($data))) { |
|
| 719 | - $tableau = $rss; |
|
| 720 | - } |
|
| 716 | + $tableau = null; |
|
| 717 | + include_spip('inc/syndic'); |
|
| 718 | + if (is_array($rss = analyser_backend($data))) { |
|
| 719 | + $tableau = $rss; |
|
| 720 | + } |
|
| 721 | 721 | |
| 722 | - return $tableau; |
|
| 722 | + return $tableau; |
|
| 723 | 723 | } |
| 724 | 724 | |
| 725 | 725 | /** |
@@ -729,9 +729,9 @@ discard block |
||
| 729 | 729 | * @return array|bool |
| 730 | 730 | */ |
| 731 | 731 | function inc_atom_to_array_dist($data) { |
| 732 | - $rss_to_array = charger_fonction('rss_to_array', 'inc'); |
|
| 732 | + $rss_to_array = charger_fonction('rss_to_array', 'inc'); |
|
| 733 | 733 | |
| 734 | - return $rss_to_array($data); |
|
| 734 | + return $rss_to_array($data); |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | /** |
@@ -742,12 +742,12 @@ discard block |
||
| 742 | 742 | * @return array|bool |
| 743 | 743 | */ |
| 744 | 744 | function inc_glob_to_array_dist($data) { |
| 745 | - $a = glob( |
|
| 746 | - $data, |
|
| 747 | - GLOB_MARK | GLOB_NOSORT | GLOB_BRACE |
|
| 748 | - ); |
|
| 745 | + $a = glob( |
|
| 746 | + $data, |
|
| 747 | + GLOB_MARK | GLOB_NOSORT | GLOB_BRACE |
|
| 748 | + ); |
|
| 749 | 749 | |
| 750 | - return $a ?: []; |
|
| 750 | + return $a ?: []; |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | /** |
@@ -758,14 +758,14 @@ discard block |
||
| 758 | 758 | * @throws Exception |
| 759 | 759 | */ |
| 760 | 760 | function inc_yaml_to_array_dist($data) { |
| 761 | - include_spip('inc/yaml-mini'); |
|
| 762 | - if (!function_exists('yaml_decode')) { |
|
| 763 | - throw new Exception('YAML: impossible de trouver la fonction yaml_decode'); |
|
| 761 | + include_spip('inc/yaml-mini'); |
|
| 762 | + if (!function_exists('yaml_decode')) { |
|
| 763 | + throw new Exception('YAML: impossible de trouver la fonction yaml_decode'); |
|
| 764 | 764 | |
| 765 | - return false; |
|
| 766 | - } |
|
| 765 | + return false; |
|
| 766 | + } |
|
| 767 | 767 | |
| 768 | - return yaml_decode($data); |
|
| 768 | + return yaml_decode($data); |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | * @return array|bool |
| 781 | 781 | */ |
| 782 | 782 | function inc_pregfiles_to_array_dist($dir, $regexp = -1, $limit = 10000) { |
| 783 | - return (array)preg_files($dir, $regexp, $limit); |
|
| 783 | + return (array)preg_files($dir, $regexp, $limit); |
|
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | /** |
@@ -792,23 +792,23 @@ discard block |
||
| 792 | 792 | * @return array|bool |
| 793 | 793 | */ |
| 794 | 794 | function inc_ls_to_array_dist($data) { |
| 795 | - $glob_to_array = charger_fonction('glob_to_array', 'inc'); |
|
| 796 | - $a = $glob_to_array($data); |
|
| 797 | - foreach ($a as &$v) { |
|
| 798 | - $b = (array)@stat($v); |
|
| 799 | - foreach ($b as $k => $ignore) { |
|
| 800 | - if (is_numeric($k)) { |
|
| 801 | - unset($b[$k]); |
|
| 802 | - } |
|
| 803 | - } |
|
| 804 | - $b['file'] = preg_replace('`/$`', '', $v) ; |
|
| 805 | - $v = array_merge( |
|
| 806 | - pathinfo($v), |
|
| 807 | - $b |
|
| 808 | - ); |
|
| 809 | - } |
|
| 810 | - |
|
| 811 | - return $a; |
|
| 795 | + $glob_to_array = charger_fonction('glob_to_array', 'inc'); |
|
| 796 | + $a = $glob_to_array($data); |
|
| 797 | + foreach ($a as &$v) { |
|
| 798 | + $b = (array)@stat($v); |
|
| 799 | + foreach ($b as $k => $ignore) { |
|
| 800 | + if (is_numeric($k)) { |
|
| 801 | + unset($b[$k]); |
|
| 802 | + } |
|
| 803 | + } |
|
| 804 | + $b['file'] = preg_replace('`/$`', '', $v) ; |
|
| 805 | + $v = array_merge( |
|
| 806 | + pathinfo($v), |
|
| 807 | + $b |
|
| 808 | + ); |
|
| 809 | + } |
|
| 810 | + |
|
| 811 | + return $a; |
|
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | /** |
@@ -818,25 +818,25 @@ discard block |
||
| 818 | 818 | * @return array|bool |
| 819 | 819 | */ |
| 820 | 820 | function XMLObjectToArray($object) { |
| 821 | - $xml_array = []; |
|
| 822 | - for ($object->rewind(); $object->valid(); $object->next()) { |
|
| 823 | - if (array_key_exists($key = $object->key(), $xml_array)) { |
|
| 824 | - $key .= '-' . uniqid(); |
|
| 825 | - } |
|
| 826 | - $vars = get_object_vars($object->current()); |
|
| 827 | - if (isset($vars['@attributes'])) { |
|
| 828 | - foreach ($vars['@attributes'] as $k => $v) { |
|
| 829 | - $xml_array[$key][$k] = $v; |
|
| 830 | - } |
|
| 831 | - } |
|
| 832 | - if ($object->hasChildren()) { |
|
| 833 | - $xml_array[$key][] = XMLObjectToArray( |
|
| 834 | - $object->current() |
|
| 835 | - ); |
|
| 836 | - } else { |
|
| 837 | - $xml_array[$key][] = strval($object->current()); |
|
| 838 | - } |
|
| 839 | - } |
|
| 840 | - |
|
| 841 | - return $xml_array; |
|
| 821 | + $xml_array = []; |
|
| 822 | + for ($object->rewind(); $object->valid(); $object->next()) { |
|
| 823 | + if (array_key_exists($key = $object->key(), $xml_array)) { |
|
| 824 | + $key .= '-' . uniqid(); |
|
| 825 | + } |
|
| 826 | + $vars = get_object_vars($object->current()); |
|
| 827 | + if (isset($vars['@attributes'])) { |
|
| 828 | + foreach ($vars['@attributes'] as $k => $v) { |
|
| 829 | + $xml_array[$key][$k] = $v; |
|
| 830 | + } |
|
| 831 | + } |
|
| 832 | + if ($object->hasChildren()) { |
|
| 833 | + $xml_array[$key][] = XMLObjectToArray( |
|
| 834 | + $object->current() |
|
| 835 | + ); |
|
| 836 | + } else { |
|
| 837 | + $xml_array[$key][] = strval($object->current()); |
|
| 838 | + } |
|
| 839 | + } |
|
| 840 | + |
|
| 841 | + return $xml_array; |
|
| 842 | 842 | } |
@@ -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 | |
@@ -27,210 +27,210 @@ discard block |
||
| 27 | 27 | * Permet d'itérer sur des données en base de données |
| 28 | 28 | */ |
| 29 | 29 | class IterateurSQL implements Iterator { |
| 30 | - /** |
|
| 31 | - * Ressource sql |
|
| 32 | - * |
|
| 33 | - * @var Object|bool |
|
| 34 | - */ |
|
| 35 | - protected $sqlresult = false; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * row sql courante |
|
| 39 | - * |
|
| 40 | - * @var array|null |
|
| 41 | - */ |
|
| 42 | - protected $row = null; |
|
| 43 | - |
|
| 44 | - protected $firstseek = false; |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * Erreur presente ? |
|
| 48 | - * |
|
| 49 | - * @var bool |
|
| 50 | - **/ |
|
| 51 | - public $err = false; |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Calcul du total des elements |
|
| 55 | - * |
|
| 56 | - * @var int|null |
|
| 57 | - **/ |
|
| 58 | - public $total = null; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * selectionner les donnees, ie faire la requete SQL |
|
| 62 | - * |
|
| 63 | - * @return void |
|
| 64 | - */ |
|
| 65 | - protected function select() { |
|
| 66 | - $this->row = null; |
|
| 67 | - $v = &$this->command; |
|
| 68 | - $this->sqlresult = calculer_select( |
|
| 69 | - $v['select'], |
|
| 70 | - $v['from'], |
|
| 71 | - $v['type'], |
|
| 72 | - $v['where'], |
|
| 73 | - $v['join'], |
|
| 74 | - $v['groupby'], |
|
| 75 | - $v['orderby'], |
|
| 76 | - $v['limit'], |
|
| 77 | - $v['having'], |
|
| 78 | - $v['table'], |
|
| 79 | - $v['id'], |
|
| 80 | - $v['connect'], |
|
| 81 | - $this->info |
|
| 82 | - ); |
|
| 83 | - $this->err = !$this->sqlresult; |
|
| 84 | - $this->firstseek = false; |
|
| 85 | - $this->pos = -1; |
|
| 86 | - |
|
| 87 | - // pas d'init a priori, le calcul ne sera fait qu'en cas de besoin (provoque une double requete souvent inutile en sqlite) |
|
| 88 | - //$this->total = $this->count(); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /* |
|
| 30 | + /** |
|
| 31 | + * Ressource sql |
|
| 32 | + * |
|
| 33 | + * @var Object|bool |
|
| 34 | + */ |
|
| 35 | + protected $sqlresult = false; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * row sql courante |
|
| 39 | + * |
|
| 40 | + * @var array|null |
|
| 41 | + */ |
|
| 42 | + protected $row = null; |
|
| 43 | + |
|
| 44 | + protected $firstseek = false; |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * Erreur presente ? |
|
| 48 | + * |
|
| 49 | + * @var bool |
|
| 50 | + **/ |
|
| 51 | + public $err = false; |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Calcul du total des elements |
|
| 55 | + * |
|
| 56 | + * @var int|null |
|
| 57 | + **/ |
|
| 58 | + public $total = null; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * selectionner les donnees, ie faire la requete SQL |
|
| 62 | + * |
|
| 63 | + * @return void |
|
| 64 | + */ |
|
| 65 | + protected function select() { |
|
| 66 | + $this->row = null; |
|
| 67 | + $v = &$this->command; |
|
| 68 | + $this->sqlresult = calculer_select( |
|
| 69 | + $v['select'], |
|
| 70 | + $v['from'], |
|
| 71 | + $v['type'], |
|
| 72 | + $v['where'], |
|
| 73 | + $v['join'], |
|
| 74 | + $v['groupby'], |
|
| 75 | + $v['orderby'], |
|
| 76 | + $v['limit'], |
|
| 77 | + $v['having'], |
|
| 78 | + $v['table'], |
|
| 79 | + $v['id'], |
|
| 80 | + $v['connect'], |
|
| 81 | + $this->info |
|
| 82 | + ); |
|
| 83 | + $this->err = !$this->sqlresult; |
|
| 84 | + $this->firstseek = false; |
|
| 85 | + $this->pos = -1; |
|
| 86 | + |
|
| 87 | + // pas d'init a priori, le calcul ne sera fait qu'en cas de besoin (provoque une double requete souvent inutile en sqlite) |
|
| 88 | + //$this->total = $this->count(); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /* |
|
| 92 | 92 | * array command: les commandes d'initialisation |
| 93 | 93 | * array info: les infos sur le squelette |
| 94 | 94 | */ |
| 95 | - public function __construct($command, $info = []) { |
|
| 96 | - $this->type = 'SQL'; |
|
| 97 | - $this->command = $command; |
|
| 98 | - $this->info = $info; |
|
| 99 | - $this->select(); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * Rembobiner |
|
| 104 | - * |
|
| 105 | - * @return bool |
|
| 106 | - */ |
|
| 107 | - public function rewind(): void { |
|
| 108 | - if ($this->pos > 0) { |
|
| 109 | - $this->seek(0); |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Verifier l'etat de l'iterateur |
|
| 115 | - * |
|
| 116 | - * @return bool |
|
| 117 | - */ |
|
| 118 | - public function valid(): bool { |
|
| 119 | - if ($this->err) { |
|
| 120 | - return false; |
|
| 121 | - } |
|
| 122 | - if (!$this->firstseek) { |
|
| 123 | - $this->next(); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - return is_array($this->row); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * Valeurs sur la position courante |
|
| 131 | - * |
|
| 132 | - * @return array |
|
| 133 | - */ |
|
| 134 | - #[\ReturnTypeWillChange] |
|
| 135 | - public function current() { |
|
| 136 | - return $this->row; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - #[\ReturnTypeWillChange] |
|
| 140 | - public function key() { |
|
| 141 | - return $this->pos; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - /** |
|
| 145 | - * Sauter a une position absolue |
|
| 146 | - * |
|
| 147 | - * @param int $n |
|
| 148 | - * @param null|string $continue |
|
| 149 | - * @return bool |
|
| 150 | - */ |
|
| 151 | - public function seek($n = 0, $continue = null) { |
|
| 152 | - if (!sql_seek($this->sqlresult, $n, $this->command['connect'], $continue)) { |
|
| 153 | - // SQLite ne sait pas seek(), il faut relancer la query |
|
| 154 | - // si la position courante est apres la position visee |
|
| 155 | - // il faut relancer la requete |
|
| 156 | - if ($this->pos > $n) { |
|
| 157 | - $this->free(); |
|
| 158 | - $this->select(); |
|
| 159 | - $this->valid(); |
|
| 160 | - } |
|
| 161 | - // et utiliser la methode par defaut pour se deplacer au bon endroit |
|
| 162 | - // (sera fait en cas d'echec de cette fonction) |
|
| 163 | - return false; |
|
| 164 | - } |
|
| 165 | - $this->row = sql_fetch($this->sqlresult, $this->command['connect']); |
|
| 166 | - $this->pos = min($n, $this->count()); |
|
| 167 | - |
|
| 168 | - return true; |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * Avancer d'un cran |
|
| 173 | - * |
|
| 174 | - * @return void |
|
| 175 | - */ |
|
| 176 | - public function next(): void { |
|
| 177 | - $this->row = sql_fetch($this->sqlresult, $this->command['connect']); |
|
| 178 | - $this->pos++; |
|
| 179 | - $this->firstseek |= true; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * Avancer et retourner les donnees pour le nouvel element |
|
| 184 | - * |
|
| 185 | - * @return array|bool|null |
|
| 186 | - */ |
|
| 187 | - public function fetch() { |
|
| 188 | - if ($this->valid()) { |
|
| 189 | - $r = $this->current(); |
|
| 190 | - $this->next(); |
|
| 191 | - } else { |
|
| 192 | - $r = false; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - return $r; |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - /** |
|
| 199 | - * liberer les ressources |
|
| 200 | - * |
|
| 201 | - * @return bool |
|
| 202 | - */ |
|
| 203 | - public function free() { |
|
| 204 | - if (!$this->sqlresult) { |
|
| 205 | - return true; |
|
| 206 | - } |
|
| 207 | - $a = sql_free($this->sqlresult, $this->command['connect']); |
|
| 208 | - $this->sqlresult = null; |
|
| 209 | - |
|
| 210 | - return $a; |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - /** |
|
| 214 | - * Compter le nombre de resultats |
|
| 215 | - * |
|
| 216 | - * @return int |
|
| 217 | - */ |
|
| 218 | - public function count() { |
|
| 219 | - if (is_null($this->total)) { |
|
| 220 | - if (!$this->sqlresult) { |
|
| 221 | - $this->total = 0; |
|
| 222 | - } else { |
|
| 223 | - # cas count(*) |
|
| 224 | - if (in_array('count(*)', $this->command['select'])) { |
|
| 225 | - $this->valid(); |
|
| 226 | - $s = $this->current(); |
|
| 227 | - $this->total = $s['count(*)']; |
|
| 228 | - } else { |
|
| 229 | - $this->total = sql_count($this->sqlresult, $this->command['connect']); |
|
| 230 | - } |
|
| 231 | - } |
|
| 232 | - } |
|
| 233 | - |
|
| 234 | - return $this->total; |
|
| 235 | - } |
|
| 95 | + public function __construct($command, $info = []) { |
|
| 96 | + $this->type = 'SQL'; |
|
| 97 | + $this->command = $command; |
|
| 98 | + $this->info = $info; |
|
| 99 | + $this->select(); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * Rembobiner |
|
| 104 | + * |
|
| 105 | + * @return bool |
|
| 106 | + */ |
|
| 107 | + public function rewind(): void { |
|
| 108 | + if ($this->pos > 0) { |
|
| 109 | + $this->seek(0); |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Verifier l'etat de l'iterateur |
|
| 115 | + * |
|
| 116 | + * @return bool |
|
| 117 | + */ |
|
| 118 | + public function valid(): bool { |
|
| 119 | + if ($this->err) { |
|
| 120 | + return false; |
|
| 121 | + } |
|
| 122 | + if (!$this->firstseek) { |
|
| 123 | + $this->next(); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + return is_array($this->row); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * Valeurs sur la position courante |
|
| 131 | + * |
|
| 132 | + * @return array |
|
| 133 | + */ |
|
| 134 | + #[\ReturnTypeWillChange] |
|
| 135 | + public function current() { |
|
| 136 | + return $this->row; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + #[\ReturnTypeWillChange] |
|
| 140 | + public function key() { |
|
| 141 | + return $this->pos; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + /** |
|
| 145 | + * Sauter a une position absolue |
|
| 146 | + * |
|
| 147 | + * @param int $n |
|
| 148 | + * @param null|string $continue |
|
| 149 | + * @return bool |
|
| 150 | + */ |
|
| 151 | + public function seek($n = 0, $continue = null) { |
|
| 152 | + if (!sql_seek($this->sqlresult, $n, $this->command['connect'], $continue)) { |
|
| 153 | + // SQLite ne sait pas seek(), il faut relancer la query |
|
| 154 | + // si la position courante est apres la position visee |
|
| 155 | + // il faut relancer la requete |
|
| 156 | + if ($this->pos > $n) { |
|
| 157 | + $this->free(); |
|
| 158 | + $this->select(); |
|
| 159 | + $this->valid(); |
|
| 160 | + } |
|
| 161 | + // et utiliser la methode par defaut pour se deplacer au bon endroit |
|
| 162 | + // (sera fait en cas d'echec de cette fonction) |
|
| 163 | + return false; |
|
| 164 | + } |
|
| 165 | + $this->row = sql_fetch($this->sqlresult, $this->command['connect']); |
|
| 166 | + $this->pos = min($n, $this->count()); |
|
| 167 | + |
|
| 168 | + return true; |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * Avancer d'un cran |
|
| 173 | + * |
|
| 174 | + * @return void |
|
| 175 | + */ |
|
| 176 | + public function next(): void { |
|
| 177 | + $this->row = sql_fetch($this->sqlresult, $this->command['connect']); |
|
| 178 | + $this->pos++; |
|
| 179 | + $this->firstseek |= true; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * Avancer et retourner les donnees pour le nouvel element |
|
| 184 | + * |
|
| 185 | + * @return array|bool|null |
|
| 186 | + */ |
|
| 187 | + public function fetch() { |
|
| 188 | + if ($this->valid()) { |
|
| 189 | + $r = $this->current(); |
|
| 190 | + $this->next(); |
|
| 191 | + } else { |
|
| 192 | + $r = false; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + return $r; |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + /** |
|
| 199 | + * liberer les ressources |
|
| 200 | + * |
|
| 201 | + * @return bool |
|
| 202 | + */ |
|
| 203 | + public function free() { |
|
| 204 | + if (!$this->sqlresult) { |
|
| 205 | + return true; |
|
| 206 | + } |
|
| 207 | + $a = sql_free($this->sqlresult, $this->command['connect']); |
|
| 208 | + $this->sqlresult = null; |
|
| 209 | + |
|
| 210 | + return $a; |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + /** |
|
| 214 | + * Compter le nombre de resultats |
|
| 215 | + * |
|
| 216 | + * @return int |
|
| 217 | + */ |
|
| 218 | + public function count() { |
|
| 219 | + if (is_null($this->total)) { |
|
| 220 | + if (!$this->sqlresult) { |
|
| 221 | + $this->total = 0; |
|
| 222 | + } else { |
|
| 223 | + # cas count(*) |
|
| 224 | + if (in_array('count(*)', $this->command['select'])) { |
|
| 225 | + $this->valid(); |
|
| 226 | + $s = $this->current(); |
|
| 227 | + $this->total = $s['count(*)']; |
|
| 228 | + } else { |
|
| 229 | + $this->total = sql_count($this->sqlresult, $this->command['connect']); |
|
| 230 | + } |
|
| 231 | + } |
|
| 232 | + } |
|
| 233 | + |
|
| 234 | + return $this->total; |
|
| 235 | + } |
|
| 236 | 236 | } |