@@ -12,129 +12,129 @@ discard block |
||
| 12 | 12 | \***************************************************************************/ |
| 13 | 13 | |
| 14 | 14 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | // Decompilation de l'arbre de syntaxe abstraite d'un squelette SPIP |
| 19 | 19 | |
| 20 | 20 | function decompiler_boucle($struct, $fmt = '', $prof = 0) { |
| 21 | - $nom = $struct->id_boucle; |
|
| 22 | - $preaff = decompiler_($struct->preaff, $fmt, $prof); |
|
| 23 | - $avant = decompiler_($struct->avant, $fmt, $prof); |
|
| 24 | - $apres = decompiler_($struct->apres, $fmt, $prof); |
|
| 25 | - $altern = decompiler_($struct->altern, $fmt, $prof); |
|
| 26 | - $milieu = decompiler_($struct->milieu, $fmt, $prof); |
|
| 27 | - $postaff = decompiler_($struct->postaff, $fmt, $prof); |
|
| 28 | - |
|
| 29 | - $type = $struct->sql_serveur ? "$struct->sql_serveur:" : ''; |
|
| 30 | - $type .= ($struct->type_requete ?: $struct->type_table_optionnelle); |
|
| 31 | - |
|
| 32 | - if ($struct->jointures_explicites) { |
|
| 33 | - $type .= ' ' . $struct->jointures_explicites; |
|
| 34 | - } |
|
| 35 | - if ($struct->table_optionnelle) { |
|
| 36 | - $type .= '?'; |
|
| 37 | - } |
|
| 38 | - // Revoir le cas de la boucle recursive |
|
| 39 | - |
|
| 40 | - $crit = $struct->param; |
|
| 41 | - if ($crit && !is_array($crit[0])) { |
|
| 42 | - $type = strtolower($type) . array_shift($crit); |
|
| 43 | - } |
|
| 44 | - $crit = decompiler_criteres($struct, $fmt, $prof); |
|
| 45 | - |
|
| 46 | - $f = 'format_boucle_' . $fmt; |
|
| 47 | - |
|
| 48 | - return $f($preaff, $avant, $nom, $type, $crit, $milieu, $apres, $altern, $postaff, $prof); |
|
| 21 | + $nom = $struct->id_boucle; |
|
| 22 | + $preaff = decompiler_($struct->preaff, $fmt, $prof); |
|
| 23 | + $avant = decompiler_($struct->avant, $fmt, $prof); |
|
| 24 | + $apres = decompiler_($struct->apres, $fmt, $prof); |
|
| 25 | + $altern = decompiler_($struct->altern, $fmt, $prof); |
|
| 26 | + $milieu = decompiler_($struct->milieu, $fmt, $prof); |
|
| 27 | + $postaff = decompiler_($struct->postaff, $fmt, $prof); |
|
| 28 | + |
|
| 29 | + $type = $struct->sql_serveur ? "$struct->sql_serveur:" : ''; |
|
| 30 | + $type .= ($struct->type_requete ?: $struct->type_table_optionnelle); |
|
| 31 | + |
|
| 32 | + if ($struct->jointures_explicites) { |
|
| 33 | + $type .= ' ' . $struct->jointures_explicites; |
|
| 34 | + } |
|
| 35 | + if ($struct->table_optionnelle) { |
|
| 36 | + $type .= '?'; |
|
| 37 | + } |
|
| 38 | + // Revoir le cas de la boucle recursive |
|
| 39 | + |
|
| 40 | + $crit = $struct->param; |
|
| 41 | + if ($crit && !is_array($crit[0])) { |
|
| 42 | + $type = strtolower($type) . array_shift($crit); |
|
| 43 | + } |
|
| 44 | + $crit = decompiler_criteres($struct, $fmt, $prof); |
|
| 45 | + |
|
| 46 | + $f = 'format_boucle_' . $fmt; |
|
| 47 | + |
|
| 48 | + return $f($preaff, $avant, $nom, $type, $crit, $milieu, $apres, $altern, $postaff, $prof); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | function decompiler_include($struct, $fmt = '', $prof = 0) { |
| 52 | - $res = []; |
|
| 53 | - foreach ($struct->param ?: [] as $couple) { |
|
| 54 | - array_shift($couple); |
|
| 55 | - foreach ($couple as $v) { |
|
| 56 | - $res[] = decompiler_($v, $fmt, $prof); |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - $file = is_string($struct->texte) ? $struct->texte : |
|
| 60 | - decompiler_($struct->texte, $fmt, $prof); |
|
| 61 | - $f = 'format_inclure_' . $fmt; |
|
| 62 | - |
|
| 63 | - return $f($file, $res, $prof); |
|
| 52 | + $res = []; |
|
| 53 | + foreach ($struct->param ?: [] as $couple) { |
|
| 54 | + array_shift($couple); |
|
| 55 | + foreach ($couple as $v) { |
|
| 56 | + $res[] = decompiler_($v, $fmt, $prof); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + $file = is_string($struct->texte) ? $struct->texte : |
|
| 60 | + decompiler_($struct->texte, $fmt, $prof); |
|
| 61 | + $f = 'format_inclure_' . $fmt; |
|
| 62 | + |
|
| 63 | + return $f($file, $res, $prof); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | function decompiler_texte($struct, $fmt = '', $prof = 0) { |
| 67 | - $f = 'format_texte_' . $fmt; |
|
| 67 | + $f = 'format_texte_' . $fmt; |
|
| 68 | 68 | |
| 69 | - return strlen((string) $struct->texte) ? $f($struct->texte, $prof) : ''; |
|
| 69 | + return strlen((string) $struct->texte) ? $f($struct->texte, $prof) : ''; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | function decompiler_polyglotte($struct, $fmt = '', $prof = 0) { |
| 73 | - $f = 'format_polyglotte_' . $fmt; |
|
| 73 | + $f = 'format_polyglotte_' . $fmt; |
|
| 74 | 74 | |
| 75 | - return $f($struct->traductions, $prof); |
|
| 75 | + return $f($struct->traductions, $prof); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | function decompiler_idiome($struct, $fmt = '', $prof = 0) { |
| 79 | - $args = []; |
|
| 80 | - foreach ($struct->arg as $k => $v) { |
|
| 81 | - $args[$k] = public_decompiler($v, $fmt, $prof); |
|
| 82 | - } |
|
| 79 | + $args = []; |
|
| 80 | + foreach ($struct->arg as $k => $v) { |
|
| 81 | + $args[$k] = public_decompiler($v, $fmt, $prof); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - $filtres = decompiler_liste($struct->param, $fmt, $prof); |
|
| 84 | + $filtres = decompiler_liste($struct->param, $fmt, $prof); |
|
| 85 | 85 | |
| 86 | - $f = 'format_idiome_' . $fmt; |
|
| 86 | + $f = 'format_idiome_' . $fmt; |
|
| 87 | 87 | |
| 88 | - return $f($struct->nom_champ, $struct->module, $args, $filtres, $prof); |
|
| 88 | + return $f($struct->nom_champ, $struct->module, $args, $filtres, $prof); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | function decompiler_champ($struct, $fmt = '', $prof = 0) { |
| 92 | - $avant = decompiler_($struct->avant, $fmt, $prof); |
|
| 93 | - $apres = decompiler_($struct->apres, $fmt, $prof); |
|
| 94 | - $args = $filtres = ''; |
|
| 95 | - if ($p = $struct->param) { |
|
| 96 | - if ($p[0][0] === '') { |
|
| 97 | - $args = decompiler_liste([array_shift($p)], $fmt, $prof); |
|
| 98 | - } |
|
| 99 | - $filtres = decompiler_liste($p, $fmt, $prof); |
|
| 100 | - } |
|
| 101 | - $f = 'format_champ_' . $fmt; |
|
| 102 | - |
|
| 103 | - return $f($struct->nom_champ, $struct->nom_boucle, $struct->etoile, $avant, $apres, $args, $filtres, $prof); |
|
| 92 | + $avant = decompiler_($struct->avant, $fmt, $prof); |
|
| 93 | + $apres = decompiler_($struct->apres, $fmt, $prof); |
|
| 94 | + $args = $filtres = ''; |
|
| 95 | + if ($p = $struct->param) { |
|
| 96 | + if ($p[0][0] === '') { |
|
| 97 | + $args = decompiler_liste([array_shift($p)], $fmt, $prof); |
|
| 98 | + } |
|
| 99 | + $filtres = decompiler_liste($p, $fmt, $prof); |
|
| 100 | + } |
|
| 101 | + $f = 'format_champ_' . $fmt; |
|
| 102 | + |
|
| 103 | + return $f($struct->nom_champ, $struct->nom_boucle, $struct->etoile, $avant, $apres, $args, $filtres, $prof); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | function decompiler_liste($sources, $fmt = '', $prof = 0) { |
| 107 | - if (!is_array($sources)) { |
|
| 108 | - return ''; |
|
| 109 | - } |
|
| 110 | - $f = 'format_liste_' . $fmt; |
|
| 111 | - $res = ''; |
|
| 112 | - foreach ($sources as $arg) { |
|
| 113 | - if (!is_array($arg)) { |
|
| 114 | - continue; // ne devrait pas arriver. |
|
| 115 | - } else { |
|
| 116 | - $r = array_shift($arg); |
|
| 117 | - } |
|
| 118 | - $args = []; |
|
| 119 | - foreach ($arg as $v) { |
|
| 120 | - // cas des arguments entoures de ' ou " |
|
| 121 | - if ( |
|
| 122 | - (is_countable($v) ? count($v) : 0) == 1 |
|
| 123 | - && $v[0]->type == 'texte' |
|
| 124 | - && strlen((string) $v[0]->apres) == 1 |
|
| 125 | - && $v[0]->apres == $v[0]->avant |
|
| 126 | - ) { |
|
| 127 | - $args[] = $v[0]->avant . $v[0]->texte . $v[0]->apres; |
|
| 128 | - } else { |
|
| 129 | - $args[] = decompiler_($v, $fmt, 0 - $prof); |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - if ($r !== '' || $args) { |
|
| 133 | - $res .= $f($r, $args, $prof); |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - return $res; |
|
| 107 | + if (!is_array($sources)) { |
|
| 108 | + return ''; |
|
| 109 | + } |
|
| 110 | + $f = 'format_liste_' . $fmt; |
|
| 111 | + $res = ''; |
|
| 112 | + foreach ($sources as $arg) { |
|
| 113 | + if (!is_array($arg)) { |
|
| 114 | + continue; // ne devrait pas arriver. |
|
| 115 | + } else { |
|
| 116 | + $r = array_shift($arg); |
|
| 117 | + } |
|
| 118 | + $args = []; |
|
| 119 | + foreach ($arg as $v) { |
|
| 120 | + // cas des arguments entoures de ' ou " |
|
| 121 | + if ( |
|
| 122 | + (is_countable($v) ? count($v) : 0) == 1 |
|
| 123 | + && $v[0]->type == 'texte' |
|
| 124 | + && strlen((string) $v[0]->apres) == 1 |
|
| 125 | + && $v[0]->apres == $v[0]->avant |
|
| 126 | + ) { |
|
| 127 | + $args[] = $v[0]->avant . $v[0]->texte . $v[0]->apres; |
|
| 128 | + } else { |
|
| 129 | + $args[] = decompiler_($v, $fmt, 0 - $prof); |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + if ($r !== '' || $args) { |
|
| 133 | + $res .= $f($r, $args, $prof); |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + return $res; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | // Decompilation des criteres: on triche et on deroge: |
@@ -142,93 +142,93 @@ discard block |
||
| 142 | 142 | // - le champ apres signale le critere {"separateur"} ou {'separateur'} |
| 143 | 143 | // - les champs sont implicitement etendus (crochets implicites mais interdits) |
| 144 | 144 | function decompiler_criteres($boucle, $fmt = '', $prof = 0) { |
| 145 | - $sources = $boucle->param; |
|
| 146 | - if (!is_array($sources)) { |
|
| 147 | - return ''; |
|
| 148 | - } |
|
| 149 | - $res = ''; |
|
| 150 | - $f = 'format_critere_' . $fmt; |
|
| 151 | - foreach ($sources as $crit) { |
|
| 152 | - if (!is_array($crit)) { |
|
| 153 | - continue; |
|
| 154 | - } // boucle recursive |
|
| 155 | - array_shift($crit); |
|
| 156 | - $args = []; |
|
| 157 | - foreach ($crit as $i => $v) { |
|
| 158 | - if ( |
|
| 159 | - (is_countable($v) ? count($v) : 0) == 1 |
|
| 160 | - && $v[0]->type == 'texte' |
|
| 161 | - && $v[0]->apres |
|
| 162 | - ) { |
|
| 163 | - $args[] = [['texte', ($v[0]->apres . $v[0]->texte . $v[0]->apres)]]; |
|
| 164 | - } else { |
|
| 165 | - $res2 = []; |
|
| 166 | - foreach ($v as $k => $p) { |
|
| 167 | - if ( |
|
| 168 | - isset($p->type) |
|
| 169 | - && function_exists($d = 'decompiler_' . $p->type) |
|
| 170 | - ) { |
|
| 171 | - $r = $d($p, $fmt, (0 - $prof)); |
|
| 172 | - $res2[] = [$p->type, $r]; |
|
| 173 | - } else { |
|
| 174 | - spip_log("critere $i / $k mal forme"); |
|
| 175 | - } |
|
| 176 | - } |
|
| 177 | - $args[] = $res2; |
|
| 178 | - } |
|
| 179 | - } |
|
| 180 | - $res .= $f($args); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - return $res; |
|
| 145 | + $sources = $boucle->param; |
|
| 146 | + if (!is_array($sources)) { |
|
| 147 | + return ''; |
|
| 148 | + } |
|
| 149 | + $res = ''; |
|
| 150 | + $f = 'format_critere_' . $fmt; |
|
| 151 | + foreach ($sources as $crit) { |
|
| 152 | + if (!is_array($crit)) { |
|
| 153 | + continue; |
|
| 154 | + } // boucle recursive |
|
| 155 | + array_shift($crit); |
|
| 156 | + $args = []; |
|
| 157 | + foreach ($crit as $i => $v) { |
|
| 158 | + if ( |
|
| 159 | + (is_countable($v) ? count($v) : 0) == 1 |
|
| 160 | + && $v[0]->type == 'texte' |
|
| 161 | + && $v[0]->apres |
|
| 162 | + ) { |
|
| 163 | + $args[] = [['texte', ($v[0]->apres . $v[0]->texte . $v[0]->apres)]]; |
|
| 164 | + } else { |
|
| 165 | + $res2 = []; |
|
| 166 | + foreach ($v as $k => $p) { |
|
| 167 | + if ( |
|
| 168 | + isset($p->type) |
|
| 169 | + && function_exists($d = 'decompiler_' . $p->type) |
|
| 170 | + ) { |
|
| 171 | + $r = $d($p, $fmt, (0 - $prof)); |
|
| 172 | + $res2[] = [$p->type, $r]; |
|
| 173 | + } else { |
|
| 174 | + spip_log("critere $i / $k mal forme"); |
|
| 175 | + } |
|
| 176 | + } |
|
| 177 | + $args[] = $res2; |
|
| 178 | + } |
|
| 179 | + } |
|
| 180 | + $res .= $f($args); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + return $res; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | |
| 187 | 187 | function decompiler_($liste, $fmt = '', $prof = 0) { |
| 188 | - if (!is_array($liste)) { |
|
| 189 | - return ''; |
|
| 190 | - } |
|
| 191 | - $prof2 = ($prof < 0) ? ($prof - 1) : ($prof + 1); |
|
| 192 | - $contenu = []; |
|
| 193 | - foreach ($liste as $k => $p) { |
|
| 194 | - if (!isset($p->type)) { |
|
| 195 | - continue; |
|
| 196 | - } #?????? |
|
| 197 | - $d = 'decompiler_' . $p->type; |
|
| 198 | - $next = $liste[$k + 1] ?? false; |
|
| 199 | - // Forcer le champ etendu si son source (pas les reecritures) |
|
| 200 | - // contenait des args et s'il est suivi d'espaces, |
|
| 201 | - // le champ simple les eliminant est un bug helas perenne. |
|
| 202 | - |
|
| 203 | - if ( |
|
| 204 | - $next |
|
| 205 | - && $next->type == 'texte' |
|
| 206 | - && $p->type == 'champ' |
|
| 207 | - && !$p->apres |
|
| 208 | - && !$p->avant |
|
| 209 | - && $p->fonctions |
|
| 210 | - ) { |
|
| 211 | - $n = strlen((string) $next->texte) - strlen(ltrim((string) $next->texte)); |
|
| 212 | - if ($n) { |
|
| 213 | - $champ = new Texte(); |
|
| 214 | - $champ->texte = substr((string) $next->texte, 0, $n); |
|
| 215 | - $champ->ligne = $p->ligne; |
|
| 216 | - $p->apres = [$champ]; |
|
| 217 | - $next->texte = substr((string) $next->texte, $n); |
|
| 218 | - } |
|
| 219 | - } |
|
| 220 | - $contenu[] = [$d($p, $fmt, $prof2), $p->type]; |
|
| 221 | - } |
|
| 222 | - $f = 'format_suite_' . $fmt; |
|
| 223 | - |
|
| 224 | - return $f($contenu); |
|
| 188 | + if (!is_array($liste)) { |
|
| 189 | + return ''; |
|
| 190 | + } |
|
| 191 | + $prof2 = ($prof < 0) ? ($prof - 1) : ($prof + 1); |
|
| 192 | + $contenu = []; |
|
| 193 | + foreach ($liste as $k => $p) { |
|
| 194 | + if (!isset($p->type)) { |
|
| 195 | + continue; |
|
| 196 | + } #?????? |
|
| 197 | + $d = 'decompiler_' . $p->type; |
|
| 198 | + $next = $liste[$k + 1] ?? false; |
|
| 199 | + // Forcer le champ etendu si son source (pas les reecritures) |
|
| 200 | + // contenait des args et s'il est suivi d'espaces, |
|
| 201 | + // le champ simple les eliminant est un bug helas perenne. |
|
| 202 | + |
|
| 203 | + if ( |
|
| 204 | + $next |
|
| 205 | + && $next->type == 'texte' |
|
| 206 | + && $p->type == 'champ' |
|
| 207 | + && !$p->apres |
|
| 208 | + && !$p->avant |
|
| 209 | + && $p->fonctions |
|
| 210 | + ) { |
|
| 211 | + $n = strlen((string) $next->texte) - strlen(ltrim((string) $next->texte)); |
|
| 212 | + if ($n) { |
|
| 213 | + $champ = new Texte(); |
|
| 214 | + $champ->texte = substr((string) $next->texte, 0, $n); |
|
| 215 | + $champ->ligne = $p->ligne; |
|
| 216 | + $p->apres = [$champ]; |
|
| 217 | + $next->texte = substr((string) $next->texte, $n); |
|
| 218 | + } |
|
| 219 | + } |
|
| 220 | + $contenu[] = [$d($p, $fmt, $prof2), $p->type]; |
|
| 221 | + } |
|
| 222 | + $f = 'format_suite_' . $fmt; |
|
| 223 | + |
|
| 224 | + return $f($contenu); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | function public_decompiler($liste, $fmt = '', $prof = 0, $quoi = '') { |
| 228 | - if (!include_spip('public/format_' . $fmt)) { |
|
| 229 | - return "'$fmt'?"; |
|
| 230 | - } |
|
| 231 | - $f = 'decompiler_' . $quoi; |
|
| 228 | + if (!include_spip('public/format_' . $fmt)) { |
|
| 229 | + return "'$fmt'?"; |
|
| 230 | + } |
|
| 231 | + $f = 'decompiler_' . $quoi; |
|
| 232 | 232 | |
| 233 | - return $f($liste, $fmt, $prof); |
|
| 233 | + return $f($liste, $fmt, $prof); |
|
| 234 | 234 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_fichiers_fonctions(); |
@@ -29,178 +29,178 @@ discard block |
||
| 29 | 29 | # En cas d'erreur process_ins est absent et texte est un tableau de 2 chaines |
| 30 | 30 | |
| 31 | 31 | function public_parametrer_dist($fond, $contexte = '', $cache = '', string $connect = '') { |
| 32 | - static $composer, $styliser, $notes = null; |
|
| 33 | - $courant = null; |
|
| 34 | - $page = tester_redirection($fond, $contexte, $connect); |
|
| 35 | - if ($page) { |
|
| 36 | - return $page; |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - if (isset($contexte['lang'])) { |
|
| 40 | - $lang = $contexte['lang']; |
|
| 41 | - } elseif (!isset($lang)) { |
|
| 42 | - $lang = $GLOBALS['meta']['langue_site']; |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - $select = ((!isset($GLOBALS['forcer_lang']) || !$GLOBALS['forcer_lang']) && $lang != $GLOBALS['spip_lang']); |
|
| 46 | - if ($select) { |
|
| 47 | - $select = lang_select($lang); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - $debug = (defined('_VAR_MODE') && _VAR_MODE == 'debug'); |
|
| 51 | - |
|
| 52 | - if (!$styliser) { |
|
| 53 | - $styliser = charger_fonction('styliser', 'public'); |
|
| 54 | - } |
|
| 55 | - [$skel, $mime_type, $gram, $sourcefile] = |
|
| 56 | - $styliser($fond, $contexte, $GLOBALS['spip_lang'], $connect); |
|
| 57 | - |
|
| 58 | - if ($skel) { |
|
| 59 | - // sauver le nom de l'eventuel squelette en cours d'execution |
|
| 60 | - // (recursion possible a cause des modeles) |
|
| 61 | - if ($debug) { |
|
| 62 | - $courant = $GLOBALS['debug_objets']['courant'] ?? null; |
|
| 63 | - $GLOBALS['debug_objets']['contexte'][$sourcefile] = $contexte; |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - // charger le squelette en specifiant les langages cibles et source |
|
| 67 | - // au cas il faudrait le compiler (source posterieure au resultat) |
|
| 68 | - |
|
| 69 | - if (!$composer) { |
|
| 70 | - $composer = charger_fonction('composer', 'public'); |
|
| 71 | - } |
|
| 72 | - $fonc = $composer($skel, $mime_type, $gram, $sourcefile, $connect); |
|
| 73 | - } else { |
|
| 74 | - $fonc = ''; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - if (!$fonc) { // squelette inconnu (==='') ou faux (===false) |
|
| 78 | - $page = $fonc; |
|
| 79 | - } else { |
|
| 80 | - // Preparer l'appel de la fonction principale du squelette |
|
| 81 | - |
|
| 82 | - spip_timer($a = 'calcul page ' . random_int(0, 1000)); |
|
| 83 | - |
|
| 84 | - // On cree un marqueur de notes unique lie a cette composition |
|
| 85 | - // et on enregistre l'etat courant des globales de notes... |
|
| 86 | - if (is_null($notes)) { |
|
| 87 | - $notes = charger_fonction('notes', 'inc', true); |
|
| 88 | - } |
|
| 89 | - if ($notes) { |
|
| 90 | - $notes('', 'empiler'); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - // Rajouter d'office ces deux parametres |
|
| 94 | - // (mais vaudrait mieux que le compilateur sache le simuler |
|
| 95 | - // car ca interdit l'usage de criteres conditionnels dessus). |
|
| 96 | - if (!isset($contexte['date'])) { |
|
| 97 | - $contexte['date'] = date('Y-m-d H:i:s'); |
|
| 98 | - $contexte['date_default'] = true; |
|
| 99 | - } else { |
|
| 100 | - $contexte['date'] = normaliser_date($contexte['date'], true); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - if (!isset($contexte['date_redac'])) { |
|
| 104 | - $contexte['date_redac'] = date('Y-m-d H:i:s'); |
|
| 105 | - $contexte['date_redac_default'] = true; |
|
| 106 | - } else { |
|
| 107 | - $contexte['date_redac'] = normaliser_date($contexte['date_redac'], true); |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - // Passer le nom du cache pour produire sa destruction automatique |
|
| 111 | - try { |
|
| 112 | - $page = $fonc(['cache' => $cache], [$contexte]); |
|
| 113 | - } catch (Throwable $e) { |
|
| 114 | - $msg = _T('zbug_erreur_execution_page') . " $sourcefile"; |
|
| 115 | - $full_msg = $msg . ' | File ' . $e->getFile() . ' Line ' . $e->getLine() . ' : ' . $e->getMessage(); |
|
| 116 | - $full_msg = str_replace(_ROOT_RACINE, '[…]/', $full_msg); |
|
| 117 | - $corps = "<pre>$msg</pre>"; |
|
| 118 | - $page = analyse_resultat_skel($fond, ['cache' => $cache], $corps, $sourcefile); |
|
| 119 | - erreur_squelette($full_msg); |
|
| 120 | - unset($msg, $full_msg, $corps); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - // Restituer les globales de notes telles qu'elles etaient avant l'appel |
|
| 124 | - // Si l'inclus n'a pas affiche ses notes, tant pis (elles *doivent* |
|
| 125 | - // etre dans son resultat, autrement elles ne seraient pas prises en |
|
| 126 | - // compte a chaque calcul d'un texte contenant un modele, mais seulement |
|
| 127 | - // quand le modele serait calcule, et on aurait des resultats incoherents) |
|
| 128 | - if ($notes) { |
|
| 129 | - $notes('', 'depiler'); |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - // reinjecter en dynamique la pile des notes |
|
| 133 | - // si il y a des inclure dynamiques |
|
| 134 | - // si la pile n'est pas vide |
|
| 135 | - // la generalisation de cette injection permettrait de corriger le point juste au dessus |
|
| 136 | - // en faisant remonter les notes a l'incluant (A tester et valider avant application) |
|
| 137 | - if ($notes) { |
|
| 138 | - $page['notes'] = $notes('', 'sauver_etat'); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - // spip_log: un joli contexte |
|
| 142 | - $infos = presenter_contexte(array_filter($contexte)); |
|
| 143 | - |
|
| 144 | - $profile = spip_timer($a); |
|
| 145 | - spip_log("calcul ($profile) [$skel] $infos" |
|
| 146 | - . ' (' . strlen((string) $page['texte']) . ' octets)'); |
|
| 147 | - |
|
| 148 | - if (defined('_CALCUL_PROFILER') && (int) $profile > _CALCUL_PROFILER) { |
|
| 149 | - spip_log("calcul ($profile) [$skel] $infos" |
|
| 150 | - . ' (' . strlen((string) $page['texte']) . ' octets) | ' . $_SERVER['REQUEST_URI'], 'profiler' . _LOG_AVERTISSEMENT); |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - if ($debug) { |
|
| 154 | - // si c'est ce que demande le debusqueur, lui passer la main |
|
| 155 | - $t = strlen((string) $page['texte']) ? $page['texte'] : ' '; |
|
| 156 | - $GLOBALS['debug_objets']['resultat'][$fonc . 'tout'] = $t; |
|
| 157 | - $GLOBALS['debug_objets']['courant'] = $courant; |
|
| 158 | - $GLOBALS['debug_objets']['profile'][$sourcefile] = $profile; |
|
| 159 | - if ( |
|
| 160 | - $GLOBALS['debug_objets']['sourcefile'] |
|
| 161 | - && _request('var_mode_objet') == $fonc |
|
| 162 | - && _request('var_mode_affiche') == 'resultat' |
|
| 163 | - ) { |
|
| 164 | - erreur_squelette(); |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - // Si #CACHE{} n'etait pas la, le mettre a $delais |
|
| 168 | - if (!isset($page['entetes']['X-Spip-Cache'])) { |
|
| 169 | - // Dans l'espace prive ou dans un modeles/ on pose un cache 0 par defaut |
|
| 170 | - // si aucun #CACHE{} spécifié |
|
| 171 | - // le contexte implicite qui conditionne le cache assure qu'on retombe pas sur le meme |
|
| 172 | - // entre public et prive |
|
| 173 | - if (test_espace_prive() || str_starts_with((string) $fond, 'modeles/')) { |
|
| 174 | - $page['entetes']['X-Spip-Cache'] = 0; |
|
| 175 | - } else { |
|
| 176 | - $page['entetes']['X-Spip-Cache'] = $GLOBALS['delais'] ?? 36000; |
|
| 177 | - } |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - $page['contexte'] = $contexte; |
|
| 181 | - |
|
| 182 | - // faire remonter le fichier source |
|
| 183 | - static $js_inclus = false; |
|
| 184 | - if (defined('_VAR_INCLURE') && _VAR_INCLURE) { |
|
| 185 | - $page['sourcefile'] = $sourcefile; |
|
| 186 | - $page['texte'] = |
|
| 187 | - "<div class='inclure_blocs'><h6>" . $page['sourcefile'] . '</h6>' . $page['texte'] . '</div>' |
|
| 188 | - . ($js_inclus ? '' : "<script type='text/javascript'>jQuery(function(){jQuery('.inclure_blocs > h6:first-child').hover(function(){jQuery(this).parent().addClass('hover')},function(){jQuery(this).parent().removeClass('hover')})});</script>"); |
|
| 189 | - $js_inclus = true; |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - // Si un modele contenait #SESSION, on note l'info dans $page |
|
| 193 | - if (isset($GLOBALS['cache_utilise_session'])) { |
|
| 194 | - $page['invalideurs']['session'] = $GLOBALS['cache_utilise_session']; |
|
| 195 | - unset($GLOBALS['cache_utilise_session']); |
|
| 196 | - } |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - if ($select) { |
|
| 200 | - lang_select(); |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - return $page; |
|
| 32 | + static $composer, $styliser, $notes = null; |
|
| 33 | + $courant = null; |
|
| 34 | + $page = tester_redirection($fond, $contexte, $connect); |
|
| 35 | + if ($page) { |
|
| 36 | + return $page; |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + if (isset($contexte['lang'])) { |
|
| 40 | + $lang = $contexte['lang']; |
|
| 41 | + } elseif (!isset($lang)) { |
|
| 42 | + $lang = $GLOBALS['meta']['langue_site']; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + $select = ((!isset($GLOBALS['forcer_lang']) || !$GLOBALS['forcer_lang']) && $lang != $GLOBALS['spip_lang']); |
|
| 46 | + if ($select) { |
|
| 47 | + $select = lang_select($lang); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + $debug = (defined('_VAR_MODE') && _VAR_MODE == 'debug'); |
|
| 51 | + |
|
| 52 | + if (!$styliser) { |
|
| 53 | + $styliser = charger_fonction('styliser', 'public'); |
|
| 54 | + } |
|
| 55 | + [$skel, $mime_type, $gram, $sourcefile] = |
|
| 56 | + $styliser($fond, $contexte, $GLOBALS['spip_lang'], $connect); |
|
| 57 | + |
|
| 58 | + if ($skel) { |
|
| 59 | + // sauver le nom de l'eventuel squelette en cours d'execution |
|
| 60 | + // (recursion possible a cause des modeles) |
|
| 61 | + if ($debug) { |
|
| 62 | + $courant = $GLOBALS['debug_objets']['courant'] ?? null; |
|
| 63 | + $GLOBALS['debug_objets']['contexte'][$sourcefile] = $contexte; |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + // charger le squelette en specifiant les langages cibles et source |
|
| 67 | + // au cas il faudrait le compiler (source posterieure au resultat) |
|
| 68 | + |
|
| 69 | + if (!$composer) { |
|
| 70 | + $composer = charger_fonction('composer', 'public'); |
|
| 71 | + } |
|
| 72 | + $fonc = $composer($skel, $mime_type, $gram, $sourcefile, $connect); |
|
| 73 | + } else { |
|
| 74 | + $fonc = ''; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + if (!$fonc) { // squelette inconnu (==='') ou faux (===false) |
|
| 78 | + $page = $fonc; |
|
| 79 | + } else { |
|
| 80 | + // Preparer l'appel de la fonction principale du squelette |
|
| 81 | + |
|
| 82 | + spip_timer($a = 'calcul page ' . random_int(0, 1000)); |
|
| 83 | + |
|
| 84 | + // On cree un marqueur de notes unique lie a cette composition |
|
| 85 | + // et on enregistre l'etat courant des globales de notes... |
|
| 86 | + if (is_null($notes)) { |
|
| 87 | + $notes = charger_fonction('notes', 'inc', true); |
|
| 88 | + } |
|
| 89 | + if ($notes) { |
|
| 90 | + $notes('', 'empiler'); |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + // Rajouter d'office ces deux parametres |
|
| 94 | + // (mais vaudrait mieux que le compilateur sache le simuler |
|
| 95 | + // car ca interdit l'usage de criteres conditionnels dessus). |
|
| 96 | + if (!isset($contexte['date'])) { |
|
| 97 | + $contexte['date'] = date('Y-m-d H:i:s'); |
|
| 98 | + $contexte['date_default'] = true; |
|
| 99 | + } else { |
|
| 100 | + $contexte['date'] = normaliser_date($contexte['date'], true); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + if (!isset($contexte['date_redac'])) { |
|
| 104 | + $contexte['date_redac'] = date('Y-m-d H:i:s'); |
|
| 105 | + $contexte['date_redac_default'] = true; |
|
| 106 | + } else { |
|
| 107 | + $contexte['date_redac'] = normaliser_date($contexte['date_redac'], true); |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + // Passer le nom du cache pour produire sa destruction automatique |
|
| 111 | + try { |
|
| 112 | + $page = $fonc(['cache' => $cache], [$contexte]); |
|
| 113 | + } catch (Throwable $e) { |
|
| 114 | + $msg = _T('zbug_erreur_execution_page') . " $sourcefile"; |
|
| 115 | + $full_msg = $msg . ' | File ' . $e->getFile() . ' Line ' . $e->getLine() . ' : ' . $e->getMessage(); |
|
| 116 | + $full_msg = str_replace(_ROOT_RACINE, '[…]/', $full_msg); |
|
| 117 | + $corps = "<pre>$msg</pre>"; |
|
| 118 | + $page = analyse_resultat_skel($fond, ['cache' => $cache], $corps, $sourcefile); |
|
| 119 | + erreur_squelette($full_msg); |
|
| 120 | + unset($msg, $full_msg, $corps); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + // Restituer les globales de notes telles qu'elles etaient avant l'appel |
|
| 124 | + // Si l'inclus n'a pas affiche ses notes, tant pis (elles *doivent* |
|
| 125 | + // etre dans son resultat, autrement elles ne seraient pas prises en |
|
| 126 | + // compte a chaque calcul d'un texte contenant un modele, mais seulement |
|
| 127 | + // quand le modele serait calcule, et on aurait des resultats incoherents) |
|
| 128 | + if ($notes) { |
|
| 129 | + $notes('', 'depiler'); |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + // reinjecter en dynamique la pile des notes |
|
| 133 | + // si il y a des inclure dynamiques |
|
| 134 | + // si la pile n'est pas vide |
|
| 135 | + // la generalisation de cette injection permettrait de corriger le point juste au dessus |
|
| 136 | + // en faisant remonter les notes a l'incluant (A tester et valider avant application) |
|
| 137 | + if ($notes) { |
|
| 138 | + $page['notes'] = $notes('', 'sauver_etat'); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + // spip_log: un joli contexte |
|
| 142 | + $infos = presenter_contexte(array_filter($contexte)); |
|
| 143 | + |
|
| 144 | + $profile = spip_timer($a); |
|
| 145 | + spip_log("calcul ($profile) [$skel] $infos" |
|
| 146 | + . ' (' . strlen((string) $page['texte']) . ' octets)'); |
|
| 147 | + |
|
| 148 | + if (defined('_CALCUL_PROFILER') && (int) $profile > _CALCUL_PROFILER) { |
|
| 149 | + spip_log("calcul ($profile) [$skel] $infos" |
|
| 150 | + . ' (' . strlen((string) $page['texte']) . ' octets) | ' . $_SERVER['REQUEST_URI'], 'profiler' . _LOG_AVERTISSEMENT); |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + if ($debug) { |
|
| 154 | + // si c'est ce que demande le debusqueur, lui passer la main |
|
| 155 | + $t = strlen((string) $page['texte']) ? $page['texte'] : ' '; |
|
| 156 | + $GLOBALS['debug_objets']['resultat'][$fonc . 'tout'] = $t; |
|
| 157 | + $GLOBALS['debug_objets']['courant'] = $courant; |
|
| 158 | + $GLOBALS['debug_objets']['profile'][$sourcefile] = $profile; |
|
| 159 | + if ( |
|
| 160 | + $GLOBALS['debug_objets']['sourcefile'] |
|
| 161 | + && _request('var_mode_objet') == $fonc |
|
| 162 | + && _request('var_mode_affiche') == 'resultat' |
|
| 163 | + ) { |
|
| 164 | + erreur_squelette(); |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + // Si #CACHE{} n'etait pas la, le mettre a $delais |
|
| 168 | + if (!isset($page['entetes']['X-Spip-Cache'])) { |
|
| 169 | + // Dans l'espace prive ou dans un modeles/ on pose un cache 0 par defaut |
|
| 170 | + // si aucun #CACHE{} spécifié |
|
| 171 | + // le contexte implicite qui conditionne le cache assure qu'on retombe pas sur le meme |
|
| 172 | + // entre public et prive |
|
| 173 | + if (test_espace_prive() || str_starts_with((string) $fond, 'modeles/')) { |
|
| 174 | + $page['entetes']['X-Spip-Cache'] = 0; |
|
| 175 | + } else { |
|
| 176 | + $page['entetes']['X-Spip-Cache'] = $GLOBALS['delais'] ?? 36000; |
|
| 177 | + } |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + $page['contexte'] = $contexte; |
|
| 181 | + |
|
| 182 | + // faire remonter le fichier source |
|
| 183 | + static $js_inclus = false; |
|
| 184 | + if (defined('_VAR_INCLURE') && _VAR_INCLURE) { |
|
| 185 | + $page['sourcefile'] = $sourcefile; |
|
| 186 | + $page['texte'] = |
|
| 187 | + "<div class='inclure_blocs'><h6>" . $page['sourcefile'] . '</h6>' . $page['texte'] . '</div>' |
|
| 188 | + . ($js_inclus ? '' : "<script type='text/javascript'>jQuery(function(){jQuery('.inclure_blocs > h6:first-child').hover(function(){jQuery(this).parent().addClass('hover')},function(){jQuery(this).parent().removeClass('hover')})});</script>"); |
|
| 189 | + $js_inclus = true; |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + // Si un modele contenait #SESSION, on note l'info dans $page |
|
| 193 | + if (isset($GLOBALS['cache_utilise_session'])) { |
|
| 194 | + $page['invalideurs']['session'] = $GLOBALS['cache_utilise_session']; |
|
| 195 | + unset($GLOBALS['cache_utilise_session']); |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + if ($select) { |
|
| 200 | + lang_select(); |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + return $page; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -209,37 +209,37 @@ discard block |
||
| 209 | 209 | * @return string |
| 210 | 210 | */ |
| 211 | 211 | function presenter_contexte($contexte, $profondeur_max = 1, $max_lines = 0) { |
| 212 | - $infos = []; |
|
| 213 | - $line = 0; |
|
| 214 | - foreach ($contexte as $var => $val) { |
|
| 215 | - $line++; |
|
| 216 | - if ($max_lines && $max_lines < $line) { |
|
| 217 | - $infos[] = '…'; |
|
| 218 | - break; |
|
| 219 | - } |
|
| 220 | - if ($val === null) { |
|
| 221 | - $val = ''; |
|
| 222 | - } elseif (is_array($val)) { |
|
| 223 | - if ($profondeur_max > 0) { |
|
| 224 | - $val = 'array:' . count($val) . '(' . presenter_contexte($val, $profondeur_max - 1, 3) . ')'; |
|
| 225 | - } else { |
|
| 226 | - $val = 'array:' . count($val); |
|
| 227 | - } |
|
| 228 | - } elseif (is_object($val)) { |
|
| 229 | - $val = $val::class; |
|
| 230 | - } elseif (strlen("$val") > 30) { |
|
| 231 | - $val = substr("$val", 0, 29) . '…'; |
|
| 232 | - if (strstr($val, ' ')) { |
|
| 233 | - $val = "'$val'"; |
|
| 234 | - } |
|
| 235 | - } elseif (strstr((string) $val, ' ')) { |
|
| 236 | - $val = "'$val'"; |
|
| 237 | - } elseif (!strlen((string) $val)) { |
|
| 238 | - $val = "''"; |
|
| 239 | - } |
|
| 240 | - $infos[] = $var . '=' . $val; |
|
| 241 | - } |
|
| 242 | - return implode(', ', $infos); |
|
| 212 | + $infos = []; |
|
| 213 | + $line = 0; |
|
| 214 | + foreach ($contexte as $var => $val) { |
|
| 215 | + $line++; |
|
| 216 | + if ($max_lines && $max_lines < $line) { |
|
| 217 | + $infos[] = '…'; |
|
| 218 | + break; |
|
| 219 | + } |
|
| 220 | + if ($val === null) { |
|
| 221 | + $val = ''; |
|
| 222 | + } elseif (is_array($val)) { |
|
| 223 | + if ($profondeur_max > 0) { |
|
| 224 | + $val = 'array:' . count($val) . '(' . presenter_contexte($val, $profondeur_max - 1, 3) . ')'; |
|
| 225 | + } else { |
|
| 226 | + $val = 'array:' . count($val); |
|
| 227 | + } |
|
| 228 | + } elseif (is_object($val)) { |
|
| 229 | + $val = $val::class; |
|
| 230 | + } elseif (strlen("$val") > 30) { |
|
| 231 | + $val = substr("$val", 0, 29) . '…'; |
|
| 232 | + if (strstr($val, ' ')) { |
|
| 233 | + $val = "'$val'"; |
|
| 234 | + } |
|
| 235 | + } elseif (strstr((string) $val, ' ')) { |
|
| 236 | + $val = "'$val'"; |
|
| 237 | + } elseif (!strlen((string) $val)) { |
|
| 238 | + $val = "''"; |
|
| 239 | + } |
|
| 240 | + $infos[] = $var . '=' . $val; |
|
| 241 | + } |
|
| 242 | + return implode(', ', $infos); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | |
@@ -256,11 +256,11 @@ discard block |
||
| 256 | 256 | * @return array|bool |
| 257 | 257 | */ |
| 258 | 258 | function tester_redirection($fond, $contexte, $connect) { |
| 259 | - static $tester_redirection = null; |
|
| 260 | - if (is_null($tester_redirection)) { |
|
| 261 | - $tester_redirection = charger_fonction('tester_redirection', 'public'); |
|
| 262 | - } |
|
| 263 | - return $tester_redirection($fond, $contexte, $connect); |
|
| 259 | + static $tester_redirection = null; |
|
| 260 | + if (is_null($tester_redirection)) { |
|
| 261 | + $tester_redirection = charger_fonction('tester_redirection', 'public'); |
|
| 262 | + } |
|
| 263 | + return $tester_redirection($fond, $contexte, $connect); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
@@ -276,42 +276,42 @@ discard block |
||
| 276 | 276 | * @return array|bool |
| 277 | 277 | */ |
| 278 | 278 | function public_tester_redirection_dist($fond, $contexte, $connect) { |
| 279 | - if ( |
|
| 280 | - $fond == 'article' |
|
| 281 | - && !empty($contexte['id_article']) |
|
| 282 | - && ($id_article = (int) $contexte['id_article']) |
|
| 283 | - ) { |
|
| 284 | - include_spip('public/quete'); // pour quete_virtuel et ses dependances |
|
| 285 | - $m = quete_virtuel($id_article, $connect) ?? ''; |
|
| 286 | - if (strlen($m)) { |
|
| 287 | - include_spip('inc/texte'); |
|
| 288 | - // les navigateurs pataugent si l'URL est vide |
|
| 289 | - if ($url = virtuel_redirige($m, true)) { |
|
| 290 | - // passer en url absolue car cette redirection pourra |
|
| 291 | - // etre utilisee dans un contexte d'url qui change |
|
| 292 | - // y compris url arbo |
|
| 293 | - $status = 302; |
|
| 294 | - if (defined('_STATUS_REDIRECTION_VIRTUEL')) { |
|
| 295 | - $status = _STATUS_REDIRECTION_VIRTUEL; |
|
| 296 | - } |
|
| 297 | - if (!preg_match(',^\w+:,', (string) $url)) { |
|
| 298 | - include_spip('inc/filtres_mini'); |
|
| 299 | - $url = url_absolue($url); |
|
| 300 | - } |
|
| 301 | - $url = str_replace('&', '&', (string) $url); |
|
| 302 | - |
|
| 303 | - return [ |
|
| 304 | - 'texte' => '<' |
|
| 305 | - . "?php include_spip('inc/headers');redirige_par_entete('" |
|
| 306 | - . texte_script($url) |
|
| 307 | - . "','',$status);" |
|
| 308 | - . '?' . '>', |
|
| 309 | - 'process_ins' => 'php', |
|
| 310 | - 'status' => $status |
|
| 311 | - ]; |
|
| 312 | - } |
|
| 313 | - } |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - return false; |
|
| 279 | + if ( |
|
| 280 | + $fond == 'article' |
|
| 281 | + && !empty($contexte['id_article']) |
|
| 282 | + && ($id_article = (int) $contexte['id_article']) |
|
| 283 | + ) { |
|
| 284 | + include_spip('public/quete'); // pour quete_virtuel et ses dependances |
|
| 285 | + $m = quete_virtuel($id_article, $connect) ?? ''; |
|
| 286 | + if (strlen($m)) { |
|
| 287 | + include_spip('inc/texte'); |
|
| 288 | + // les navigateurs pataugent si l'URL est vide |
|
| 289 | + if ($url = virtuel_redirige($m, true)) { |
|
| 290 | + // passer en url absolue car cette redirection pourra |
|
| 291 | + // etre utilisee dans un contexte d'url qui change |
|
| 292 | + // y compris url arbo |
|
| 293 | + $status = 302; |
|
| 294 | + if (defined('_STATUS_REDIRECTION_VIRTUEL')) { |
|
| 295 | + $status = _STATUS_REDIRECTION_VIRTUEL; |
|
| 296 | + } |
|
| 297 | + if (!preg_match(',^\w+:,', (string) $url)) { |
|
| 298 | + include_spip('inc/filtres_mini'); |
|
| 299 | + $url = url_absolue($url); |
|
| 300 | + } |
|
| 301 | + $url = str_replace('&', '&', (string) $url); |
|
| 302 | + |
|
| 303 | + return [ |
|
| 304 | + 'texte' => '<' |
|
| 305 | + . "?php include_spip('inc/headers');redirige_par_entete('" |
|
| 306 | + . texte_script($url) |
|
| 307 | + . "','',$status);" |
|
| 308 | + . '?' . '>', |
|
| 309 | + 'process_ins' => 'php', |
|
| 310 | + 'status' => $status |
|
| 311 | + ]; |
|
| 312 | + } |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + return false; |
|
| 317 | 317 | } |
@@ -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 | /** Repérer un code ne calculant rien, meme avec commentaire */ |
@@ -61,92 +61,92 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | function argumenter_inclure( |
| 64 | - $params, |
|
| 65 | - $rejet_filtres, |
|
| 66 | - $p, |
|
| 67 | - &$boucles, |
|
| 68 | - $id_boucle, |
|
| 69 | - $echap = true, |
|
| 70 | - $lang = '', |
|
| 71 | - $fond1 = false |
|
| 64 | + $params, |
|
| 65 | + $rejet_filtres, |
|
| 66 | + $p, |
|
| 67 | + &$boucles, |
|
| 68 | + $id_boucle, |
|
| 69 | + $echap = true, |
|
| 70 | + $lang = '', |
|
| 71 | + $fond1 = false |
|
| 72 | 72 | ) { |
| 73 | - $l = []; |
|
| 74 | - $erreur_p_i_i = ''; |
|
| 75 | - if (!is_array($params)) { |
|
| 76 | - return $l; |
|
| 77 | - } |
|
| 78 | - foreach ($params as $k => $couple) { |
|
| 79 | - // la liste d'arguments d'inclusion peut se terminer par un filtre |
|
| 80 | - $filtre = array_shift($couple); |
|
| 81 | - if ($filtre) { |
|
| 82 | - break; |
|
| 83 | - } |
|
| 84 | - foreach ($couple as $n => $val) { |
|
| 85 | - $var = $val[0]; |
|
| 86 | - if ($var->type != 'texte') { |
|
| 87 | - if ($n || $k || $fond1) { |
|
| 88 | - $erreur_p_i_i = [ |
|
| 89 | - 'zbug_parametres_inclus_incorrects', |
|
| 90 | - ['param' => $var->nom_champ] |
|
| 91 | - ]; |
|
| 92 | - erreur_squelette($erreur_p_i_i, $p); |
|
| 93 | - break; |
|
| 94 | - } else { |
|
| 95 | - $l[1] = calculer_liste($val, $p->descr, $boucles, $id_boucle); |
|
| 96 | - } |
|
| 97 | - } else { |
|
| 98 | - preg_match(',^([^=]*)(=?)(.*)$,m', $var->texte, $m); |
|
| 99 | - $m = array_pad($m, 3, null); |
|
| 100 | - $var = $m[1]; |
|
| 101 | - $auto = false; |
|
| 102 | - |
|
| 103 | - if ($m[2]) { |
|
| 104 | - $v = $m[3]; |
|
| 105 | - if (preg_match(',^[\'"](.*)[\'"]$,', $v, $m)) { |
|
| 106 | - $v = $m[1]; |
|
| 107 | - } |
|
| 108 | - $val[0] = new Texte(); |
|
| 109 | - $val[0]->texte = $v; |
|
| 110 | - } elseif ($k || $n || $fond1) { |
|
| 111 | - $auto = true; |
|
| 112 | - } else { |
|
| 113 | - $var = 1; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - if ($var == 'lang') { |
|
| 117 | - $lang = !$auto |
|
| 118 | - ? calculer_liste($val, $p->descr, $boucles, $id_boucle) |
|
| 119 | - : '$GLOBALS["spip_lang"]'; |
|
| 120 | - } else { |
|
| 121 | - $val = $auto |
|
| 122 | - ? index_pile($id_boucle, $var, $boucles) |
|
| 123 | - : calculer_liste($val, $p->descr, $boucles, $id_boucle); |
|
| 124 | - if ($var !== 1) { |
|
| 125 | - $val = ($echap ? "\'$var\' => ' . argumenter_squelette(" : "'$var' => ") |
|
| 126 | - . $val . ($echap ? ") . '" : ' '); |
|
| 127 | - } else { |
|
| 128 | - $val = $echap ? "'.$val.'" : $val; |
|
| 129 | - } |
|
| 130 | - $l[$var] = $val; |
|
| 131 | - } |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - if ($erreur_p_i_i) { |
|
| 136 | - return false; |
|
| 137 | - } |
|
| 138 | - // Cas particulier de la langue : si {lang=xx} est definie, on |
|
| 139 | - // la passe, sinon on passe la langue courante au moment du calcul |
|
| 140 | - // sauf si on n'en veut pas |
|
| 141 | - if ($lang === false) { |
|
| 142 | - return $l; |
|
| 143 | - } |
|
| 144 | - if (!$lang) { |
|
| 145 | - $lang = '$GLOBALS["spip_lang"]'; |
|
| 146 | - } |
|
| 147 | - $l['lang'] = ($echap ? "\'lang\' => ' . argumenter_squelette(" : "'lang' => ") . $lang . ($echap ? ") . '" : ' '); |
|
| 148 | - |
|
| 149 | - return $l; |
|
| 73 | + $l = []; |
|
| 74 | + $erreur_p_i_i = ''; |
|
| 75 | + if (!is_array($params)) { |
|
| 76 | + return $l; |
|
| 77 | + } |
|
| 78 | + foreach ($params as $k => $couple) { |
|
| 79 | + // la liste d'arguments d'inclusion peut se terminer par un filtre |
|
| 80 | + $filtre = array_shift($couple); |
|
| 81 | + if ($filtre) { |
|
| 82 | + break; |
|
| 83 | + } |
|
| 84 | + foreach ($couple as $n => $val) { |
|
| 85 | + $var = $val[0]; |
|
| 86 | + if ($var->type != 'texte') { |
|
| 87 | + if ($n || $k || $fond1) { |
|
| 88 | + $erreur_p_i_i = [ |
|
| 89 | + 'zbug_parametres_inclus_incorrects', |
|
| 90 | + ['param' => $var->nom_champ] |
|
| 91 | + ]; |
|
| 92 | + erreur_squelette($erreur_p_i_i, $p); |
|
| 93 | + break; |
|
| 94 | + } else { |
|
| 95 | + $l[1] = calculer_liste($val, $p->descr, $boucles, $id_boucle); |
|
| 96 | + } |
|
| 97 | + } else { |
|
| 98 | + preg_match(',^([^=]*)(=?)(.*)$,m', $var->texte, $m); |
|
| 99 | + $m = array_pad($m, 3, null); |
|
| 100 | + $var = $m[1]; |
|
| 101 | + $auto = false; |
|
| 102 | + |
|
| 103 | + if ($m[2]) { |
|
| 104 | + $v = $m[3]; |
|
| 105 | + if (preg_match(',^[\'"](.*)[\'"]$,', $v, $m)) { |
|
| 106 | + $v = $m[1]; |
|
| 107 | + } |
|
| 108 | + $val[0] = new Texte(); |
|
| 109 | + $val[0]->texte = $v; |
|
| 110 | + } elseif ($k || $n || $fond1) { |
|
| 111 | + $auto = true; |
|
| 112 | + } else { |
|
| 113 | + $var = 1; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + if ($var == 'lang') { |
|
| 117 | + $lang = !$auto |
|
| 118 | + ? calculer_liste($val, $p->descr, $boucles, $id_boucle) |
|
| 119 | + : '$GLOBALS["spip_lang"]'; |
|
| 120 | + } else { |
|
| 121 | + $val = $auto |
|
| 122 | + ? index_pile($id_boucle, $var, $boucles) |
|
| 123 | + : calculer_liste($val, $p->descr, $boucles, $id_boucle); |
|
| 124 | + if ($var !== 1) { |
|
| 125 | + $val = ($echap ? "\'$var\' => ' . argumenter_squelette(" : "'$var' => ") |
|
| 126 | + . $val . ($echap ? ") . '" : ' '); |
|
| 127 | + } else { |
|
| 128 | + $val = $echap ? "'.$val.'" : $val; |
|
| 129 | + } |
|
| 130 | + $l[$var] = $val; |
|
| 131 | + } |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + if ($erreur_p_i_i) { |
|
| 136 | + return false; |
|
| 137 | + } |
|
| 138 | + // Cas particulier de la langue : si {lang=xx} est definie, on |
|
| 139 | + // la passe, sinon on passe la langue courante au moment du calcul |
|
| 140 | + // sauf si on n'en veut pas |
|
| 141 | + if ($lang === false) { |
|
| 142 | + return $l; |
|
| 143 | + } |
|
| 144 | + if (!$lang) { |
|
| 145 | + $lang = '$GLOBALS["spip_lang"]'; |
|
| 146 | + } |
|
| 147 | + $l['lang'] = ($echap ? "\'lang\' => ' . argumenter_squelette(" : "'lang' => ") . $lang . ($echap ? ") . '" : ' '); |
|
| 148 | + |
|
| 149 | + return $l; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -170,84 +170,84 @@ discard block |
||
| 170 | 170 | **/ |
| 171 | 171 | function calculer_inclure($p, &$boucles, $id_boucle) { |
| 172 | 172 | |
| 173 | - $_options = []; |
|
| 174 | - $_contexte = argumenter_inclure($p->param, false, $p, $boucles, $id_boucle, true, '', true); |
|
| 175 | - if (is_string($p->texte)) { |
|
| 176 | - $fichier = $p->texte; |
|
| 177 | - $code = '"' . str_replace('"', '\"', $fichier) . '"'; |
|
| 178 | - } else { |
|
| 179 | - $code = calculer_liste($p->texte, $p->descr, $boucles, $id_boucle); |
|
| 180 | - if ($code && preg_match("/^'([^']*)'/s", $code, $r)) { |
|
| 181 | - $fichier = $r[1]; |
|
| 182 | - } else { |
|
| 183 | - $fichier = ''; |
|
| 184 | - } |
|
| 185 | - } |
|
| 186 | - if (!$code || $code === '""' || $code === "''") { |
|
| 187 | - $trace = $p->fonctions; |
|
| 188 | - while ( |
|
| 189 | - is_array($trace) |
|
| 190 | - && ($trace = array_filter($trace)) |
|
| 191 | - && count($trace) == 1 |
|
| 192 | - ) { |
|
| 193 | - $trace = reset($trace); |
|
| 194 | - } |
|
| 195 | - $erreur_p_i_i = [ |
|
| 196 | - 'zbug_parametres_inclus_incorrects', |
|
| 197 | - ['param' => print_r($trace, true)] |
|
| 198 | - ]; |
|
| 199 | - erreur_squelette($erreur_p_i_i, $p); |
|
| 200 | - |
|
| 201 | - return "''"; |
|
| 202 | - } |
|
| 203 | - $compil = texte_script(memoriser_contexte_compil($p)); |
|
| 204 | - |
|
| 205 | - if (is_array($_contexte)) { |
|
| 206 | - // Critere d'inclusion {env} (et {self} pour compatibilite ascendante) |
|
| 207 | - if ($env = (isset($_contexte['env']) || isset($_contexte['self']))) { |
|
| 208 | - unset($_contexte['env']); |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - // noter les doublons dans l'appel a public.php |
|
| 212 | - if (isset($_contexte['doublons'])) { |
|
| 213 | - $_contexte['doublons'] = "\\'doublons\\' => '.var_export(\$doublons,true).'"; |
|
| 214 | - } |
|
| 215 | - |
|
| 216 | - if ($ajax = isset($_contexte['ajax'])) { |
|
| 217 | - $ajax = preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 218 | - unset($_contexte['ajax']); |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - $_contexte = join(",\n\t", $_contexte); |
|
| 222 | - } else { |
|
| 223 | - return false; |
|
| 224 | - } // j'aurais voulu toucher le fond ... |
|
| 225 | - |
|
| 226 | - $contexte = 'array(' . $_contexte . ')'; |
|
| 227 | - |
|
| 228 | - if ($env) { |
|
| 229 | - $contexte = "array_merge('.var_export(\$Pile[0],1).',$contexte)"; |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - // s'il y a une extension .php, ce n'est pas un squelette |
|
| 233 | - if ($fichier && preg_match('/^.+[.]php$/s', $fichier)) { |
|
| 234 | - $code = sandbox_composer_inclure_php($fichier, $p, $contexte); |
|
| 235 | - } else { |
|
| 236 | - $_options[] = "\"compil\"=>array($compil)"; |
|
| 237 | - if ($ajax) { |
|
| 238 | - $_options[] = $ajax; |
|
| 239 | - } |
|
| 240 | - $code = " ' . argumenter_squelette($code) . '"; |
|
| 241 | - $code = 'echo ' . sprintf( |
|
| 242 | - CODE_RECUPERER_FOND, |
|
| 243 | - $code, |
|
| 244 | - $contexte, |
|
| 245 | - implode(',', $_options), |
|
| 246 | - "_request(\\'connect\\') ?? \\'\\'" |
|
| 247 | - ) . ';'; |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - return "\n'<'.'" . '?php ' . $code . "\n?'." . "'>'"; |
|
| 173 | + $_options = []; |
|
| 174 | + $_contexte = argumenter_inclure($p->param, false, $p, $boucles, $id_boucle, true, '', true); |
|
| 175 | + if (is_string($p->texte)) { |
|
| 176 | + $fichier = $p->texte; |
|
| 177 | + $code = '"' . str_replace('"', '\"', $fichier) . '"'; |
|
| 178 | + } else { |
|
| 179 | + $code = calculer_liste($p->texte, $p->descr, $boucles, $id_boucle); |
|
| 180 | + if ($code && preg_match("/^'([^']*)'/s", $code, $r)) { |
|
| 181 | + $fichier = $r[1]; |
|
| 182 | + } else { |
|
| 183 | + $fichier = ''; |
|
| 184 | + } |
|
| 185 | + } |
|
| 186 | + if (!$code || $code === '""' || $code === "''") { |
|
| 187 | + $trace = $p->fonctions; |
|
| 188 | + while ( |
|
| 189 | + is_array($trace) |
|
| 190 | + && ($trace = array_filter($trace)) |
|
| 191 | + && count($trace) == 1 |
|
| 192 | + ) { |
|
| 193 | + $trace = reset($trace); |
|
| 194 | + } |
|
| 195 | + $erreur_p_i_i = [ |
|
| 196 | + 'zbug_parametres_inclus_incorrects', |
|
| 197 | + ['param' => print_r($trace, true)] |
|
| 198 | + ]; |
|
| 199 | + erreur_squelette($erreur_p_i_i, $p); |
|
| 200 | + |
|
| 201 | + return "''"; |
|
| 202 | + } |
|
| 203 | + $compil = texte_script(memoriser_contexte_compil($p)); |
|
| 204 | + |
|
| 205 | + if (is_array($_contexte)) { |
|
| 206 | + // Critere d'inclusion {env} (et {self} pour compatibilite ascendante) |
|
| 207 | + if ($env = (isset($_contexte['env']) || isset($_contexte['self']))) { |
|
| 208 | + unset($_contexte['env']); |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + // noter les doublons dans l'appel a public.php |
|
| 212 | + if (isset($_contexte['doublons'])) { |
|
| 213 | + $_contexte['doublons'] = "\\'doublons\\' => '.var_export(\$doublons,true).'"; |
|
| 214 | + } |
|
| 215 | + |
|
| 216 | + if ($ajax = isset($_contexte['ajax'])) { |
|
| 217 | + $ajax = preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 218 | + unset($_contexte['ajax']); |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + $_contexte = join(",\n\t", $_contexte); |
|
| 222 | + } else { |
|
| 223 | + return false; |
|
| 224 | + } // j'aurais voulu toucher le fond ... |
|
| 225 | + |
|
| 226 | + $contexte = 'array(' . $_contexte . ')'; |
|
| 227 | + |
|
| 228 | + if ($env) { |
|
| 229 | + $contexte = "array_merge('.var_export(\$Pile[0],1).',$contexte)"; |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + // s'il y a une extension .php, ce n'est pas un squelette |
|
| 233 | + if ($fichier && preg_match('/^.+[.]php$/s', $fichier)) { |
|
| 234 | + $code = sandbox_composer_inclure_php($fichier, $p, $contexte); |
|
| 235 | + } else { |
|
| 236 | + $_options[] = "\"compil\"=>array($compil)"; |
|
| 237 | + if ($ajax) { |
|
| 238 | + $_options[] = $ajax; |
|
| 239 | + } |
|
| 240 | + $code = " ' . argumenter_squelette($code) . '"; |
|
| 241 | + $code = 'echo ' . sprintf( |
|
| 242 | + CODE_RECUPERER_FOND, |
|
| 243 | + $code, |
|
| 244 | + $contexte, |
|
| 245 | + implode(',', $_options), |
|
| 246 | + "_request(\\'connect\\') ?? \\'\\'" |
|
| 247 | + ) . ';'; |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + return "\n'<'.'" . '?php ' . $code . "\n?'." . "'>'"; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * true pour ne tester que le cas publie et ignorer l'eventuel var_mode=preview de la page |
| 266 | 266 | */ |
| 267 | 267 | function instituer_boucle(&$boucle, $echapper = true, $ignore_previsu = false) { |
| 268 | - /* |
|
| 268 | + /* |
|
| 269 | 269 | $show['statut'][] = array( |
| 270 | 270 | 'champ'=>'statut', // champ de la table sur lequel porte le filtrage par le statut |
| 271 | 271 | 'publie'=>'publie', // valeur ou liste de valeurs, qui definissent l'objet comme publie. |
@@ -289,75 +289,75 @@ discard block |
||
| 289 | 289 | champstatut est alors le champ statut sur la tablen |
| 290 | 290 | dans les jointures, clen peut etre un tableau pour une jointure complexe : array('id_objet','id_article','objet','article') |
| 291 | 291 | */ |
| 292 | - $id_table = $boucle->id_table; |
|
| 293 | - $show = $boucle->show; |
|
| 294 | - if (isset($show['statut']) && $show['statut']) { |
|
| 295 | - foreach ($show['statut'] as $k => $s) { |
|
| 296 | - // Restreindre aux elements publies si pas de {statut} ou autre dans les criteres |
|
| 297 | - $filtrer = true; |
|
| 298 | - if (isset($s['exception'])) { |
|
| 299 | - foreach (is_array($s['exception']) ? $s['exception'] : [$s['exception']] as $m) { |
|
| 300 | - if (isset($boucle->modificateur[$m]) || isset($boucle->modificateur['criteres'][$m])) { |
|
| 301 | - $filtrer = false; |
|
| 302 | - break; |
|
| 303 | - } |
|
| 304 | - } |
|
| 305 | - } |
|
| 306 | - |
|
| 307 | - if ($filtrer) { |
|
| 308 | - if (is_array($s['champ'])) { |
|
| 309 | - $statut = preg_replace(',\W,', '', array_pop($s['champ'])); // securite |
|
| 310 | - $jointures = []; |
|
| 311 | - // indiquer la description de chaque table dans le tableau de jointures, |
|
| 312 | - // ce qui permet d'eviter certains GROUP BY inutiles. |
|
| 313 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 314 | - foreach ($s['champ'] as $j) { |
|
| 315 | - $id = reset($j); |
|
| 316 | - $def = $trouver_table($id); |
|
| 317 | - $jointures[] = ['', [$id, $def], end($j)]; |
|
| 318 | - } |
|
| 319 | - $jointures[0][0] = $id_table; |
|
| 320 | - if (!array_search($id, $boucle->from)) { |
|
| 321 | - include_spip('public/jointures'); |
|
| 322 | - fabrique_jointures($boucle, $jointures, true, $boucle->show, $id_table, '', $echapper); |
|
| 323 | - } |
|
| 324 | - // trouver l'alias de la table d'arrivee qui porte le statut |
|
| 325 | - $id = array_search($id, $boucle->from); |
|
| 326 | - } else { |
|
| 327 | - $id = $id_table; |
|
| 328 | - $statut = preg_replace(',\W,', '', $s['champ']); // securite |
|
| 329 | - } |
|
| 330 | - $mstatut = $id . '.' . $statut; |
|
| 331 | - |
|
| 332 | - $arg_ignore_previsu = ($ignore_previsu ? ',true' : ''); |
|
| 333 | - include_spip('public/quete'); |
|
| 334 | - if ( |
|
| 335 | - isset($s['post_date']) |
|
| 336 | - && $s['post_date'] |
|
| 337 | - && $GLOBALS['meta']['post_dates'] == 'non' |
|
| 338 | - ) { |
|
| 339 | - $date = $id . '.' . preg_replace(',\W,', '', $s['post_date']); // securite |
|
| 340 | - array_unshift( |
|
| 341 | - $boucle->where, |
|
| 342 | - $echapper ? |
|
| 343 | - "\nquete_condition_postdates('$date'," . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 344 | - : |
|
| 345 | - quete_condition_postdates($date, $boucle->sql_serveur, $ignore_previsu) |
|
| 346 | - ); |
|
| 347 | - } |
|
| 348 | - array_unshift( |
|
| 349 | - $boucle->where, |
|
| 350 | - $echapper ? |
|
| 351 | - "\nquete_condition_statut('$mstatut'," |
|
| 352 | - . _q($s['previsu']) . ',' |
|
| 353 | - . _q($s['publie']) . ',' |
|
| 354 | - . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 355 | - : |
|
| 356 | - quete_condition_statut($mstatut, $s['previsu'], $s['publie'], $boucle->sql_serveur, $ignore_previsu) |
|
| 357 | - ); |
|
| 358 | - } |
|
| 359 | - } |
|
| 360 | - } |
|
| 292 | + $id_table = $boucle->id_table; |
|
| 293 | + $show = $boucle->show; |
|
| 294 | + if (isset($show['statut']) && $show['statut']) { |
|
| 295 | + foreach ($show['statut'] as $k => $s) { |
|
| 296 | + // Restreindre aux elements publies si pas de {statut} ou autre dans les criteres |
|
| 297 | + $filtrer = true; |
|
| 298 | + if (isset($s['exception'])) { |
|
| 299 | + foreach (is_array($s['exception']) ? $s['exception'] : [$s['exception']] as $m) { |
|
| 300 | + if (isset($boucle->modificateur[$m]) || isset($boucle->modificateur['criteres'][$m])) { |
|
| 301 | + $filtrer = false; |
|
| 302 | + break; |
|
| 303 | + } |
|
| 304 | + } |
|
| 305 | + } |
|
| 306 | + |
|
| 307 | + if ($filtrer) { |
|
| 308 | + if (is_array($s['champ'])) { |
|
| 309 | + $statut = preg_replace(',\W,', '', array_pop($s['champ'])); // securite |
|
| 310 | + $jointures = []; |
|
| 311 | + // indiquer la description de chaque table dans le tableau de jointures, |
|
| 312 | + // ce qui permet d'eviter certains GROUP BY inutiles. |
|
| 313 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 314 | + foreach ($s['champ'] as $j) { |
|
| 315 | + $id = reset($j); |
|
| 316 | + $def = $trouver_table($id); |
|
| 317 | + $jointures[] = ['', [$id, $def], end($j)]; |
|
| 318 | + } |
|
| 319 | + $jointures[0][0] = $id_table; |
|
| 320 | + if (!array_search($id, $boucle->from)) { |
|
| 321 | + include_spip('public/jointures'); |
|
| 322 | + fabrique_jointures($boucle, $jointures, true, $boucle->show, $id_table, '', $echapper); |
|
| 323 | + } |
|
| 324 | + // trouver l'alias de la table d'arrivee qui porte le statut |
|
| 325 | + $id = array_search($id, $boucle->from); |
|
| 326 | + } else { |
|
| 327 | + $id = $id_table; |
|
| 328 | + $statut = preg_replace(',\W,', '', $s['champ']); // securite |
|
| 329 | + } |
|
| 330 | + $mstatut = $id . '.' . $statut; |
|
| 331 | + |
|
| 332 | + $arg_ignore_previsu = ($ignore_previsu ? ',true' : ''); |
|
| 333 | + include_spip('public/quete'); |
|
| 334 | + if ( |
|
| 335 | + isset($s['post_date']) |
|
| 336 | + && $s['post_date'] |
|
| 337 | + && $GLOBALS['meta']['post_dates'] == 'non' |
|
| 338 | + ) { |
|
| 339 | + $date = $id . '.' . preg_replace(',\W,', '', $s['post_date']); // securite |
|
| 340 | + array_unshift( |
|
| 341 | + $boucle->where, |
|
| 342 | + $echapper ? |
|
| 343 | + "\nquete_condition_postdates('$date'," . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 344 | + : |
|
| 345 | + quete_condition_postdates($date, $boucle->sql_serveur, $ignore_previsu) |
|
| 346 | + ); |
|
| 347 | + } |
|
| 348 | + array_unshift( |
|
| 349 | + $boucle->where, |
|
| 350 | + $echapper ? |
|
| 351 | + "\nquete_condition_statut('$mstatut'," |
|
| 352 | + . _q($s['previsu']) . ',' |
|
| 353 | + . _q($s['publie']) . ',' |
|
| 354 | + . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 355 | + : |
|
| 356 | + quete_condition_statut($mstatut, $s['previsu'], $s['publie'], $boucle->sql_serveur, $ignore_previsu) |
|
| 357 | + ); |
|
| 358 | + } |
|
| 359 | + } |
|
| 360 | + } |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -376,29 +376,29 @@ discard block |
||
| 376 | 376 | */ |
| 377 | 377 | function calculer_boucle($id_boucle, &$boucles) { |
| 378 | 378 | |
| 379 | - $boucle = &$boucles[$id_boucle]; |
|
| 380 | - instituer_boucle($boucle); |
|
| 381 | - $boucles[$id_boucle] = pipeline('post_boucle', $boucles[$id_boucle]); |
|
| 382 | - |
|
| 383 | - // en mode debug memoriser les premiers passages dans la boucle, |
|
| 384 | - // mais pas tous, sinon ca pete. |
|
| 385 | - if (_request('var_mode_affiche') != 'resultat') { |
|
| 386 | - $trace = ''; |
|
| 387 | - } else { |
|
| 388 | - $_trace = $boucles[$id_boucle]->descr['nom'] . $id_boucle; |
|
| 389 | - $_trace = "\$GLOBALS['debug_objets']['resultat']['$_trace']"; |
|
| 390 | - $trace = " |
|
| 379 | + $boucle = &$boucles[$id_boucle]; |
|
| 380 | + instituer_boucle($boucle); |
|
| 381 | + $boucles[$id_boucle] = pipeline('post_boucle', $boucles[$id_boucle]); |
|
| 382 | + |
|
| 383 | + // en mode debug memoriser les premiers passages dans la boucle, |
|
| 384 | + // mais pas tous, sinon ca pete. |
|
| 385 | + if (_request('var_mode_affiche') != 'resultat') { |
|
| 386 | + $trace = ''; |
|
| 387 | + } else { |
|
| 388 | + $_trace = $boucles[$id_boucle]->descr['nom'] . $id_boucle; |
|
| 389 | + $_trace = "\$GLOBALS['debug_objets']['resultat']['$_trace']"; |
|
| 390 | + $trace = " |
|
| 391 | 391 | if (empty($_trace)) { |
| 392 | 392 | $_trace = []; |
| 393 | 393 | } |
| 394 | 394 | if (count($_trace) < 3) { |
| 395 | 395 | $_trace" . '[] = $t0; |
| 396 | 396 | }'; |
| 397 | - } |
|
| 397 | + } |
|
| 398 | 398 | |
| 399 | - return ($boucles[$id_boucle]->type_requete == TYPE_RECURSIF) |
|
| 400 | - ? calculer_boucle_rec($id_boucle, $boucles, $trace) |
|
| 401 | - : calculer_boucle_nonrec($id_boucle, $boucles, $trace); |
|
| 399 | + return ($boucles[$id_boucle]->type_requete == TYPE_RECURSIF) |
|
| 400 | + ? calculer_boucle_rec($id_boucle, $boucles, $trace) |
|
| 401 | + : calculer_boucle_nonrec($id_boucle, $boucles, $trace); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | |
@@ -421,15 +421,15 @@ discard block |
||
| 421 | 421 | * Code PHP compilé de la boucle récursive |
| 422 | 422 | **/ |
| 423 | 423 | function calculer_boucle_rec($id_boucle, &$boucles, $trace) { |
| 424 | - $nom = $boucles[$id_boucle]->param[0]; |
|
| 425 | - |
|
| 426 | - return |
|
| 427 | - // Numrows[$nom] peut ne pas être encore defini |
|
| 428 | - "\n\t\$save_numrows = (isset(\$Numrows['$nom']) ? \$Numrows['$nom'] : array());" |
|
| 429 | - . "\n\t\$t0 = " . $boucles[$id_boucle]->return . ';' |
|
| 430 | - . "\n\t\$Numrows['$nom'] = (\$save_numrows);" |
|
| 431 | - . $trace |
|
| 432 | - . "\n\treturn \$t0;"; |
|
| 424 | + $nom = $boucles[$id_boucle]->param[0]; |
|
| 425 | + |
|
| 426 | + return |
|
| 427 | + // Numrows[$nom] peut ne pas être encore defini |
|
| 428 | + "\n\t\$save_numrows = (isset(\$Numrows['$nom']) ? \$Numrows['$nom'] : array());" |
|
| 429 | + . "\n\t\$t0 = " . $boucles[$id_boucle]->return . ';' |
|
| 430 | + . "\n\t\$Numrows['$nom'] = (\$save_numrows);" |
|
| 431 | + . $trace |
|
| 432 | + . "\n\treturn \$t0;"; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -482,173 +482,173 @@ discard block |
||
| 482 | 482 | **/ |
| 483 | 483 | function calculer_boucle_nonrec($id_boucle, &$boucles, $trace) { |
| 484 | 484 | |
| 485 | - $code_sep = null; |
|
| 486 | - $boucle = &$boucles[$id_boucle]; |
|
| 487 | - $return = $boucle->return; |
|
| 488 | - $type_boucle = $boucle->type_requete; |
|
| 489 | - $primary = $boucle->primary; |
|
| 490 | - $constant = preg_match(CODE_MONOTONE, str_replace("\\'", '', $return)); |
|
| 491 | - $flag_cpt = $boucle->mode_partie || $boucle->cptrows; |
|
| 492 | - $corps = ''; |
|
| 493 | - |
|
| 494 | - // faudrait expanser le foreach a la compil, car y en a souvent qu'un |
|
| 495 | - // et puis faire un [] plutot qu'un "','." |
|
| 496 | - if ($boucle->doublons) { |
|
| 497 | - $corps .= "\n\t\t\tforeach(" . $boucle->doublons . ' as $k) $doublons[$k] .= "," . ' . |
|
| 498 | - index_pile($id_boucle, $primary, $boucles) |
|
| 499 | - . "; // doublons\n"; |
|
| 500 | - } |
|
| 501 | - |
|
| 502 | - // La boucle doit-elle selectionner la langue ? |
|
| 503 | - // - par defaut, les boucles suivantes le font |
|
| 504 | - // (sauf si forcer_lang==true ou si le titre contient <multi>). |
|
| 505 | - // - a moins d'une demande explicite via {!lang_select} |
|
| 506 | - if ( |
|
| 507 | - !$constant && $boucle->lang_select != 'non' && |
|
| 508 | - (($boucle->lang_select == 'oui') || |
|
| 509 | - in_array($type_boucle, [ |
|
| 510 | - 'articles', |
|
| 511 | - 'rubriques', |
|
| 512 | - 'hierarchie', |
|
| 513 | - 'breves' |
|
| 514 | - ])) |
|
| 515 | - ) { |
|
| 516 | - // Memoriser la langue avant la boucle et la restituer apres |
|
| 517 | - // afin que le corps de boucle affecte la globale directement |
|
| 518 | - $init_lang = "lang_select(\$GLOBALS['spip_lang']);\n\t"; |
|
| 519 | - $fin_lang = "lang_select();\n\t"; |
|
| 520 | - $fin_lang_select_public = "\n\t\tlang_select();"; |
|
| 521 | - |
|
| 522 | - $corps .= |
|
| 523 | - "\n\t\tlang_select_public(" |
|
| 524 | - . index_pile($id_boucle, 'lang', $boucles) |
|
| 525 | - . ", '" . $boucle->lang_select . "'" |
|
| 526 | - . (in_array($type_boucle, [ |
|
| 527 | - 'articles', |
|
| 528 | - 'rubriques', |
|
| 529 | - 'hierarchie', |
|
| 530 | - 'breves' |
|
| 531 | - ]) ? ', ' . index_pile($id_boucle, 'titre', $boucles) : '') |
|
| 532 | - . ');'; |
|
| 533 | - } else { |
|
| 534 | - $init_lang = ''; |
|
| 535 | - $fin_lang = ''; |
|
| 536 | - $fin_lang_select_public = ''; |
|
| 537 | - // sortir les appels au traducteur (invariants de boucle) |
|
| 538 | - if ( |
|
| 539 | - !str_contains($return, '?php') |
|
| 540 | - && preg_match_all("/\W(_T[(]'[^']*'[)])/", $return, $r) |
|
| 541 | - ) { |
|
| 542 | - $i = 1; |
|
| 543 | - foreach ($r[1] as $t) { |
|
| 544 | - $init_lang .= "\n\t\$l$i = $t;"; |
|
| 545 | - $return = str_replace($t, "\$l$i", $return); |
|
| 546 | - $i++; |
|
| 547 | - } |
|
| 548 | - } |
|
| 549 | - } |
|
| 550 | - |
|
| 551 | - // gestion optimale des separateurs et des boucles constantes |
|
| 552 | - if (is_countable($boucle->separateur) ? count($boucle->separateur) : 0) { |
|
| 553 | - $code_sep = ("'" . str_replace("'", "\'", join('', $boucle->separateur)) . "'"); |
|
| 554 | - } |
|
| 555 | - |
|
| 556 | - $corps .= |
|
| 557 | - ((!$boucle->separateur) ? |
|
| 558 | - (($constant && !$corps && !$flag_cpt) ? $return : |
|
| 559 | - (($return === "''") ? '' : |
|
| 560 | - ("\n\t\t" . '$t0 .= ' . $return . ';'))) : |
|
| 561 | - ("\n\t\t\$t1 " . |
|
| 562 | - ((str_starts_with($return, '$t1.')) ? |
|
| 563 | - ('.=' . substr($return, 4)) : |
|
| 564 | - ('= ' . $return)) . |
|
| 565 | - ";\n\t\t" . |
|
| 566 | - '$t0 .= ((strlen($t1) && strlen($t0)) ? ' . $code_sep . " : '') . \$t1;")); |
|
| 567 | - |
|
| 568 | - // Calculer les invalideurs si c'est une boucle non constante et si on |
|
| 569 | - // souhaite invalider ces elements |
|
| 570 | - if (!$constant && $primary) { |
|
| 571 | - include_spip('inc/invalideur'); |
|
| 572 | - $corps = calcul_invalideurs($corps, $primary, $boucles, $id_boucle); |
|
| 573 | - } |
|
| 574 | - |
|
| 575 | - // gerer le compteur de boucle |
|
| 576 | - // avec ou sans son utilisation par les criteres {1/3} {1,4} {n-2,1}... |
|
| 577 | - |
|
| 578 | - if ($boucle->partie || $boucle->cptrows) { |
|
| 579 | - $corps = "\n\t\t\$Numrows['$id_boucle']['compteur_boucle']++;" |
|
| 580 | - . $boucle->partie |
|
| 581 | - . $corps; |
|
| 582 | - } |
|
| 583 | - |
|
| 584 | - // depiler la lang de la boucle si besoin |
|
| 585 | - $corps .= $fin_lang_select_public; |
|
| 586 | - |
|
| 587 | - // si le corps est une constante, ne pas appeler le serveur N fois! |
|
| 588 | - |
|
| 589 | - if (preg_match(CODE_MONOTONE, str_replace("\\'", '', $corps), $r)) { |
|
| 590 | - if (!isset($r[2]) || !$r[2]) { |
|
| 591 | - if (!$boucle->numrows) { |
|
| 592 | - return "\n\t\$t0 = '';"; |
|
| 593 | - } else { |
|
| 594 | - $corps = ''; |
|
| 595 | - } |
|
| 596 | - } else { |
|
| 597 | - $boucle->numrows = true; |
|
| 598 | - $corps = "\n\t\$t0 = str_repeat($corps, \$Numrows['$id_boucle']['total']);"; |
|
| 599 | - } |
|
| 600 | - } else { |
|
| 601 | - $corps = "while (\$Pile[\$SP]=\$iter->fetch()) {\n$corps\n }"; |
|
| 602 | - } |
|
| 603 | - |
|
| 604 | - $count = ''; |
|
| 605 | - if (!$boucle->select) { |
|
| 606 | - if (!$boucle->numrows || $boucle->limit || $boucle->mode_partie || $boucle->group) { |
|
| 607 | - $count = '1'; |
|
| 608 | - } else { |
|
| 609 | - $count = 'count(*)'; |
|
| 610 | - } |
|
| 611 | - $boucles[$id_boucle]->select[] = $count; |
|
| 612 | - } |
|
| 613 | - |
|
| 614 | - if ($flag_cpt) { |
|
| 615 | - $nums = "\n\t// COMPTEUR\n\t" |
|
| 616 | - . "\$Numrows['$id_boucle']['compteur_boucle'] = 0;\n\t"; |
|
| 617 | - } else { |
|
| 618 | - $nums = ''; |
|
| 619 | - } |
|
| 620 | - |
|
| 621 | - if ($boucle->numrows || $boucle->mode_partie) { |
|
| 622 | - $nums .= "\$Numrows['$id_boucle']['command'] = \$command;\n\t" |
|
| 623 | - . "\$Numrows['$id_boucle']['total'] = @intval(\$iter->count());" |
|
| 624 | - . $boucle->mode_partie |
|
| 625 | - . "\n\t"; |
|
| 626 | - } |
|
| 627 | - |
|
| 628 | - // Ne calculer la requete que maintenant |
|
| 629 | - // car ce qui precede appelle index_pile qui influe dessus |
|
| 630 | - |
|
| 631 | - $init = (($init = $boucles[$id_boucle]->doublons) |
|
| 632 | - ? ("\n\t$init = array();") : '') |
|
| 633 | - . calculer_requete_sql($boucles[$id_boucle]); |
|
| 634 | - |
|
| 635 | - $contexte = memoriser_contexte_compil($boucle); |
|
| 636 | - |
|
| 637 | - $a = sprintf( |
|
| 638 | - CODE_CORPS_BOUCLE, |
|
| 639 | - $init, |
|
| 640 | - $boucle->iterateur, |
|
| 641 | - '$command', |
|
| 642 | - $contexte, |
|
| 643 | - $nums, |
|
| 644 | - $init_lang, |
|
| 645 | - $corps, |
|
| 646 | - $fin_lang, |
|
| 647 | - $trace, |
|
| 648 | - 'BOUCLE' . $id_boucle . ' @ ' . ($boucle->descr['sourcefile']) |
|
| 649 | - ); |
|
| 650 | - |
|
| 651 | - return $a; |
|
| 485 | + $code_sep = null; |
|
| 486 | + $boucle = &$boucles[$id_boucle]; |
|
| 487 | + $return = $boucle->return; |
|
| 488 | + $type_boucle = $boucle->type_requete; |
|
| 489 | + $primary = $boucle->primary; |
|
| 490 | + $constant = preg_match(CODE_MONOTONE, str_replace("\\'", '', $return)); |
|
| 491 | + $flag_cpt = $boucle->mode_partie || $boucle->cptrows; |
|
| 492 | + $corps = ''; |
|
| 493 | + |
|
| 494 | + // faudrait expanser le foreach a la compil, car y en a souvent qu'un |
|
| 495 | + // et puis faire un [] plutot qu'un "','." |
|
| 496 | + if ($boucle->doublons) { |
|
| 497 | + $corps .= "\n\t\t\tforeach(" . $boucle->doublons . ' as $k) $doublons[$k] .= "," . ' . |
|
| 498 | + index_pile($id_boucle, $primary, $boucles) |
|
| 499 | + . "; // doublons\n"; |
|
| 500 | + } |
|
| 501 | + |
|
| 502 | + // La boucle doit-elle selectionner la langue ? |
|
| 503 | + // - par defaut, les boucles suivantes le font |
|
| 504 | + // (sauf si forcer_lang==true ou si le titre contient <multi>). |
|
| 505 | + // - a moins d'une demande explicite via {!lang_select} |
|
| 506 | + if ( |
|
| 507 | + !$constant && $boucle->lang_select != 'non' && |
|
| 508 | + (($boucle->lang_select == 'oui') || |
|
| 509 | + in_array($type_boucle, [ |
|
| 510 | + 'articles', |
|
| 511 | + 'rubriques', |
|
| 512 | + 'hierarchie', |
|
| 513 | + 'breves' |
|
| 514 | + ])) |
|
| 515 | + ) { |
|
| 516 | + // Memoriser la langue avant la boucle et la restituer apres |
|
| 517 | + // afin que le corps de boucle affecte la globale directement |
|
| 518 | + $init_lang = "lang_select(\$GLOBALS['spip_lang']);\n\t"; |
|
| 519 | + $fin_lang = "lang_select();\n\t"; |
|
| 520 | + $fin_lang_select_public = "\n\t\tlang_select();"; |
|
| 521 | + |
|
| 522 | + $corps .= |
|
| 523 | + "\n\t\tlang_select_public(" |
|
| 524 | + . index_pile($id_boucle, 'lang', $boucles) |
|
| 525 | + . ", '" . $boucle->lang_select . "'" |
|
| 526 | + . (in_array($type_boucle, [ |
|
| 527 | + 'articles', |
|
| 528 | + 'rubriques', |
|
| 529 | + 'hierarchie', |
|
| 530 | + 'breves' |
|
| 531 | + ]) ? ', ' . index_pile($id_boucle, 'titre', $boucles) : '') |
|
| 532 | + . ');'; |
|
| 533 | + } else { |
|
| 534 | + $init_lang = ''; |
|
| 535 | + $fin_lang = ''; |
|
| 536 | + $fin_lang_select_public = ''; |
|
| 537 | + // sortir les appels au traducteur (invariants de boucle) |
|
| 538 | + if ( |
|
| 539 | + !str_contains($return, '?php') |
|
| 540 | + && preg_match_all("/\W(_T[(]'[^']*'[)])/", $return, $r) |
|
| 541 | + ) { |
|
| 542 | + $i = 1; |
|
| 543 | + foreach ($r[1] as $t) { |
|
| 544 | + $init_lang .= "\n\t\$l$i = $t;"; |
|
| 545 | + $return = str_replace($t, "\$l$i", $return); |
|
| 546 | + $i++; |
|
| 547 | + } |
|
| 548 | + } |
|
| 549 | + } |
|
| 550 | + |
|
| 551 | + // gestion optimale des separateurs et des boucles constantes |
|
| 552 | + if (is_countable($boucle->separateur) ? count($boucle->separateur) : 0) { |
|
| 553 | + $code_sep = ("'" . str_replace("'", "\'", join('', $boucle->separateur)) . "'"); |
|
| 554 | + } |
|
| 555 | + |
|
| 556 | + $corps .= |
|
| 557 | + ((!$boucle->separateur) ? |
|
| 558 | + (($constant && !$corps && !$flag_cpt) ? $return : |
|
| 559 | + (($return === "''") ? '' : |
|
| 560 | + ("\n\t\t" . '$t0 .= ' . $return . ';'))) : |
|
| 561 | + ("\n\t\t\$t1 " . |
|
| 562 | + ((str_starts_with($return, '$t1.')) ? |
|
| 563 | + ('.=' . substr($return, 4)) : |
|
| 564 | + ('= ' . $return)) . |
|
| 565 | + ";\n\t\t" . |
|
| 566 | + '$t0 .= ((strlen($t1) && strlen($t0)) ? ' . $code_sep . " : '') . \$t1;")); |
|
| 567 | + |
|
| 568 | + // Calculer les invalideurs si c'est une boucle non constante et si on |
|
| 569 | + // souhaite invalider ces elements |
|
| 570 | + if (!$constant && $primary) { |
|
| 571 | + include_spip('inc/invalideur'); |
|
| 572 | + $corps = calcul_invalideurs($corps, $primary, $boucles, $id_boucle); |
|
| 573 | + } |
|
| 574 | + |
|
| 575 | + // gerer le compteur de boucle |
|
| 576 | + // avec ou sans son utilisation par les criteres {1/3} {1,4} {n-2,1}... |
|
| 577 | + |
|
| 578 | + if ($boucle->partie || $boucle->cptrows) { |
|
| 579 | + $corps = "\n\t\t\$Numrows['$id_boucle']['compteur_boucle']++;" |
|
| 580 | + . $boucle->partie |
|
| 581 | + . $corps; |
|
| 582 | + } |
|
| 583 | + |
|
| 584 | + // depiler la lang de la boucle si besoin |
|
| 585 | + $corps .= $fin_lang_select_public; |
|
| 586 | + |
|
| 587 | + // si le corps est une constante, ne pas appeler le serveur N fois! |
|
| 588 | + |
|
| 589 | + if (preg_match(CODE_MONOTONE, str_replace("\\'", '', $corps), $r)) { |
|
| 590 | + if (!isset($r[2]) || !$r[2]) { |
|
| 591 | + if (!$boucle->numrows) { |
|
| 592 | + return "\n\t\$t0 = '';"; |
|
| 593 | + } else { |
|
| 594 | + $corps = ''; |
|
| 595 | + } |
|
| 596 | + } else { |
|
| 597 | + $boucle->numrows = true; |
|
| 598 | + $corps = "\n\t\$t0 = str_repeat($corps, \$Numrows['$id_boucle']['total']);"; |
|
| 599 | + } |
|
| 600 | + } else { |
|
| 601 | + $corps = "while (\$Pile[\$SP]=\$iter->fetch()) {\n$corps\n }"; |
|
| 602 | + } |
|
| 603 | + |
|
| 604 | + $count = ''; |
|
| 605 | + if (!$boucle->select) { |
|
| 606 | + if (!$boucle->numrows || $boucle->limit || $boucle->mode_partie || $boucle->group) { |
|
| 607 | + $count = '1'; |
|
| 608 | + } else { |
|
| 609 | + $count = 'count(*)'; |
|
| 610 | + } |
|
| 611 | + $boucles[$id_boucle]->select[] = $count; |
|
| 612 | + } |
|
| 613 | + |
|
| 614 | + if ($flag_cpt) { |
|
| 615 | + $nums = "\n\t// COMPTEUR\n\t" |
|
| 616 | + . "\$Numrows['$id_boucle']['compteur_boucle'] = 0;\n\t"; |
|
| 617 | + } else { |
|
| 618 | + $nums = ''; |
|
| 619 | + } |
|
| 620 | + |
|
| 621 | + if ($boucle->numrows || $boucle->mode_partie) { |
|
| 622 | + $nums .= "\$Numrows['$id_boucle']['command'] = \$command;\n\t" |
|
| 623 | + . "\$Numrows['$id_boucle']['total'] = @intval(\$iter->count());" |
|
| 624 | + . $boucle->mode_partie |
|
| 625 | + . "\n\t"; |
|
| 626 | + } |
|
| 627 | + |
|
| 628 | + // Ne calculer la requete que maintenant |
|
| 629 | + // car ce qui precede appelle index_pile qui influe dessus |
|
| 630 | + |
|
| 631 | + $init = (($init = $boucles[$id_boucle]->doublons) |
|
| 632 | + ? ("\n\t$init = array();") : '') |
|
| 633 | + . calculer_requete_sql($boucles[$id_boucle]); |
|
| 634 | + |
|
| 635 | + $contexte = memoriser_contexte_compil($boucle); |
|
| 636 | + |
|
| 637 | + $a = sprintf( |
|
| 638 | + CODE_CORPS_BOUCLE, |
|
| 639 | + $init, |
|
| 640 | + $boucle->iterateur, |
|
| 641 | + '$command', |
|
| 642 | + $contexte, |
|
| 643 | + $nums, |
|
| 644 | + $init_lang, |
|
| 645 | + $corps, |
|
| 646 | + $fin_lang, |
|
| 647 | + $trace, |
|
| 648 | + 'BOUCLE' . $id_boucle . ' @ ' . ($boucle->descr['sourcefile']) |
|
| 649 | + ); |
|
| 650 | + |
|
| 651 | + return $a; |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | |
@@ -664,48 +664,48 @@ discard block |
||
| 664 | 664 | * Code PHP compilé définissant les informations de requête |
| 665 | 665 | **/ |
| 666 | 666 | function calculer_requete_sql($boucle) { |
| 667 | - $init = []; |
|
| 668 | - $init[] = calculer_dec('table', "'" . $boucle->id_table . "'"); |
|
| 669 | - $init[] = calculer_dec('id', "'" . $boucle->id_boucle . "'"); |
|
| 670 | - # En absence de champ c'est un decompte : |
|
| 671 | - $init[] = calculer_dec('from', calculer_from($boucle)); |
|
| 672 | - $init[] = calculer_dec('type', calculer_from_type($boucle)); |
|
| 673 | - $init[] = calculer_dec( |
|
| 674 | - 'groupby', |
|
| 675 | - 'array(' . (($g = join("\",\n\t\t\"", $boucle->group)) ? '"' . $g . '"' : '') . ')' |
|
| 676 | - ); |
|
| 677 | - $init[] = calculer_dec('select', 'array("' . join("\",\n\t\t\"", $boucle->select) . '")'); |
|
| 678 | - $init[] = calculer_dec('orderby', 'array(' . calculer_order($boucle) . ')'); |
|
| 679 | - $init[] = calculer_dec('where', calculer_dump_array($boucle->where)); |
|
| 680 | - $init[] = calculer_dec('join', calculer_dump_join($boucle->join)); |
|
| 681 | - $init[] = calculer_dec( |
|
| 682 | - 'limit', |
|
| 683 | - ( |
|
| 684 | - !str_contains($boucle->limit, 'intval') ? |
|
| 685 | - "'" . ($boucle->limit) . "'" : |
|
| 686 | - $boucle->limit |
|
| 687 | - ) |
|
| 688 | - ); |
|
| 689 | - $init[] = calculer_dec('having', calculer_dump_array($boucle->having)); |
|
| 690 | - $s = $d = ''; |
|
| 691 | - // l'index 0 de $i indique si l'affectation est statique (contenu) |
|
| 692 | - // ou recalculée à chaque passage (vide) |
|
| 693 | - foreach ($init as $i) { |
|
| 694 | - if (reset($i)) { |
|
| 695 | - $s .= "\n\t\t" . end($i); |
|
| 696 | - } # statique |
|
| 697 | - else { |
|
| 698 | - $d .= "\n\t" . end($i); |
|
| 699 | - } # dynamique |
|
| 700 | - } |
|
| 701 | - |
|
| 702 | - return ($boucle->hierarchie ? "\n\t$boucle->hierarchie" : '') |
|
| 703 | - . $boucle->in |
|
| 704 | - . $boucle->hash |
|
| 705 | - . "\n\t" . 'if (!isset($command[\'table\'])) {' |
|
| 706 | - . $s |
|
| 707 | - . "\n\t}" |
|
| 708 | - . $d; |
|
| 667 | + $init = []; |
|
| 668 | + $init[] = calculer_dec('table', "'" . $boucle->id_table . "'"); |
|
| 669 | + $init[] = calculer_dec('id', "'" . $boucle->id_boucle . "'"); |
|
| 670 | + # En absence de champ c'est un decompte : |
|
| 671 | + $init[] = calculer_dec('from', calculer_from($boucle)); |
|
| 672 | + $init[] = calculer_dec('type', calculer_from_type($boucle)); |
|
| 673 | + $init[] = calculer_dec( |
|
| 674 | + 'groupby', |
|
| 675 | + 'array(' . (($g = join("\",\n\t\t\"", $boucle->group)) ? '"' . $g . '"' : '') . ')' |
|
| 676 | + ); |
|
| 677 | + $init[] = calculer_dec('select', 'array("' . join("\",\n\t\t\"", $boucle->select) . '")'); |
|
| 678 | + $init[] = calculer_dec('orderby', 'array(' . calculer_order($boucle) . ')'); |
|
| 679 | + $init[] = calculer_dec('where', calculer_dump_array($boucle->where)); |
|
| 680 | + $init[] = calculer_dec('join', calculer_dump_join($boucle->join)); |
|
| 681 | + $init[] = calculer_dec( |
|
| 682 | + 'limit', |
|
| 683 | + ( |
|
| 684 | + !str_contains($boucle->limit, 'intval') ? |
|
| 685 | + "'" . ($boucle->limit) . "'" : |
|
| 686 | + $boucle->limit |
|
| 687 | + ) |
|
| 688 | + ); |
|
| 689 | + $init[] = calculer_dec('having', calculer_dump_array($boucle->having)); |
|
| 690 | + $s = $d = ''; |
|
| 691 | + // l'index 0 de $i indique si l'affectation est statique (contenu) |
|
| 692 | + // ou recalculée à chaque passage (vide) |
|
| 693 | + foreach ($init as $i) { |
|
| 694 | + if (reset($i)) { |
|
| 695 | + $s .= "\n\t\t" . end($i); |
|
| 696 | + } # statique |
|
| 697 | + else { |
|
| 698 | + $d .= "\n\t" . end($i); |
|
| 699 | + } # dynamique |
|
| 700 | + } |
|
| 701 | + |
|
| 702 | + return ($boucle->hierarchie ? "\n\t$boucle->hierarchie" : '') |
|
| 703 | + . $boucle->in |
|
| 704 | + . $boucle->hash |
|
| 705 | + . "\n\t" . 'if (!isset($command[\'table\'])) {' |
|
| 706 | + . $s |
|
| 707 | + . "\n\t}" |
|
| 708 | + . $d; |
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | /** |
@@ -723,13 +723,13 @@ discard block |
||
| 723 | 723 | * qui peut être utilisé pour la production d'un tableau array() |
| 724 | 724 | **/ |
| 725 | 725 | function memoriser_contexte_compil($p) { |
| 726 | - return join(',', [ |
|
| 727 | - _q($p->descr['sourcefile'] ?? ''), |
|
| 728 | - _q($p->descr['nom'] ?? ''), |
|
| 729 | - _q($p->id_boucle ?? ''), |
|
| 730 | - intval($p->ligne), |
|
| 731 | - '$GLOBALS[\'spip_lang\']' |
|
| 732 | - ]); |
|
| 726 | + return join(',', [ |
|
| 727 | + _q($p->descr['sourcefile'] ?? ''), |
|
| 728 | + _q($p->descr['nom'] ?? ''), |
|
| 729 | + _q($p->id_boucle ?? ''), |
|
| 730 | + intval($p->ligne), |
|
| 731 | + '$GLOBALS[\'spip_lang\']' |
|
| 732 | + ]); |
|
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | /** |
@@ -747,20 +747,20 @@ discard block |
||
| 747 | 747 | * Objet Contexte |
| 748 | 748 | **/ |
| 749 | 749 | function reconstruire_contexte_compil($context_compil) { |
| 750 | - if (!is_array($context_compil)) { |
|
| 751 | - return $context_compil; |
|
| 752 | - } |
|
| 753 | - $p = new Contexte(); |
|
| 754 | - $p->descr = [ |
|
| 755 | - 'sourcefile' => $context_compil[0] ?? '', |
|
| 756 | - 'nom' => $context_compil[1] ?? '', |
|
| 757 | - ]; |
|
| 758 | - |
|
| 759 | - $p->id_boucle = $context_compil[2] ?? ''; |
|
| 760 | - $p->ligne = (int)($context_compil[3] ?? 0); |
|
| 761 | - $p->lang = $context_compil[4] ?? ''; |
|
| 762 | - |
|
| 763 | - return $p; |
|
| 750 | + if (!is_array($context_compil)) { |
|
| 751 | + return $context_compil; |
|
| 752 | + } |
|
| 753 | + $p = new Contexte(); |
|
| 754 | + $p->descr = [ |
|
| 755 | + 'sourcefile' => $context_compil[0] ?? '', |
|
| 756 | + 'nom' => $context_compil[1] ?? '', |
|
| 757 | + ]; |
|
| 758 | + |
|
| 759 | + $p->id_boucle = $context_compil[2] ?? ''; |
|
| 760 | + $p->ligne = (int)($context_compil[3] ?? 0); |
|
| 761 | + $p->lang = $context_compil[4] ?? ''; |
|
| 762 | + |
|
| 763 | + return $p; |
|
| 764 | 764 | } |
| 765 | 765 | |
| 766 | 766 | /** |
@@ -786,12 +786,12 @@ discard block |
||
| 786 | 786 | * - index 1 : Code de l'affectation |
| 787 | 787 | **/ |
| 788 | 788 | function calculer_dec($nom, $val) { |
| 789 | - $static = 'if (!isset($command[\'' . $nom . '\'])) '; |
|
| 790 | - // si une variable apparait dans le calcul de la clause |
|
| 791 | - // il faut la re-evaluer a chaque passage |
|
| 792 | - if ( |
|
| 793 | - str_contains($val, '$') |
|
| 794 | - /* |
|
| 789 | + $static = 'if (!isset($command[\'' . $nom . '\'])) '; |
|
| 790 | + // si une variable apparait dans le calcul de la clause |
|
| 791 | + // il faut la re-evaluer a chaque passage |
|
| 792 | + if ( |
|
| 793 | + str_contains($val, '$') |
|
| 794 | + /* |
|
| 795 | 795 | OR str_contains($val, 'sql_') |
| 796 | 796 | OR ( |
| 797 | 797 | $test = str_replace(array("array(",'\"',"\'"),array("","",""),$val) // supprimer les array( et les echappements de guillemets |
@@ -799,11 +799,11 @@ discard block |
||
| 799 | 799 | AND $test = preg_replace(",'[^']*',UimsS","",$test) // supprimer les chaines qui peuvent contenir des fonctions SQL qui ne genent pas |
| 800 | 800 | AND preg_match(",\w+\s*\(,UimsS",$test,$regs) // tester la presence de fonctions restantes |
| 801 | 801 | )*/ |
| 802 | - ) { |
|
| 803 | - $static = ''; |
|
| 804 | - } |
|
| 802 | + ) { |
|
| 803 | + $static = ''; |
|
| 804 | + } |
|
| 805 | 805 | |
| 806 | - return [$static, '$command[\'' . $nom . '\'] = ' . $val . ';']; |
|
| 806 | + return [$static, '$command[\'' . $nom . '\'] = ' . $val . ';']; |
|
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | /** |
@@ -823,32 +823,32 @@ discard block |
||
| 823 | 823 | * Expression PHP décrivant un texte ou un tableau |
| 824 | 824 | **/ |
| 825 | 825 | function calculer_dump_array($a) { |
| 826 | - if (!is_array($a)) { |
|
| 827 | - return $a; |
|
| 828 | - } |
|
| 829 | - $res = ''; |
|
| 830 | - if ($a && $a[0] == "'?'") { |
|
| 831 | - return ('(' . calculer_dump_array($a[1]) . |
|
| 832 | - ' ? ' . calculer_dump_array($a[2]) . |
|
| 833 | - ' : ' . calculer_dump_array($a[3]) . |
|
| 834 | - ')'); |
|
| 835 | - } else { |
|
| 836 | - foreach ($a as $k => $v) { |
|
| 837 | - $showk = (is_numeric($k) ? '' : sql_quote($k) . ' => '); |
|
| 838 | - $res .= ', ' . $showk . calculer_dump_array($v); |
|
| 839 | - } |
|
| 840 | - |
|
| 841 | - return "\n\t\t\tarray(" . substr($res, 2) . ')'; |
|
| 842 | - } |
|
| 826 | + if (!is_array($a)) { |
|
| 827 | + return $a; |
|
| 828 | + } |
|
| 829 | + $res = ''; |
|
| 830 | + if ($a && $a[0] == "'?'") { |
|
| 831 | + return ('(' . calculer_dump_array($a[1]) . |
|
| 832 | + ' ? ' . calculer_dump_array($a[2]) . |
|
| 833 | + ' : ' . calculer_dump_array($a[3]) . |
|
| 834 | + ')'); |
|
| 835 | + } else { |
|
| 836 | + foreach ($a as $k => $v) { |
|
| 837 | + $showk = (is_numeric($k) ? '' : sql_quote($k) . ' => '); |
|
| 838 | + $res .= ', ' . $showk . calculer_dump_array($v); |
|
| 839 | + } |
|
| 840 | + |
|
| 841 | + return "\n\t\t\tarray(" . substr($res, 2) . ')'; |
|
| 842 | + } |
|
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | function calculer_dump_join($a) { |
| 846 | - $res = ''; |
|
| 847 | - foreach ($a as $k => $v) { |
|
| 848 | - $res .= ", '$k' => array(" . implode(',', $v) . ')'; |
|
| 849 | - } |
|
| 846 | + $res = ''; |
|
| 847 | + foreach ($a as $k => $v) { |
|
| 848 | + $res .= ", '$k' => array(" . implode(',', $v) . ')'; |
|
| 849 | + } |
|
| 850 | 850 | |
| 851 | - return 'array(' . substr($res, 2) . ')'; |
|
| 851 | + return 'array(' . substr($res, 2) . ')'; |
|
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | /** |
@@ -860,12 +860,12 @@ discard block |
||
| 860 | 860 | * Code PHP construisant un tableau des alias et noms des tables du FROM |
| 861 | 861 | **/ |
| 862 | 862 | function calculer_from(&$boucle) { |
| 863 | - $res = ''; |
|
| 864 | - foreach ($boucle->from as $k => $v) { |
|
| 865 | - $res .= ",'$k' => '$v'"; |
|
| 866 | - } |
|
| 863 | + $res = ''; |
|
| 864 | + foreach ($boucle->from as $k => $v) { |
|
| 865 | + $res .= ",'$k' => '$v'"; |
|
| 866 | + } |
|
| 867 | 867 | |
| 868 | - return 'array(' . substr($res, 1) . ')'; |
|
| 868 | + return 'array(' . substr($res, 1) . ')'; |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | /** |
@@ -878,30 +878,30 @@ discard block |
||
| 878 | 878 | * Code PHP construisant un tableau des alias et type de jointure du FROM |
| 879 | 879 | **/ |
| 880 | 880 | function calculer_from_type(&$boucle) { |
| 881 | - $res = ''; |
|
| 882 | - foreach ($boucle->from_type as $k => $v) { |
|
| 883 | - $res .= ",'$k' => '$v'"; |
|
| 884 | - } |
|
| 881 | + $res = ''; |
|
| 882 | + foreach ($boucle->from_type as $k => $v) { |
|
| 883 | + $res .= ",'$k' => '$v'"; |
|
| 884 | + } |
|
| 885 | 885 | |
| 886 | - return 'array(' . substr($res, 1) . ')'; |
|
| 886 | + return 'array(' . substr($res, 1) . ')'; |
|
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | function calculer_order(&$boucle) { |
| 890 | - if ( |
|
| 891 | - !($order = $boucle->order) |
|
| 892 | - && !($order = $boucle->default_order) |
|
| 893 | - ) { |
|
| 894 | - $order = []; |
|
| 895 | - } |
|
| 896 | - |
|
| 897 | - /*if (isset($boucle->modificateur['collate'])){ |
|
| 890 | + if ( |
|
| 891 | + !($order = $boucle->order) |
|
| 892 | + && !($order = $boucle->default_order) |
|
| 893 | + ) { |
|
| 894 | + $order = []; |
|
| 895 | + } |
|
| 896 | + |
|
| 897 | + /*if (isset($boucle->modificateur['collate'])){ |
|
| 898 | 898 | $col = "." . $boucle->modificateur['collate']; |
| 899 | 899 | foreach($order as $k=>$o) |
| 900 | 900 | if (strpos($order[$k],'COLLATE')===false) |
| 901 | 901 | $order[$k].= $col; |
| 902 | 902 | }*/ |
| 903 | 903 | |
| 904 | - return join(', ', $order); |
|
| 904 | + return join(', ', $order); |
|
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | // Production du code PHP a partir de la sequence livree par le phraseur |
@@ -910,62 +910,62 @@ discard block |
||
| 910 | 910 | // (qui sera argument d'un Return ou la partie droite d'une affectation). |
| 911 | 911 | |
| 912 | 912 | function calculer_liste($tableau, $descr, &$boucles, $id_boucle = '') { |
| 913 | - if (!$tableau) { |
|
| 914 | - return "''"; |
|
| 915 | - } |
|
| 916 | - if (is_string($descr)) { |
|
| 917 | - if (isset($boucles[$descr])) { |
|
| 918 | - $idb = $descr; |
|
| 919 | - $descr = []; |
|
| 920 | - if (isset($boucles[$idb]->descr['id_mere_contexte'])) { |
|
| 921 | - $descr['id_mere'] = $boucles[$idb]->descr['id_mere_contexte']; |
|
| 922 | - } |
|
| 923 | - if (isset($boucles[$idb]->descr['sourcefile'])) { |
|
| 924 | - $descr['sourcefile'] = $boucles[$idb]->descr['sourcefile']; |
|
| 925 | - } |
|
| 926 | - } |
|
| 927 | - else { |
|
| 928 | - $descr = []; |
|
| 929 | - } |
|
| 930 | - } |
|
| 931 | - if (!isset($descr['niv'])) { |
|
| 932 | - $descr['niv'] = 0; |
|
| 933 | - } |
|
| 934 | - $codes = compile_cas($tableau, $descr, $boucles, $id_boucle); |
|
| 935 | - if ($codes === false) { |
|
| 936 | - return false; |
|
| 937 | - } |
|
| 938 | - $n = is_countable($codes) ? count($codes) : 0; |
|
| 939 | - if (!$n) { |
|
| 940 | - return "''"; |
|
| 941 | - } |
|
| 942 | - $tab = str_repeat("\t", $descr['niv']); |
|
| 943 | - if (_request('var_mode_affiche') != 'validation') { |
|
| 944 | - if ($n == 1) { |
|
| 945 | - return $codes[0]; |
|
| 946 | - } else { |
|
| 947 | - $res = ''; |
|
| 948 | - foreach ($codes as $code) { |
|
| 949 | - if ( |
|
| 950 | - !preg_match("/^'[^']*'$/", $code) |
|
| 951 | - || !str_ends_with($res, "'") |
|
| 952 | - ) { |
|
| 953 | - $res .= " .\n$tab$code"; |
|
| 954 | - } else { |
|
| 955 | - $res = substr($res, 0, -1) . substr($code, 1); |
|
| 956 | - } |
|
| 957 | - } |
|
| 958 | - |
|
| 959 | - return '(' . substr($res, 2 + $descr['niv']) . ')'; |
|
| 960 | - } |
|
| 961 | - } else { |
|
| 962 | - $nom = $descr['nom'] . $id_boucle . ($descr['niv'] ?: ''); |
|
| 963 | - |
|
| 964 | - return "join('', array_map('array_shift', \$GLOBALS['debug_objets']['sequence']['$nom'] = array(" . join( |
|
| 965 | - " ,\n$tab", |
|
| 966 | - $codes |
|
| 967 | - ) . ')))'; |
|
| 968 | - } |
|
| 913 | + if (!$tableau) { |
|
| 914 | + return "''"; |
|
| 915 | + } |
|
| 916 | + if (is_string($descr)) { |
|
| 917 | + if (isset($boucles[$descr])) { |
|
| 918 | + $idb = $descr; |
|
| 919 | + $descr = []; |
|
| 920 | + if (isset($boucles[$idb]->descr['id_mere_contexte'])) { |
|
| 921 | + $descr['id_mere'] = $boucles[$idb]->descr['id_mere_contexte']; |
|
| 922 | + } |
|
| 923 | + if (isset($boucles[$idb]->descr['sourcefile'])) { |
|
| 924 | + $descr['sourcefile'] = $boucles[$idb]->descr['sourcefile']; |
|
| 925 | + } |
|
| 926 | + } |
|
| 927 | + else { |
|
| 928 | + $descr = []; |
|
| 929 | + } |
|
| 930 | + } |
|
| 931 | + if (!isset($descr['niv'])) { |
|
| 932 | + $descr['niv'] = 0; |
|
| 933 | + } |
|
| 934 | + $codes = compile_cas($tableau, $descr, $boucles, $id_boucle); |
|
| 935 | + if ($codes === false) { |
|
| 936 | + return false; |
|
| 937 | + } |
|
| 938 | + $n = is_countable($codes) ? count($codes) : 0; |
|
| 939 | + if (!$n) { |
|
| 940 | + return "''"; |
|
| 941 | + } |
|
| 942 | + $tab = str_repeat("\t", $descr['niv']); |
|
| 943 | + if (_request('var_mode_affiche') != 'validation') { |
|
| 944 | + if ($n == 1) { |
|
| 945 | + return $codes[0]; |
|
| 946 | + } else { |
|
| 947 | + $res = ''; |
|
| 948 | + foreach ($codes as $code) { |
|
| 949 | + if ( |
|
| 950 | + !preg_match("/^'[^']*'$/", $code) |
|
| 951 | + || !str_ends_with($res, "'") |
|
| 952 | + ) { |
|
| 953 | + $res .= " .\n$tab$code"; |
|
| 954 | + } else { |
|
| 955 | + $res = substr($res, 0, -1) . substr($code, 1); |
|
| 956 | + } |
|
| 957 | + } |
|
| 958 | + |
|
| 959 | + return '(' . substr($res, 2 + $descr['niv']) . ')'; |
|
| 960 | + } |
|
| 961 | + } else { |
|
| 962 | + $nom = $descr['nom'] . $id_boucle . ($descr['niv'] ?: ''); |
|
| 963 | + |
|
| 964 | + return "join('', array_map('array_shift', \$GLOBALS['debug_objets']['sequence']['$nom'] = array(" . join( |
|
| 965 | + " ,\n$tab", |
|
| 966 | + $codes |
|
| 967 | + ) . ')))'; |
|
| 968 | + } |
|
| 969 | 969 | } |
| 970 | 970 | |
| 971 | 971 | |
@@ -984,212 +984,212 @@ discard block |
||
| 984 | 984 | */ |
| 985 | 985 | function compile_cas($tableau, $descr, &$boucles, $id_boucle) { |
| 986 | 986 | |
| 987 | - $codes = []; |
|
| 988 | - // cas de la boucle recursive |
|
| 989 | - if (is_array($id_boucle)) { |
|
| 990 | - $id_boucle = $id_boucle[0]; |
|
| 991 | - } |
|
| 992 | - $type = !$id_boucle ? '' : $boucles[$id_boucle]->type_requete; |
|
| 993 | - $tab = str_repeat("\t", ++$descr['niv']); |
|
| 994 | - $mode = _request('var_mode_affiche'); |
|
| 995 | - $err_e_c = ''; |
|
| 996 | - // chaque commentaire introduit dans le code doit commencer |
|
| 997 | - // par un caractere distinguant le cas, pour exploitation par debug. |
|
| 998 | - foreach ($tableau as $p) { |
|
| 999 | - switch ($p->type) { |
|
| 1000 | - // texte seul |
|
| 1001 | - case 'texte': |
|
| 1002 | - $code = sandbox_composer_texte($p->texte, $p); |
|
| 1003 | - $commentaire = strlen($p->texte) . ' signes'; |
|
| 1004 | - $avant = ''; |
|
| 1005 | - $apres = ''; |
|
| 1006 | - $altern = "''"; |
|
| 1007 | - break; |
|
| 1008 | - |
|
| 1009 | - case 'polyglotte': |
|
| 1010 | - $code = ''; |
|
| 1011 | - foreach ($p->traductions as $k => $v) { |
|
| 1012 | - $code .= ",'" . |
|
| 1013 | - str_replace(['\\', "'"], ['\\\\', "\\'"], $k) . |
|
| 1014 | - "' => '" . |
|
| 1015 | - str_replace(['\\', "'"], ['\\\\', "\\'"], $v) . |
|
| 1016 | - "'"; |
|
| 1017 | - } |
|
| 1018 | - $code = 'choisir_traduction(array(' . |
|
| 1019 | - substr($code, 1) . |
|
| 1020 | - '))'; |
|
| 1021 | - $commentaire = '&'; |
|
| 1022 | - $avant = ''; |
|
| 1023 | - $apres = ''; |
|
| 1024 | - $altern = "''"; |
|
| 1025 | - break; |
|
| 1026 | - |
|
| 1027 | - // inclure |
|
| 1028 | - case 'include': |
|
| 1029 | - $p->descr = $descr; |
|
| 1030 | - $code = calculer_inclure($p, $boucles, $id_boucle); |
|
| 1031 | - if ($code === false) { |
|
| 1032 | - $err_e_c = true; |
|
| 1033 | - $code = "''"; |
|
| 1034 | - } else { |
|
| 1035 | - $commentaire = '<INCLURE ' . addslashes(str_replace("\n", ' ', $code)) . '>'; |
|
| 1036 | - $avant = ''; |
|
| 1037 | - $apres = ''; |
|
| 1038 | - $altern = "''"; |
|
| 1039 | - } |
|
| 1040 | - break; |
|
| 1041 | - |
|
| 1042 | - // boucle |
|
| 1043 | - case TYPE_RECURSIF: |
|
| 1044 | - $nom = $p->id_boucle; |
|
| 1045 | - $newdescr = $descr; |
|
| 1046 | - $newdescr['id_mere'] = $nom; |
|
| 1047 | - $newdescr['niv']++; |
|
| 1048 | - $preaff = calculer_liste($p->preaff, $newdescr, $boucles, $id_boucle); |
|
| 1049 | - $avant = calculer_liste($p->avant, $newdescr, $boucles, $id_boucle); |
|
| 1050 | - $apres = calculer_liste($p->apres, $newdescr, $boucles, $id_boucle); |
|
| 1051 | - $postaff = calculer_liste($p->postaff, $newdescr, $boucles, $id_boucle); |
|
| 1052 | - $newdescr['niv']--; |
|
| 1053 | - $altern = calculer_liste($p->altern, $newdescr, $boucles, $id_boucle); |
|
| 1054 | - if ( |
|
| 1055 | - $preaff === false |
|
| 1056 | - || $avant === false |
|
| 1057 | - || $apres === false |
|
| 1058 | - || $altern === false |
|
| 1059 | - || $postaff === false |
|
| 1060 | - ) { |
|
| 1061 | - $err_e_c = true; |
|
| 1062 | - $code = "''"; |
|
| 1063 | - } else { |
|
| 1064 | - $code = 'BOUCLE' . |
|
| 1065 | - str_replace('-', '_', $nom) . $descr['nom'] . |
|
| 1066 | - '($Cache, $Pile, $doublons, $Numrows, $SP)'; |
|
| 1067 | - $commentaire = "?$nom"; |
|
| 1068 | - if ( |
|
| 1069 | - !$boucles[$nom]->milieu |
|
| 1070 | - && $boucles[$nom]->type_requete <> TYPE_RECURSIF |
|
| 1071 | - ) { |
|
| 1072 | - if ($preaff != "''") { |
|
| 1073 | - $code .= "\n. $preaff"; |
|
| 1074 | - } |
|
| 1075 | - if ($altern != "''") { |
|
| 1076 | - $code .= "\n. $altern"; |
|
| 1077 | - } |
|
| 1078 | - if ($postaff != "''") { |
|
| 1079 | - $code .= "\n. $postaff"; |
|
| 1080 | - } |
|
| 1081 | - if ($avant <> "''" || $apres <> "''") { |
|
| 1082 | - spip_log("boucle $nom toujours vide, code superflu dans $descr[sourcefile]"); |
|
| 1083 | - } |
|
| 1084 | - $avant = $apres = $altern = "''"; |
|
| 1085 | - } else { |
|
| 1086 | - if ($preaff != "''") { |
|
| 1087 | - $avant = compile_concatene_parties_codes($preaff, $avant); |
|
| 1088 | - $altern = compile_concatene_parties_codes($preaff, $altern); |
|
| 1089 | - } |
|
| 1090 | - if ($postaff != "''") { |
|
| 1091 | - $apres = compile_concatene_parties_codes($apres, $postaff); |
|
| 1092 | - $altern = compile_concatene_parties_codes($altern, $postaff); |
|
| 1093 | - } |
|
| 1094 | - if ($altern != "''") { |
|
| 1095 | - $altern = "($altern)"; |
|
| 1096 | - } |
|
| 1097 | - } |
|
| 1098 | - } |
|
| 1099 | - break; |
|
| 1100 | - |
|
| 1101 | - case 'idiome': |
|
| 1102 | - $l = []; |
|
| 1103 | - $code = ''; |
|
| 1104 | - foreach ($p->arg as $k => $v) { |
|
| 1105 | - $_v = calculer_liste($v, $descr, $boucles, $id_boucle); |
|
| 1106 | - if ($k) { |
|
| 1107 | - $l[] = _q($k) . ' => ' . $_v; |
|
| 1108 | - } else { |
|
| 1109 | - $code = $_v; |
|
| 1110 | - } |
|
| 1111 | - } |
|
| 1112 | - // Si le module n'est pas fourni, l'expliciter sauf si calculé |
|
| 1113 | - if ($p->module) { |
|
| 1114 | - $m = $p->module . ':' . $p->nom_champ; |
|
| 1115 | - } elseif ($p->nom_champ) { |
|
| 1116 | - $m = MODULES_IDIOMES . ':' . $p->nom_champ; |
|
| 1117 | - } else { |
|
| 1118 | - $m = ''; |
|
| 1119 | - } |
|
| 1120 | - |
|
| 1121 | - $code = (!$code ? "'$m'" : |
|
| 1122 | - ($m ? "'$m' . $code" : |
|
| 1123 | - ("(strpos(\$x=$code, ':') ? \$x : ('" . MODULES_IDIOMES . ":' . \$x))"))) |
|
| 1124 | - . (!$l ? '' : (', array(' . implode(",\n", $l) . ')')); |
|
| 1125 | - $code = "_T($code)"; |
|
| 1126 | - if ($p->param) { |
|
| 1127 | - $p->id_boucle = $id_boucle; |
|
| 1128 | - $p->boucles = &$boucles; |
|
| 1129 | - $code = compose_filtres($p, $code); |
|
| 1130 | - } |
|
| 1131 | - $commentaire = ':'; |
|
| 1132 | - $avant = ''; |
|
| 1133 | - $apres = ''; |
|
| 1134 | - $altern = "''"; |
|
| 1135 | - break; |
|
| 1136 | - |
|
| 1137 | - case 'champ': |
|
| 1138 | - // cette structure pourrait etre completee des le phrase' (a faire) |
|
| 1139 | - $p->id_boucle = $id_boucle; |
|
| 1140 | - $p->boucles = &$boucles; |
|
| 1141 | - $p->descr = $descr; |
|
| 1142 | - #$p->interdire_scripts = true; |
|
| 1143 | - $p->type_requete = $type; |
|
| 1144 | - |
|
| 1145 | - $code = calculer_champ($p); |
|
| 1146 | - $commentaire = '#' . $p->nom_champ . $p->etoile; |
|
| 1147 | - $avant = calculer_liste( |
|
| 1148 | - $p->avant, |
|
| 1149 | - $descr, |
|
| 1150 | - $boucles, |
|
| 1151 | - $id_boucle |
|
| 1152 | - ); |
|
| 1153 | - $apres = calculer_liste( |
|
| 1154 | - $p->apres, |
|
| 1155 | - $descr, |
|
| 1156 | - $boucles, |
|
| 1157 | - $id_boucle |
|
| 1158 | - ); |
|
| 1159 | - $altern = "''"; |
|
| 1160 | - // Si la valeur est destinee a une comparaison a '' |
|
| 1161 | - // forcer la conversion en une chaine par strval |
|
| 1162 | - // si ca peut etre autre chose qu'une chaine |
|
| 1163 | - if ( |
|
| 1164 | - ($avant != "''" || $apres != "''") |
|
| 1165 | - && $code[0] != "'" |
|
| 1166 | - && !preg_match(_REGEXP_COND_VIDE_NONVIDE, $code) |
|
| 1167 | - && !preg_match(_REGEXP_COND_NONVIDE_VIDE, $code) |
|
| 1168 | - && !preg_match(_REGEXP_CONCAT_NON_VIDE, $code) |
|
| 1169 | - ) { |
|
| 1170 | - $code = "strval($code)"; |
|
| 1171 | - } |
|
| 1172 | - break; |
|
| 1173 | - |
|
| 1174 | - default: |
|
| 1175 | - // Erreur de construction de l'arbre de syntaxe abstraite |
|
| 1176 | - $code = "''"; |
|
| 1177 | - $p->descr = $descr; |
|
| 1178 | - $err_e_c = _T('zbug_erreur_compilation'); |
|
| 1179 | - erreur_squelette($err_e_c, $p); |
|
| 1180 | - } // switch |
|
| 1181 | - |
|
| 1182 | - if ($code != "''") { |
|
| 1183 | - $code = compile_retour($code, $avant, $apres, $altern, $tab, $descr['niv']); |
|
| 1184 | - $codes[] = (($mode == 'validation') ? |
|
| 1185 | - "array($code, '$commentaire', " . $p->ligne . ')' |
|
| 1186 | - : (($mode == 'code') ? |
|
| 1187 | - "\n// $commentaire\n$code" : |
|
| 1188 | - $code)); |
|
| 1189 | - } |
|
| 1190 | - } // foreach |
|
| 1191 | - |
|
| 1192 | - return $err_e_c ? false : $codes; |
|
| 987 | + $codes = []; |
|
| 988 | + // cas de la boucle recursive |
|
| 989 | + if (is_array($id_boucle)) { |
|
| 990 | + $id_boucle = $id_boucle[0]; |
|
| 991 | + } |
|
| 992 | + $type = !$id_boucle ? '' : $boucles[$id_boucle]->type_requete; |
|
| 993 | + $tab = str_repeat("\t", ++$descr['niv']); |
|
| 994 | + $mode = _request('var_mode_affiche'); |
|
| 995 | + $err_e_c = ''; |
|
| 996 | + // chaque commentaire introduit dans le code doit commencer |
|
| 997 | + // par un caractere distinguant le cas, pour exploitation par debug. |
|
| 998 | + foreach ($tableau as $p) { |
|
| 999 | + switch ($p->type) { |
|
| 1000 | + // texte seul |
|
| 1001 | + case 'texte': |
|
| 1002 | + $code = sandbox_composer_texte($p->texte, $p); |
|
| 1003 | + $commentaire = strlen($p->texte) . ' signes'; |
|
| 1004 | + $avant = ''; |
|
| 1005 | + $apres = ''; |
|
| 1006 | + $altern = "''"; |
|
| 1007 | + break; |
|
| 1008 | + |
|
| 1009 | + case 'polyglotte': |
|
| 1010 | + $code = ''; |
|
| 1011 | + foreach ($p->traductions as $k => $v) { |
|
| 1012 | + $code .= ",'" . |
|
| 1013 | + str_replace(['\\', "'"], ['\\\\', "\\'"], $k) . |
|
| 1014 | + "' => '" . |
|
| 1015 | + str_replace(['\\', "'"], ['\\\\', "\\'"], $v) . |
|
| 1016 | + "'"; |
|
| 1017 | + } |
|
| 1018 | + $code = 'choisir_traduction(array(' . |
|
| 1019 | + substr($code, 1) . |
|
| 1020 | + '))'; |
|
| 1021 | + $commentaire = '&'; |
|
| 1022 | + $avant = ''; |
|
| 1023 | + $apres = ''; |
|
| 1024 | + $altern = "''"; |
|
| 1025 | + break; |
|
| 1026 | + |
|
| 1027 | + // inclure |
|
| 1028 | + case 'include': |
|
| 1029 | + $p->descr = $descr; |
|
| 1030 | + $code = calculer_inclure($p, $boucles, $id_boucle); |
|
| 1031 | + if ($code === false) { |
|
| 1032 | + $err_e_c = true; |
|
| 1033 | + $code = "''"; |
|
| 1034 | + } else { |
|
| 1035 | + $commentaire = '<INCLURE ' . addslashes(str_replace("\n", ' ', $code)) . '>'; |
|
| 1036 | + $avant = ''; |
|
| 1037 | + $apres = ''; |
|
| 1038 | + $altern = "''"; |
|
| 1039 | + } |
|
| 1040 | + break; |
|
| 1041 | + |
|
| 1042 | + // boucle |
|
| 1043 | + case TYPE_RECURSIF: |
|
| 1044 | + $nom = $p->id_boucle; |
|
| 1045 | + $newdescr = $descr; |
|
| 1046 | + $newdescr['id_mere'] = $nom; |
|
| 1047 | + $newdescr['niv']++; |
|
| 1048 | + $preaff = calculer_liste($p->preaff, $newdescr, $boucles, $id_boucle); |
|
| 1049 | + $avant = calculer_liste($p->avant, $newdescr, $boucles, $id_boucle); |
|
| 1050 | + $apres = calculer_liste($p->apres, $newdescr, $boucles, $id_boucle); |
|
| 1051 | + $postaff = calculer_liste($p->postaff, $newdescr, $boucles, $id_boucle); |
|
| 1052 | + $newdescr['niv']--; |
|
| 1053 | + $altern = calculer_liste($p->altern, $newdescr, $boucles, $id_boucle); |
|
| 1054 | + if ( |
|
| 1055 | + $preaff === false |
|
| 1056 | + || $avant === false |
|
| 1057 | + || $apres === false |
|
| 1058 | + || $altern === false |
|
| 1059 | + || $postaff === false |
|
| 1060 | + ) { |
|
| 1061 | + $err_e_c = true; |
|
| 1062 | + $code = "''"; |
|
| 1063 | + } else { |
|
| 1064 | + $code = 'BOUCLE' . |
|
| 1065 | + str_replace('-', '_', $nom) . $descr['nom'] . |
|
| 1066 | + '($Cache, $Pile, $doublons, $Numrows, $SP)'; |
|
| 1067 | + $commentaire = "?$nom"; |
|
| 1068 | + if ( |
|
| 1069 | + !$boucles[$nom]->milieu |
|
| 1070 | + && $boucles[$nom]->type_requete <> TYPE_RECURSIF |
|
| 1071 | + ) { |
|
| 1072 | + if ($preaff != "''") { |
|
| 1073 | + $code .= "\n. $preaff"; |
|
| 1074 | + } |
|
| 1075 | + if ($altern != "''") { |
|
| 1076 | + $code .= "\n. $altern"; |
|
| 1077 | + } |
|
| 1078 | + if ($postaff != "''") { |
|
| 1079 | + $code .= "\n. $postaff"; |
|
| 1080 | + } |
|
| 1081 | + if ($avant <> "''" || $apres <> "''") { |
|
| 1082 | + spip_log("boucle $nom toujours vide, code superflu dans $descr[sourcefile]"); |
|
| 1083 | + } |
|
| 1084 | + $avant = $apres = $altern = "''"; |
|
| 1085 | + } else { |
|
| 1086 | + if ($preaff != "''") { |
|
| 1087 | + $avant = compile_concatene_parties_codes($preaff, $avant); |
|
| 1088 | + $altern = compile_concatene_parties_codes($preaff, $altern); |
|
| 1089 | + } |
|
| 1090 | + if ($postaff != "''") { |
|
| 1091 | + $apres = compile_concatene_parties_codes($apres, $postaff); |
|
| 1092 | + $altern = compile_concatene_parties_codes($altern, $postaff); |
|
| 1093 | + } |
|
| 1094 | + if ($altern != "''") { |
|
| 1095 | + $altern = "($altern)"; |
|
| 1096 | + } |
|
| 1097 | + } |
|
| 1098 | + } |
|
| 1099 | + break; |
|
| 1100 | + |
|
| 1101 | + case 'idiome': |
|
| 1102 | + $l = []; |
|
| 1103 | + $code = ''; |
|
| 1104 | + foreach ($p->arg as $k => $v) { |
|
| 1105 | + $_v = calculer_liste($v, $descr, $boucles, $id_boucle); |
|
| 1106 | + if ($k) { |
|
| 1107 | + $l[] = _q($k) . ' => ' . $_v; |
|
| 1108 | + } else { |
|
| 1109 | + $code = $_v; |
|
| 1110 | + } |
|
| 1111 | + } |
|
| 1112 | + // Si le module n'est pas fourni, l'expliciter sauf si calculé |
|
| 1113 | + if ($p->module) { |
|
| 1114 | + $m = $p->module . ':' . $p->nom_champ; |
|
| 1115 | + } elseif ($p->nom_champ) { |
|
| 1116 | + $m = MODULES_IDIOMES . ':' . $p->nom_champ; |
|
| 1117 | + } else { |
|
| 1118 | + $m = ''; |
|
| 1119 | + } |
|
| 1120 | + |
|
| 1121 | + $code = (!$code ? "'$m'" : |
|
| 1122 | + ($m ? "'$m' . $code" : |
|
| 1123 | + ("(strpos(\$x=$code, ':') ? \$x : ('" . MODULES_IDIOMES . ":' . \$x))"))) |
|
| 1124 | + . (!$l ? '' : (', array(' . implode(",\n", $l) . ')')); |
|
| 1125 | + $code = "_T($code)"; |
|
| 1126 | + if ($p->param) { |
|
| 1127 | + $p->id_boucle = $id_boucle; |
|
| 1128 | + $p->boucles = &$boucles; |
|
| 1129 | + $code = compose_filtres($p, $code); |
|
| 1130 | + } |
|
| 1131 | + $commentaire = ':'; |
|
| 1132 | + $avant = ''; |
|
| 1133 | + $apres = ''; |
|
| 1134 | + $altern = "''"; |
|
| 1135 | + break; |
|
| 1136 | + |
|
| 1137 | + case 'champ': |
|
| 1138 | + // cette structure pourrait etre completee des le phrase' (a faire) |
|
| 1139 | + $p->id_boucle = $id_boucle; |
|
| 1140 | + $p->boucles = &$boucles; |
|
| 1141 | + $p->descr = $descr; |
|
| 1142 | + #$p->interdire_scripts = true; |
|
| 1143 | + $p->type_requete = $type; |
|
| 1144 | + |
|
| 1145 | + $code = calculer_champ($p); |
|
| 1146 | + $commentaire = '#' . $p->nom_champ . $p->etoile; |
|
| 1147 | + $avant = calculer_liste( |
|
| 1148 | + $p->avant, |
|
| 1149 | + $descr, |
|
| 1150 | + $boucles, |
|
| 1151 | + $id_boucle |
|
| 1152 | + ); |
|
| 1153 | + $apres = calculer_liste( |
|
| 1154 | + $p->apres, |
|
| 1155 | + $descr, |
|
| 1156 | + $boucles, |
|
| 1157 | + $id_boucle |
|
| 1158 | + ); |
|
| 1159 | + $altern = "''"; |
|
| 1160 | + // Si la valeur est destinee a une comparaison a '' |
|
| 1161 | + // forcer la conversion en une chaine par strval |
|
| 1162 | + // si ca peut etre autre chose qu'une chaine |
|
| 1163 | + if ( |
|
| 1164 | + ($avant != "''" || $apres != "''") |
|
| 1165 | + && $code[0] != "'" |
|
| 1166 | + && !preg_match(_REGEXP_COND_VIDE_NONVIDE, $code) |
|
| 1167 | + && !preg_match(_REGEXP_COND_NONVIDE_VIDE, $code) |
|
| 1168 | + && !preg_match(_REGEXP_CONCAT_NON_VIDE, $code) |
|
| 1169 | + ) { |
|
| 1170 | + $code = "strval($code)"; |
|
| 1171 | + } |
|
| 1172 | + break; |
|
| 1173 | + |
|
| 1174 | + default: |
|
| 1175 | + // Erreur de construction de l'arbre de syntaxe abstraite |
|
| 1176 | + $code = "''"; |
|
| 1177 | + $p->descr = $descr; |
|
| 1178 | + $err_e_c = _T('zbug_erreur_compilation'); |
|
| 1179 | + erreur_squelette($err_e_c, $p); |
|
| 1180 | + } // switch |
|
| 1181 | + |
|
| 1182 | + if ($code != "''") { |
|
| 1183 | + $code = compile_retour($code, $avant, $apres, $altern, $tab, $descr['niv']); |
|
| 1184 | + $codes[] = (($mode == 'validation') ? |
|
| 1185 | + "array($code, '$commentaire', " . $p->ligne . ')' |
|
| 1186 | + : (($mode == 'code') ? |
|
| 1187 | + "\n// $commentaire\n$code" : |
|
| 1188 | + $code)); |
|
| 1189 | + } |
|
| 1190 | + } // foreach |
|
| 1191 | + |
|
| 1192 | + return $err_e_c ? false : $codes; |
|
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | /** |
@@ -1199,13 +1199,13 @@ discard block |
||
| 1199 | 1199 | * @return string |
| 1200 | 1200 | */ |
| 1201 | 1201 | function compile_concatene_parties_codes($partie1, $partie2) { |
| 1202 | - if ($partie1 === "''") { |
|
| 1203 | - return $partie2; |
|
| 1204 | - } |
|
| 1205 | - if ($partie2 === "''") { |
|
| 1206 | - return $partie1; |
|
| 1207 | - } |
|
| 1208 | - return "$partie1\n. $partie2"; |
|
| 1202 | + if ($partie1 === "''") { |
|
| 1203 | + return $partie2; |
|
| 1204 | + } |
|
| 1205 | + if ($partie2 === "''") { |
|
| 1206 | + return $partie1; |
|
| 1207 | + } |
|
| 1208 | + return "$partie1\n. $partie2"; |
|
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | 1211 | |
@@ -1229,56 +1229,56 @@ discard block |
||
| 1229 | 1229 | * @return mixed|string |
| 1230 | 1230 | */ |
| 1231 | 1231 | function compile_retour($code, $avant, $apres, $altern, $tab, $n) { |
| 1232 | - if ($avant === "''") { |
|
| 1233 | - $avant = ''; |
|
| 1234 | - } |
|
| 1235 | - if ($apres === "''") { |
|
| 1236 | - $apres = ''; |
|
| 1237 | - } |
|
| 1238 | - if ($avant || $apres || $altern !== "''") { |
|
| 1239 | - if (preg_match(_REGEXP_CONCAT_NON_VIDE, $code)) { |
|
| 1240 | - $t = $code; |
|
| 1241 | - $cond = ''; |
|
| 1242 | - } elseif (preg_match(_REGEXP_COND_VIDE_NONVIDE, $code, $r)) { |
|
| 1243 | - $t = $r[2]; |
|
| 1244 | - $cond = '!' . $r[1]; |
|
| 1245 | - } else { |
|
| 1246 | - if (preg_match(_REGEXP_COND_NONVIDE_VIDE, $code, $r)) { |
|
| 1247 | - $t = $r[2]; |
|
| 1248 | - $cond = $r[1]; |
|
| 1249 | - } else { |
|
| 1250 | - $t = '$t' . $n; |
|
| 1251 | - $cond = "($t = $code)!==''"; |
|
| 1252 | - } |
|
| 1253 | - } |
|
| 1254 | - |
|
| 1255 | - $res = (!$avant ? '' : "$avant . ") . |
|
| 1256 | - $t . |
|
| 1257 | - (!$apres ? '' : " . $apres"); |
|
| 1258 | - |
|
| 1259 | - if ($res !== $t) { |
|
| 1260 | - $res = "($res)"; |
|
| 1261 | - } |
|
| 1262 | - |
|
| 1263 | - $code = (!$cond ? $res : "($cond ?\n\t$tab$res :\n\t$tab$altern)"); |
|
| 1264 | - } |
|
| 1265 | - |
|
| 1266 | - return $code; |
|
| 1232 | + if ($avant === "''") { |
|
| 1233 | + $avant = ''; |
|
| 1234 | + } |
|
| 1235 | + if ($apres === "''") { |
|
| 1236 | + $apres = ''; |
|
| 1237 | + } |
|
| 1238 | + if ($avant || $apres || $altern !== "''") { |
|
| 1239 | + if (preg_match(_REGEXP_CONCAT_NON_VIDE, $code)) { |
|
| 1240 | + $t = $code; |
|
| 1241 | + $cond = ''; |
|
| 1242 | + } elseif (preg_match(_REGEXP_COND_VIDE_NONVIDE, $code, $r)) { |
|
| 1243 | + $t = $r[2]; |
|
| 1244 | + $cond = '!' . $r[1]; |
|
| 1245 | + } else { |
|
| 1246 | + if (preg_match(_REGEXP_COND_NONVIDE_VIDE, $code, $r)) { |
|
| 1247 | + $t = $r[2]; |
|
| 1248 | + $cond = $r[1]; |
|
| 1249 | + } else { |
|
| 1250 | + $t = '$t' . $n; |
|
| 1251 | + $cond = "($t = $code)!==''"; |
|
| 1252 | + } |
|
| 1253 | + } |
|
| 1254 | + |
|
| 1255 | + $res = (!$avant ? '' : "$avant . ") . |
|
| 1256 | + $t . |
|
| 1257 | + (!$apres ? '' : " . $apres"); |
|
| 1258 | + |
|
| 1259 | + if ($res !== $t) { |
|
| 1260 | + $res = "($res)"; |
|
| 1261 | + } |
|
| 1262 | + |
|
| 1263 | + $code = (!$cond ? $res : "($cond ?\n\t$tab$res :\n\t$tab$altern)"); |
|
| 1264 | + } |
|
| 1265 | + |
|
| 1266 | + return $code; |
|
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 1269 | 1269 | |
| 1270 | 1270 | function compile_inclure_doublons($lexemes) { |
| 1271 | - foreach ($lexemes as $v) { |
|
| 1272 | - if ($v->type === 'include' && $v->param) { |
|
| 1273 | - foreach ($v->param as $r) { |
|
| 1274 | - if (trim($r[0]) === 'doublons') { |
|
| 1275 | - return true; |
|
| 1276 | - } |
|
| 1277 | - } |
|
| 1278 | - } |
|
| 1279 | - } |
|
| 1280 | - |
|
| 1281 | - return false; |
|
| 1271 | + foreach ($lexemes as $v) { |
|
| 1272 | + if ($v->type === 'include' && $v->param) { |
|
| 1273 | + foreach ($v->param as $r) { |
|
| 1274 | + if (trim($r[0]) === 'doublons') { |
|
| 1275 | + return true; |
|
| 1276 | + } |
|
| 1277 | + } |
|
| 1278 | + } |
|
| 1279 | + } |
|
| 1280 | + |
|
| 1281 | + return false; |
|
| 1282 | 1282 | } |
| 1283 | 1283 | |
| 1284 | 1284 | // Prend en argument le texte d'un squelette, le nom de son fichier d'origine, |
@@ -1297,355 +1297,355 @@ discard block |
||
| 1297 | 1297 | // En cas d'erreur, elle retournera un tableau des 2 premiers elements seulement |
| 1298 | 1298 | |
| 1299 | 1299 | function public_compiler_dist($squelette, $nom, $gram, $sourcefile, string $connect = '') { |
| 1300 | - // Pre-traitement : reperer le charset du squelette, et le convertir |
|
| 1301 | - // Bonus : supprime le BOM |
|
| 1302 | - include_spip('inc/charsets'); |
|
| 1303 | - $squelette = transcoder_page($squelette); |
|
| 1304 | - |
|
| 1305 | - // rendre inertes les echappements de #[](){}<> |
|
| 1306 | - $i = 0; |
|
| 1307 | - while (str_contains($squelette, $inerte = '-INERTE' . $i)) { |
|
| 1308 | - $i++; |
|
| 1309 | - } |
|
| 1310 | - $squelette = preg_replace_callback( |
|
| 1311 | - ',\\\\([#[()\]{}<>]),', |
|
| 1312 | - fn($a) => "$inerte-" . ord($a[1]) . '-', |
|
| 1313 | - $squelette, |
|
| 1314 | - -1, |
|
| 1315 | - $esc |
|
| 1316 | - ); |
|
| 1317 | - |
|
| 1318 | - $descr = [ |
|
| 1319 | - 'nom' => $nom, |
|
| 1320 | - 'gram' => $gram, |
|
| 1321 | - 'sourcefile' => $sourcefile, |
|
| 1322 | - 'squelette' => $squelette |
|
| 1323 | - ]; |
|
| 1324 | - |
|
| 1325 | - // Phraser le squelette, selon sa grammaire |
|
| 1326 | - |
|
| 1327 | - $boucles = []; |
|
| 1328 | - $f = charger_fonction('phraser_' . $gram, 'public'); |
|
| 1329 | - |
|
| 1330 | - $squelette = $f($squelette, '', $boucles, $descr); |
|
| 1331 | - |
|
| 1332 | - $boucles = compiler_squelette($squelette, $boucles, $nom, $descr, $sourcefile, $connect); |
|
| 1333 | - |
|
| 1334 | - // restituer les echappements |
|
| 1335 | - if ($esc) { |
|
| 1336 | - foreach ($boucles as $i => $boucle) { |
|
| 1337 | - $boucles[$i]->return = preg_replace_callback( |
|
| 1338 | - ",$inerte-(\d+)-,", |
|
| 1339 | - fn ($a) => chr((int) $a[1]), |
|
| 1340 | - $boucle->return |
|
| 1341 | - ); |
|
| 1342 | - $boucles[$i]->descr['squelette'] = preg_replace_callback( |
|
| 1343 | - ",$inerte-(\d+)-,", |
|
| 1344 | - fn ($a) => '\\\\' . chr($a[1]), |
|
| 1345 | - $boucle->descr['squelette'] |
|
| 1346 | - ); |
|
| 1347 | - } |
|
| 1348 | - } |
|
| 1349 | - |
|
| 1350 | - $debug = ($boucles && defined('_VAR_MODE') && _VAR_MODE == 'debug'); |
|
| 1351 | - if ($debug) { |
|
| 1352 | - include_spip('public/decompiler'); |
|
| 1353 | - foreach ($boucles as $id => $boucle) { |
|
| 1354 | - if ($id) { |
|
| 1355 | - $decomp = "\n/* BOUCLE " . |
|
| 1356 | - $boucle->type_requete . |
|
| 1357 | - ' ' . |
|
| 1358 | - str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')) . |
|
| 1359 | - ($boucle->debug ? "\n *\n * " . implode("\n * ", $boucle->debug) . "\n" : '') . |
|
| 1360 | - " */\n"; |
|
| 1361 | - } else { |
|
| 1362 | - $decomp = ("\n/*\n" . |
|
| 1363 | - str_replace('*/', '* /', public_decompiler($squelette, $gram)) |
|
| 1364 | - . "\n*/"); |
|
| 1365 | - } |
|
| 1366 | - $boucles[$id]->return = $decomp . $boucle->return; |
|
| 1367 | - $GLOBALS['debug_objets']['code'][$nom . $id] = $boucle->return; |
|
| 1368 | - } |
|
| 1369 | - } |
|
| 1370 | - |
|
| 1371 | - return $boucles; |
|
| 1300 | + // Pre-traitement : reperer le charset du squelette, et le convertir |
|
| 1301 | + // Bonus : supprime le BOM |
|
| 1302 | + include_spip('inc/charsets'); |
|
| 1303 | + $squelette = transcoder_page($squelette); |
|
| 1304 | + |
|
| 1305 | + // rendre inertes les echappements de #[](){}<> |
|
| 1306 | + $i = 0; |
|
| 1307 | + while (str_contains($squelette, $inerte = '-INERTE' . $i)) { |
|
| 1308 | + $i++; |
|
| 1309 | + } |
|
| 1310 | + $squelette = preg_replace_callback( |
|
| 1311 | + ',\\\\([#[()\]{}<>]),', |
|
| 1312 | + fn($a) => "$inerte-" . ord($a[1]) . '-', |
|
| 1313 | + $squelette, |
|
| 1314 | + -1, |
|
| 1315 | + $esc |
|
| 1316 | + ); |
|
| 1317 | + |
|
| 1318 | + $descr = [ |
|
| 1319 | + 'nom' => $nom, |
|
| 1320 | + 'gram' => $gram, |
|
| 1321 | + 'sourcefile' => $sourcefile, |
|
| 1322 | + 'squelette' => $squelette |
|
| 1323 | + ]; |
|
| 1324 | + |
|
| 1325 | + // Phraser le squelette, selon sa grammaire |
|
| 1326 | + |
|
| 1327 | + $boucles = []; |
|
| 1328 | + $f = charger_fonction('phraser_' . $gram, 'public'); |
|
| 1329 | + |
|
| 1330 | + $squelette = $f($squelette, '', $boucles, $descr); |
|
| 1331 | + |
|
| 1332 | + $boucles = compiler_squelette($squelette, $boucles, $nom, $descr, $sourcefile, $connect); |
|
| 1333 | + |
|
| 1334 | + // restituer les echappements |
|
| 1335 | + if ($esc) { |
|
| 1336 | + foreach ($boucles as $i => $boucle) { |
|
| 1337 | + $boucles[$i]->return = preg_replace_callback( |
|
| 1338 | + ",$inerte-(\d+)-,", |
|
| 1339 | + fn ($a) => chr((int) $a[1]), |
|
| 1340 | + $boucle->return |
|
| 1341 | + ); |
|
| 1342 | + $boucles[$i]->descr['squelette'] = preg_replace_callback( |
|
| 1343 | + ",$inerte-(\d+)-,", |
|
| 1344 | + fn ($a) => '\\\\' . chr($a[1]), |
|
| 1345 | + $boucle->descr['squelette'] |
|
| 1346 | + ); |
|
| 1347 | + } |
|
| 1348 | + } |
|
| 1349 | + |
|
| 1350 | + $debug = ($boucles && defined('_VAR_MODE') && _VAR_MODE == 'debug'); |
|
| 1351 | + if ($debug) { |
|
| 1352 | + include_spip('public/decompiler'); |
|
| 1353 | + foreach ($boucles as $id => $boucle) { |
|
| 1354 | + if ($id) { |
|
| 1355 | + $decomp = "\n/* BOUCLE " . |
|
| 1356 | + $boucle->type_requete . |
|
| 1357 | + ' ' . |
|
| 1358 | + str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')) . |
|
| 1359 | + ($boucle->debug ? "\n *\n * " . implode("\n * ", $boucle->debug) . "\n" : '') . |
|
| 1360 | + " */\n"; |
|
| 1361 | + } else { |
|
| 1362 | + $decomp = ("\n/*\n" . |
|
| 1363 | + str_replace('*/', '* /', public_decompiler($squelette, $gram)) |
|
| 1364 | + . "\n*/"); |
|
| 1365 | + } |
|
| 1366 | + $boucles[$id]->return = $decomp . $boucle->return; |
|
| 1367 | + $GLOBALS['debug_objets']['code'][$nom . $id] = $boucle->return; |
|
| 1368 | + } |
|
| 1369 | + } |
|
| 1370 | + |
|
| 1371 | + return $boucles; |
|
| 1372 | 1372 | } |
| 1373 | 1373 | |
| 1374 | 1374 | // Point d'entree pour arbre de syntaxe abstraite fourni en premier argument |
| 1375 | 1375 | // Autres specifications comme ci-dessus |
| 1376 | 1376 | |
| 1377 | 1377 | function compiler_squelette($squelette, $boucles, $nom, $descr, $sourcefile, string $connect = '') { |
| 1378 | - static $trouver_table; |
|
| 1379 | - spip_timer('calcul_skel'); |
|
| 1380 | - |
|
| 1381 | - if (defined('_VAR_MODE') && _VAR_MODE == 'debug') { |
|
| 1382 | - $GLOBALS['debug_objets']['squelette'][$nom] = $descr['squelette']; |
|
| 1383 | - $GLOBALS['debug_objets']['sourcefile'][$nom] = $sourcefile; |
|
| 1384 | - |
|
| 1385 | - if (!isset($GLOBALS['debug_objets']['principal'])) { |
|
| 1386 | - $GLOBALS['debug_objets']['principal'] = $nom; |
|
| 1387 | - } |
|
| 1388 | - } |
|
| 1389 | - foreach ($boucles as $id => $boucle) { |
|
| 1390 | - $GLOBALS['debug_objets']['boucle'][$nom . $id] = $boucle; |
|
| 1391 | - } |
|
| 1392 | - $descr['documents'] = compile_inclure_doublons($squelette); |
|
| 1393 | - |
|
| 1394 | - // Demander la description des tables une fois pour toutes |
|
| 1395 | - if (!$trouver_table) { |
|
| 1396 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 1397 | - } |
|
| 1398 | - |
|
| 1399 | - // reperer si les doublons sont demandes |
|
| 1400 | - // pour un inclure ou une boucle document |
|
| 1401 | - // c'est utile a la fonction champs_traitements |
|
| 1402 | - foreach ($boucles as $id => $boucle) { |
|
| 1403 | - if (!($type = $boucle->type_requete)) { |
|
| 1404 | - continue; |
|
| 1405 | - } |
|
| 1406 | - if ( |
|
| 1407 | - !$descr['documents'] |
|
| 1408 | - && ( |
|
| 1409 | - $type == 'documents' && $boucle->doublons |
|
| 1410 | - || compile_inclure_doublons($boucle->avant) |
|
| 1411 | - || compile_inclure_doublons($boucle->apres) |
|
| 1412 | - || compile_inclure_doublons($boucle->milieu) |
|
| 1413 | - || compile_inclure_doublons($boucle->altern) |
|
| 1414 | - ) |
|
| 1415 | - ) { |
|
| 1416 | - $descr['documents'] = true; |
|
| 1417 | - } |
|
| 1418 | - if ($type != TYPE_RECURSIF) { |
|
| 1419 | - if (!$boucles[$id]->sql_serveur && $connect) { |
|
| 1420 | - $boucles[$id]->sql_serveur = $connect; |
|
| 1421 | - } |
|
| 1422 | - |
|
| 1423 | - // chercher dans les iterateurs du repertoire iterateur/ |
|
| 1424 | - if ( |
|
| 1425 | - $g = charger_fonction( |
|
| 1426 | - preg_replace('/\W/', '_', $boucle->type_requete), |
|
| 1427 | - 'iterateur', |
|
| 1428 | - true |
|
| 1429 | - ) |
|
| 1430 | - ) { |
|
| 1431 | - $boucles[$id] = $g($boucle); |
|
| 1432 | - |
|
| 1433 | - // sinon, en cas de requeteur d'un type predefini, |
|
| 1434 | - // utiliser les informations donnees par le requeteur |
|
| 1435 | - // cas "php:xx" et "data:xx". |
|
| 1436 | - } else { |
|
| 1437 | - if ($boucle->sql_serveur && ($requeteur = charger_fonction($boucle->sql_serveur, 'requeteur', true))) { |
|
| 1438 | - $requeteur($boucles, $boucle, $id); |
|
| 1439 | - |
|
| 1440 | - // utiliser la description des champs transmis |
|
| 1441 | - } else { |
|
| 1442 | - $show = $trouver_table($type, $boucles[$id]->sql_serveur); |
|
| 1443 | - // si la table n'existe pas avec le connecteur par defaut, |
|
| 1444 | - // c'est peut etre une table qui necessite son connecteur dedie fourni |
|
| 1445 | - // permet une ecriture allegee (GEO) -> (geo:GEO) |
|
| 1446 | - if ( |
|
| 1447 | - !$show |
|
| 1448 | - && ($show = $trouver_table($type, strtolower($type))) |
|
| 1449 | - ) { |
|
| 1450 | - $boucles[$id]->sql_serveur = strtolower($type); |
|
| 1451 | - } |
|
| 1452 | - if ($show) { |
|
| 1453 | - $boucles[$id]->show = $show; |
|
| 1454 | - // recopie les infos les plus importantes |
|
| 1455 | - $boucles[$id]->primary = $show['key']['PRIMARY KEY'] ?? ''; |
|
| 1456 | - $boucles[$id]->id_table = $x = preg_replace(',^spip_,', '', $show['id_table']); |
|
| 1457 | - $boucles[$id]->from[$x] = $nom_table = $show['table']; |
|
| 1458 | - $boucles[$id]->iterateur = 'SQL'; |
|
| 1459 | - |
|
| 1460 | - if (empty($boucles[$id]->descr)) { |
|
| 1461 | - $boucles[$id]->descr = &$descr; |
|
| 1462 | - } |
|
| 1463 | - if ( |
|
| 1464 | - !$boucles[$id]->jointures |
|
| 1465 | - && is_array($show['tables_jointures']) |
|
| 1466 | - && count($x = $show['tables_jointures']) |
|
| 1467 | - ) { |
|
| 1468 | - $boucles[$id]->jointures = $x; |
|
| 1469 | - } |
|
| 1470 | - if ($boucles[$id]->jointures_explicites) { |
|
| 1471 | - $jointures = preg_split('/\s+/', $boucles[$id]->jointures_explicites); |
|
| 1472 | - while ($j = array_pop($jointures)) { |
|
| 1473 | - array_unshift($boucles[$id]->jointures, $j); |
|
| 1474 | - } |
|
| 1475 | - } |
|
| 1476 | - } else { |
|
| 1477 | - // Pas une erreur si la table est optionnelle |
|
| 1478 | - if ($boucles[$id]->table_optionnelle) { |
|
| 1479 | - $boucles[$id]->type_requete = ''; |
|
| 1480 | - } else { |
|
| 1481 | - $boucles[$id]->type_requete = false; |
|
| 1482 | - $boucle = $boucles[$id]; |
|
| 1483 | - $x = (!$boucle->sql_serveur ? '' : |
|
| 1484 | - ($boucle->sql_serveur . ':')) . |
|
| 1485 | - $type; |
|
| 1486 | - $msg = [ |
|
| 1487 | - 'zbug_table_inconnue', |
|
| 1488 | - ['table' => $x] |
|
| 1489 | - ]; |
|
| 1490 | - erreur_squelette($msg, $boucle); |
|
| 1491 | - } |
|
| 1492 | - } |
|
| 1493 | - } |
|
| 1494 | - } |
|
| 1495 | - } |
|
| 1496 | - } |
|
| 1497 | - |
|
| 1498 | - // Commencer par reperer les boucles appelees explicitement |
|
| 1499 | - // car elles indexent les arguments de maniere derogatoire |
|
| 1500 | - foreach ($boucles as $id => $boucle) { |
|
| 1501 | - if ($boucle->type_requete == TYPE_RECURSIF && $boucle->param) { |
|
| 1502 | - $boucles[$id]->descr = &$descr; |
|
| 1503 | - $rec = &$boucles[$boucle->param[0]]; |
|
| 1504 | - if (!$rec) { |
|
| 1505 | - $msg = [ |
|
| 1506 | - 'zbug_boucle_recursive_undef', |
|
| 1507 | - ['nom' => $boucle->param[0]] |
|
| 1508 | - ]; |
|
| 1509 | - erreur_squelette($msg, $boucle); |
|
| 1510 | - $boucles[$id]->type_requete = false; |
|
| 1511 | - } else { |
|
| 1512 | - $rec->externe = $id; |
|
| 1513 | - $descr['id_mere'] = $id; |
|
| 1514 | - $boucles[$id]->return = |
|
| 1515 | - calculer_liste( |
|
| 1516 | - [$rec], |
|
| 1517 | - $descr, |
|
| 1518 | - $boucles, |
|
| 1519 | - $boucle->param |
|
| 1520 | - ); |
|
| 1521 | - } |
|
| 1522 | - } |
|
| 1523 | - } |
|
| 1524 | - foreach ($boucles as $id => $boucle) { |
|
| 1525 | - $id = strval($id); // attention au type dans index_pile |
|
| 1526 | - $type = $boucle->type_requete; |
|
| 1527 | - if ($type && $type != TYPE_RECURSIF) { |
|
| 1528 | - $res = ''; |
|
| 1529 | - if ($boucle->param) { |
|
| 1530 | - // retourne un tableau en cas d'erreur |
|
| 1531 | - $res = calculer_criteres($id, $boucles); |
|
| 1532 | - } |
|
| 1533 | - $descr['id_mere'] = $id; |
|
| 1534 | - $boucles[$id]->return = |
|
| 1535 | - calculer_liste( |
|
| 1536 | - $boucle->milieu, |
|
| 1537 | - $descr, |
|
| 1538 | - $boucles, |
|
| 1539 | - $id |
|
| 1540 | - ); |
|
| 1541 | - // Si les criteres se sont mal compiles |
|
| 1542 | - // ne pas tenter d'assembler le code final |
|
| 1543 | - // (mais compiler le corps pour detection d'erreurs) |
|
| 1544 | - if (is_array($res)) { |
|
| 1545 | - $boucles[$id]->type_requete = false; |
|
| 1546 | - } |
|
| 1547 | - } |
|
| 1548 | - } |
|
| 1549 | - |
|
| 1550 | - // idem pour la racine |
|
| 1551 | - $descr['id_mere'] = ''; |
|
| 1552 | - $corps = calculer_liste($squelette, $descr, $boucles); |
|
| 1553 | - |
|
| 1554 | - |
|
| 1555 | - // Calcul du corps de toutes les fonctions PHP, |
|
| 1556 | - // en particulier les requetes SQL et TOTAL_BOUCLE |
|
| 1557 | - // de'terminables seulement maintenant |
|
| 1558 | - |
|
| 1559 | - foreach ($boucles as $id => $boucle) { |
|
| 1560 | - $boucle = $boucles[$id] = pipeline('pre_boucle', $boucle); |
|
| 1561 | - if ($boucle->return === false) { |
|
| 1562 | - $corps = false; |
|
| 1563 | - continue; |
|
| 1564 | - } |
|
| 1565 | - // appeler la fonction de definition de la boucle |
|
| 1566 | - |
|
| 1567 | - if ($req = $boucle->type_requete) { |
|
| 1568 | - // boucle personnalisée ? |
|
| 1569 | - $table = strtoupper($boucle->type_requete); |
|
| 1570 | - $serveur = strtolower($boucle->sql_serveur); |
|
| 1571 | - if ( |
|
| 1572 | - // fonction de boucle avec serveur & table |
|
| 1573 | - ( |
|
| 1574 | - !$serveur |
|
| 1575 | - || !function_exists($f = 'boucle_' . $serveur . '_' . $table) && !function_exists($f = $f . '_dist') |
|
| 1576 | - ) |
|
| 1577 | - // fonction de boucle avec table |
|
| 1578 | - && !function_exists($f = 'boucle_' . $table) |
|
| 1579 | - && !function_exists($f = $f . '_dist') |
|
| 1580 | - ) { |
|
| 1581 | - // fonction de boucle standard |
|
| 1582 | - if (!function_exists($f = 'boucle_DEFAUT')) { |
|
| 1583 | - $f = 'boucle_DEFAUT_dist'; |
|
| 1584 | - } |
|
| 1585 | - } |
|
| 1586 | - |
|
| 1587 | - $req = "\n\n\tstatic \$command = array();\n\t" . |
|
| 1588 | - "static \$connect;\n\t" . |
|
| 1589 | - "\$command['connect'] = \$connect = " . |
|
| 1590 | - _q($boucle->sql_serveur) . |
|
| 1591 | - ';' . |
|
| 1592 | - $f($id, $boucles); |
|
| 1593 | - } else { |
|
| 1594 | - $req = ("\n\treturn '';"); |
|
| 1595 | - } |
|
| 1596 | - |
|
| 1597 | - $boucles[$id]->return = |
|
| 1598 | - "\n\nfunction BOUCLE" . strtr($id, '-', '_') . $nom . |
|
| 1599 | - '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {' . |
|
| 1600 | - $req . |
|
| 1601 | - "\n}\n"; |
|
| 1602 | - } |
|
| 1603 | - |
|
| 1604 | - // Au final, si le corps ou un critere au moins s'est mal compile |
|
| 1605 | - // retourner False, sinon inserer leur decompilation |
|
| 1606 | - if (is_bool($corps)) { |
|
| 1607 | - return false; |
|
| 1608 | - } |
|
| 1609 | - |
|
| 1610 | - $principal = "\nfunction " . $nom . '($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1378 | + static $trouver_table; |
|
| 1379 | + spip_timer('calcul_skel'); |
|
| 1380 | + |
|
| 1381 | + if (defined('_VAR_MODE') && _VAR_MODE == 'debug') { |
|
| 1382 | + $GLOBALS['debug_objets']['squelette'][$nom] = $descr['squelette']; |
|
| 1383 | + $GLOBALS['debug_objets']['sourcefile'][$nom] = $sourcefile; |
|
| 1384 | + |
|
| 1385 | + if (!isset($GLOBALS['debug_objets']['principal'])) { |
|
| 1386 | + $GLOBALS['debug_objets']['principal'] = $nom; |
|
| 1387 | + } |
|
| 1388 | + } |
|
| 1389 | + foreach ($boucles as $id => $boucle) { |
|
| 1390 | + $GLOBALS['debug_objets']['boucle'][$nom . $id] = $boucle; |
|
| 1391 | + } |
|
| 1392 | + $descr['documents'] = compile_inclure_doublons($squelette); |
|
| 1393 | + |
|
| 1394 | + // Demander la description des tables une fois pour toutes |
|
| 1395 | + if (!$trouver_table) { |
|
| 1396 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 1397 | + } |
|
| 1398 | + |
|
| 1399 | + // reperer si les doublons sont demandes |
|
| 1400 | + // pour un inclure ou une boucle document |
|
| 1401 | + // c'est utile a la fonction champs_traitements |
|
| 1402 | + foreach ($boucles as $id => $boucle) { |
|
| 1403 | + if (!($type = $boucle->type_requete)) { |
|
| 1404 | + continue; |
|
| 1405 | + } |
|
| 1406 | + if ( |
|
| 1407 | + !$descr['documents'] |
|
| 1408 | + && ( |
|
| 1409 | + $type == 'documents' && $boucle->doublons |
|
| 1410 | + || compile_inclure_doublons($boucle->avant) |
|
| 1411 | + || compile_inclure_doublons($boucle->apres) |
|
| 1412 | + || compile_inclure_doublons($boucle->milieu) |
|
| 1413 | + || compile_inclure_doublons($boucle->altern) |
|
| 1414 | + ) |
|
| 1415 | + ) { |
|
| 1416 | + $descr['documents'] = true; |
|
| 1417 | + } |
|
| 1418 | + if ($type != TYPE_RECURSIF) { |
|
| 1419 | + if (!$boucles[$id]->sql_serveur && $connect) { |
|
| 1420 | + $boucles[$id]->sql_serveur = $connect; |
|
| 1421 | + } |
|
| 1422 | + |
|
| 1423 | + // chercher dans les iterateurs du repertoire iterateur/ |
|
| 1424 | + if ( |
|
| 1425 | + $g = charger_fonction( |
|
| 1426 | + preg_replace('/\W/', '_', $boucle->type_requete), |
|
| 1427 | + 'iterateur', |
|
| 1428 | + true |
|
| 1429 | + ) |
|
| 1430 | + ) { |
|
| 1431 | + $boucles[$id] = $g($boucle); |
|
| 1432 | + |
|
| 1433 | + // sinon, en cas de requeteur d'un type predefini, |
|
| 1434 | + // utiliser les informations donnees par le requeteur |
|
| 1435 | + // cas "php:xx" et "data:xx". |
|
| 1436 | + } else { |
|
| 1437 | + if ($boucle->sql_serveur && ($requeteur = charger_fonction($boucle->sql_serveur, 'requeteur', true))) { |
|
| 1438 | + $requeteur($boucles, $boucle, $id); |
|
| 1439 | + |
|
| 1440 | + // utiliser la description des champs transmis |
|
| 1441 | + } else { |
|
| 1442 | + $show = $trouver_table($type, $boucles[$id]->sql_serveur); |
|
| 1443 | + // si la table n'existe pas avec le connecteur par defaut, |
|
| 1444 | + // c'est peut etre une table qui necessite son connecteur dedie fourni |
|
| 1445 | + // permet une ecriture allegee (GEO) -> (geo:GEO) |
|
| 1446 | + if ( |
|
| 1447 | + !$show |
|
| 1448 | + && ($show = $trouver_table($type, strtolower($type))) |
|
| 1449 | + ) { |
|
| 1450 | + $boucles[$id]->sql_serveur = strtolower($type); |
|
| 1451 | + } |
|
| 1452 | + if ($show) { |
|
| 1453 | + $boucles[$id]->show = $show; |
|
| 1454 | + // recopie les infos les plus importantes |
|
| 1455 | + $boucles[$id]->primary = $show['key']['PRIMARY KEY'] ?? ''; |
|
| 1456 | + $boucles[$id]->id_table = $x = preg_replace(',^spip_,', '', $show['id_table']); |
|
| 1457 | + $boucles[$id]->from[$x] = $nom_table = $show['table']; |
|
| 1458 | + $boucles[$id]->iterateur = 'SQL'; |
|
| 1459 | + |
|
| 1460 | + if (empty($boucles[$id]->descr)) { |
|
| 1461 | + $boucles[$id]->descr = &$descr; |
|
| 1462 | + } |
|
| 1463 | + if ( |
|
| 1464 | + !$boucles[$id]->jointures |
|
| 1465 | + && is_array($show['tables_jointures']) |
|
| 1466 | + && count($x = $show['tables_jointures']) |
|
| 1467 | + ) { |
|
| 1468 | + $boucles[$id]->jointures = $x; |
|
| 1469 | + } |
|
| 1470 | + if ($boucles[$id]->jointures_explicites) { |
|
| 1471 | + $jointures = preg_split('/\s+/', $boucles[$id]->jointures_explicites); |
|
| 1472 | + while ($j = array_pop($jointures)) { |
|
| 1473 | + array_unshift($boucles[$id]->jointures, $j); |
|
| 1474 | + } |
|
| 1475 | + } |
|
| 1476 | + } else { |
|
| 1477 | + // Pas une erreur si la table est optionnelle |
|
| 1478 | + if ($boucles[$id]->table_optionnelle) { |
|
| 1479 | + $boucles[$id]->type_requete = ''; |
|
| 1480 | + } else { |
|
| 1481 | + $boucles[$id]->type_requete = false; |
|
| 1482 | + $boucle = $boucles[$id]; |
|
| 1483 | + $x = (!$boucle->sql_serveur ? '' : |
|
| 1484 | + ($boucle->sql_serveur . ':')) . |
|
| 1485 | + $type; |
|
| 1486 | + $msg = [ |
|
| 1487 | + 'zbug_table_inconnue', |
|
| 1488 | + ['table' => $x] |
|
| 1489 | + ]; |
|
| 1490 | + erreur_squelette($msg, $boucle); |
|
| 1491 | + } |
|
| 1492 | + } |
|
| 1493 | + } |
|
| 1494 | + } |
|
| 1495 | + } |
|
| 1496 | + } |
|
| 1497 | + |
|
| 1498 | + // Commencer par reperer les boucles appelees explicitement |
|
| 1499 | + // car elles indexent les arguments de maniere derogatoire |
|
| 1500 | + foreach ($boucles as $id => $boucle) { |
|
| 1501 | + if ($boucle->type_requete == TYPE_RECURSIF && $boucle->param) { |
|
| 1502 | + $boucles[$id]->descr = &$descr; |
|
| 1503 | + $rec = &$boucles[$boucle->param[0]]; |
|
| 1504 | + if (!$rec) { |
|
| 1505 | + $msg = [ |
|
| 1506 | + 'zbug_boucle_recursive_undef', |
|
| 1507 | + ['nom' => $boucle->param[0]] |
|
| 1508 | + ]; |
|
| 1509 | + erreur_squelette($msg, $boucle); |
|
| 1510 | + $boucles[$id]->type_requete = false; |
|
| 1511 | + } else { |
|
| 1512 | + $rec->externe = $id; |
|
| 1513 | + $descr['id_mere'] = $id; |
|
| 1514 | + $boucles[$id]->return = |
|
| 1515 | + calculer_liste( |
|
| 1516 | + [$rec], |
|
| 1517 | + $descr, |
|
| 1518 | + $boucles, |
|
| 1519 | + $boucle->param |
|
| 1520 | + ); |
|
| 1521 | + } |
|
| 1522 | + } |
|
| 1523 | + } |
|
| 1524 | + foreach ($boucles as $id => $boucle) { |
|
| 1525 | + $id = strval($id); // attention au type dans index_pile |
|
| 1526 | + $type = $boucle->type_requete; |
|
| 1527 | + if ($type && $type != TYPE_RECURSIF) { |
|
| 1528 | + $res = ''; |
|
| 1529 | + if ($boucle->param) { |
|
| 1530 | + // retourne un tableau en cas d'erreur |
|
| 1531 | + $res = calculer_criteres($id, $boucles); |
|
| 1532 | + } |
|
| 1533 | + $descr['id_mere'] = $id; |
|
| 1534 | + $boucles[$id]->return = |
|
| 1535 | + calculer_liste( |
|
| 1536 | + $boucle->milieu, |
|
| 1537 | + $descr, |
|
| 1538 | + $boucles, |
|
| 1539 | + $id |
|
| 1540 | + ); |
|
| 1541 | + // Si les criteres se sont mal compiles |
|
| 1542 | + // ne pas tenter d'assembler le code final |
|
| 1543 | + // (mais compiler le corps pour detection d'erreurs) |
|
| 1544 | + if (is_array($res)) { |
|
| 1545 | + $boucles[$id]->type_requete = false; |
|
| 1546 | + } |
|
| 1547 | + } |
|
| 1548 | + } |
|
| 1549 | + |
|
| 1550 | + // idem pour la racine |
|
| 1551 | + $descr['id_mere'] = ''; |
|
| 1552 | + $corps = calculer_liste($squelette, $descr, $boucles); |
|
| 1553 | + |
|
| 1554 | + |
|
| 1555 | + // Calcul du corps de toutes les fonctions PHP, |
|
| 1556 | + // en particulier les requetes SQL et TOTAL_BOUCLE |
|
| 1557 | + // de'terminables seulement maintenant |
|
| 1558 | + |
|
| 1559 | + foreach ($boucles as $id => $boucle) { |
|
| 1560 | + $boucle = $boucles[$id] = pipeline('pre_boucle', $boucle); |
|
| 1561 | + if ($boucle->return === false) { |
|
| 1562 | + $corps = false; |
|
| 1563 | + continue; |
|
| 1564 | + } |
|
| 1565 | + // appeler la fonction de definition de la boucle |
|
| 1566 | + |
|
| 1567 | + if ($req = $boucle->type_requete) { |
|
| 1568 | + // boucle personnalisée ? |
|
| 1569 | + $table = strtoupper($boucle->type_requete); |
|
| 1570 | + $serveur = strtolower($boucle->sql_serveur); |
|
| 1571 | + if ( |
|
| 1572 | + // fonction de boucle avec serveur & table |
|
| 1573 | + ( |
|
| 1574 | + !$serveur |
|
| 1575 | + || !function_exists($f = 'boucle_' . $serveur . '_' . $table) && !function_exists($f = $f . '_dist') |
|
| 1576 | + ) |
|
| 1577 | + // fonction de boucle avec table |
|
| 1578 | + && !function_exists($f = 'boucle_' . $table) |
|
| 1579 | + && !function_exists($f = $f . '_dist') |
|
| 1580 | + ) { |
|
| 1581 | + // fonction de boucle standard |
|
| 1582 | + if (!function_exists($f = 'boucle_DEFAUT')) { |
|
| 1583 | + $f = 'boucle_DEFAUT_dist'; |
|
| 1584 | + } |
|
| 1585 | + } |
|
| 1586 | + |
|
| 1587 | + $req = "\n\n\tstatic \$command = array();\n\t" . |
|
| 1588 | + "static \$connect;\n\t" . |
|
| 1589 | + "\$command['connect'] = \$connect = " . |
|
| 1590 | + _q($boucle->sql_serveur) . |
|
| 1591 | + ';' . |
|
| 1592 | + $f($id, $boucles); |
|
| 1593 | + } else { |
|
| 1594 | + $req = ("\n\treturn '';"); |
|
| 1595 | + } |
|
| 1596 | + |
|
| 1597 | + $boucles[$id]->return = |
|
| 1598 | + "\n\nfunction BOUCLE" . strtr($id, '-', '_') . $nom . |
|
| 1599 | + '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {' . |
|
| 1600 | + $req . |
|
| 1601 | + "\n}\n"; |
|
| 1602 | + } |
|
| 1603 | + |
|
| 1604 | + // Au final, si le corps ou un critere au moins s'est mal compile |
|
| 1605 | + // retourner False, sinon inserer leur decompilation |
|
| 1606 | + if (is_bool($corps)) { |
|
| 1607 | + return false; |
|
| 1608 | + } |
|
| 1609 | + |
|
| 1610 | + $principal = "\nfunction " . $nom . '($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1611 | 1611 | ' |
| 1612 | - // reporter de maniere securisee les doublons inclus |
|
| 1613 | - . ' |
|
| 1612 | + // reporter de maniere securisee les doublons inclus |
|
| 1613 | + . ' |
|
| 1614 | 1614 | if (isset($Pile[0]["doublons"]) AND is_array($Pile[0]["doublons"])) |
| 1615 | 1615 | $doublons = nettoyer_env_doublons($Pile[0]["doublons"]); |
| 1616 | 1616 | |
| 1617 | 1617 | $connect = ' . |
| 1618 | - _q($connect) . '; |
|
| 1618 | + _q($connect) . '; |
|
| 1619 | 1619 | $page = ' . |
| 1620 | - // ATTENTION, le calcul de l'expression $corps affectera $Cache |
|
| 1621 | - // c'est pourquoi on l'affecte a la variable auxiliaire $page. |
|
| 1622 | - // avant de referencer $Cache |
|
| 1623 | - $corps . '; |
|
| 1620 | + // ATTENTION, le calcul de l'expression $corps affectera $Cache |
|
| 1621 | + // c'est pourquoi on l'affecte a la variable auxiliaire $page. |
|
| 1622 | + // avant de referencer $Cache |
|
| 1623 | + $corps . '; |
|
| 1624 | 1624 | |
| 1625 | 1625 | return analyse_resultat_skel(' . var_export($nom, true) |
| 1626 | - . ', $Cache, $page, ' . var_export($sourcefile, true) . '); |
|
| 1626 | + . ', $Cache, $page, ' . var_export($sourcefile, true) . '); |
|
| 1627 | 1627 | }'; |
| 1628 | 1628 | |
| 1629 | - $secondes = spip_timer('calcul_skel'); |
|
| 1630 | - spip_log("COMPIL ($secondes) [$sourcefile] $nom.php"); |
|
| 1631 | - // $connect n'est pas sûr : on nettoie |
|
| 1632 | - $connect = preg_replace(',[^\w],', '', $connect); |
|
| 1629 | + $secondes = spip_timer('calcul_skel'); |
|
| 1630 | + spip_log("COMPIL ($secondes) [$sourcefile] $nom.php"); |
|
| 1631 | + // $connect n'est pas sûr : on nettoie |
|
| 1632 | + $connect = preg_replace(',[^\w],', '', $connect); |
|
| 1633 | 1633 | |
| 1634 | - // Assimiler la fct principale a une boucle anonyme, pour retourner un resultat simple |
|
| 1635 | - $code = new Boucle(); |
|
| 1636 | - $code->descr = $descr; |
|
| 1637 | - $code->return = ' |
|
| 1634 | + // Assimiler la fct principale a une boucle anonyme, pour retourner un resultat simple |
|
| 1635 | + $code = new Boucle(); |
|
| 1636 | + $code->descr = $descr; |
|
| 1637 | + $code->return = ' |
|
| 1638 | 1638 | // |
| 1639 | 1639 | // Fonction principale du squelette ' . |
| 1640 | - $sourcefile . |
|
| 1641 | - ($connect ? " pour $connect" : '') . |
|
| 1642 | - (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes") . |
|
| 1643 | - "\n//\n" . |
|
| 1644 | - $principal; |
|
| 1640 | + $sourcefile . |
|
| 1641 | + ($connect ? " pour $connect" : '') . |
|
| 1642 | + (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes") . |
|
| 1643 | + "\n//\n" . |
|
| 1644 | + $principal; |
|
| 1645 | 1645 | |
| 1646 | - $boucles[''] = $code; |
|
| 1646 | + $boucles[''] = $code; |
|
| 1647 | 1647 | |
| 1648 | - return $boucles; |
|
| 1648 | + return $boucles; |
|
| 1649 | 1649 | } |
| 1650 | 1650 | |
| 1651 | 1651 | |
@@ -1662,18 +1662,18 @@ discard block |
||
| 1662 | 1662 | * |
| 1663 | 1663 | **/ |
| 1664 | 1664 | function requeteur_php_dist(&$boucles, &$boucle, &$id) { |
| 1665 | - if (class_exists($boucle->type_requete)) { |
|
| 1666 | - $g = charger_fonction('php', 'iterateur'); |
|
| 1667 | - $boucles[$id] = $g($boucle, $boucle->type_requete); |
|
| 1668 | - } else { |
|
| 1669 | - $x = $boucle->type_requete; |
|
| 1670 | - $boucle->type_requete = false; |
|
| 1671 | - $msg = [ |
|
| 1672 | - 'zbug_iterateur_inconnu', |
|
| 1673 | - ['iterateur' => $x] |
|
| 1674 | - ]; |
|
| 1675 | - erreur_squelette($msg, $boucle); |
|
| 1676 | - } |
|
| 1665 | + if (class_exists($boucle->type_requete)) { |
|
| 1666 | + $g = charger_fonction('php', 'iterateur'); |
|
| 1667 | + $boucles[$id] = $g($boucle, $boucle->type_requete); |
|
| 1668 | + } else { |
|
| 1669 | + $x = $boucle->type_requete; |
|
| 1670 | + $boucle->type_requete = false; |
|
| 1671 | + $msg = [ |
|
| 1672 | + 'zbug_iterateur_inconnu', |
|
| 1673 | + ['iterateur' => $x] |
|
| 1674 | + ]; |
|
| 1675 | + erreur_squelette($msg, $boucle); |
|
| 1676 | + } |
|
| 1677 | 1677 | } |
| 1678 | 1678 | |
| 1679 | 1679 | |
@@ -1691,22 +1691,22 @@ discard block |
||
| 1691 | 1691 | * |
| 1692 | 1692 | **/ |
| 1693 | 1693 | function requeteur_data_dist(&$boucles, &$boucle, &$id) { |
| 1694 | - include_spip('iterateur/data'); |
|
| 1695 | - if ($h = charger_fonction($boucle->type_requete . '_to_array', 'inc', true)) { |
|
| 1696 | - $g = charger_fonction('data', 'iterateur'); |
|
| 1697 | - $boucles[$id] = $g($boucle); |
|
| 1698 | - // from[0] stocke le type de data (rss, yql, ...) |
|
| 1699 | - $boucles[$id]->from[] = $boucle->type_requete; |
|
| 1700 | - } else { |
|
| 1701 | - $x = $boucle->type_requete; |
|
| 1702 | - $boucle->type_requete = false; |
|
| 1703 | - $msg = [ |
|
| 1704 | - 'zbug_requeteur_inconnu', |
|
| 1705 | - [ |
|
| 1706 | - 'requeteur' => 'data', |
|
| 1707 | - 'type' => $x |
|
| 1708 | - ] |
|
| 1709 | - ]; |
|
| 1710 | - erreur_squelette($msg, $boucle); |
|
| 1711 | - } |
|
| 1694 | + include_spip('iterateur/data'); |
|
| 1695 | + if ($h = charger_fonction($boucle->type_requete . '_to_array', 'inc', true)) { |
|
| 1696 | + $g = charger_fonction('data', 'iterateur'); |
|
| 1697 | + $boucles[$id] = $g($boucle); |
|
| 1698 | + // from[0] stocke le type de data (rss, yql, ...) |
|
| 1699 | + $boucles[$id]->from[] = $boucle->type_requete; |
|
| 1700 | + } else { |
|
| 1701 | + $x = $boucle->type_requete; |
|
| 1702 | + $boucle->type_requete = false; |
|
| 1703 | + $msg = [ |
|
| 1704 | + 'zbug_requeteur_inconnu', |
|
| 1705 | + [ |
|
| 1706 | + 'requeteur' => 'data', |
|
| 1707 | + 'type' => $x |
|
| 1708 | + ] |
|
| 1709 | + ]; |
|
| 1710 | + erreur_squelette($msg, $boucle); |
|
| 1711 | + } |
|
| 1712 | 1712 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | **/ |
| 20 | 20 | |
| 21 | 21 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 22 | - return; |
|
| 22 | + return; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | include_spip('inc/texte'); |
@@ -42,229 +42,229 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | function public_composer_dist($squelette, $mime_type, $gram, $source, string $connect = '') { |
| 44 | 44 | |
| 45 | - $skel = null; |
|
| 46 | - $boucle = null; |
|
| 47 | - $nom = calculer_nom_fonction_squel($squelette, $mime_type, $connect); |
|
| 48 | - |
|
| 49 | - // si deja en memoire (INCLURE a repetition) c'est bon. |
|
| 50 | - if (function_exists($nom)) { |
|
| 51 | - return $nom; |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - if (defined('_VAR_MODE') && _VAR_MODE == 'debug') { |
|
| 55 | - $GLOBALS['debug_objets']['courant'] = $nom; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - $phpfile = sous_repertoire(_DIR_SKELS, '', false, true) . $nom . '.php'; |
|
| 59 | - |
|
| 60 | - // si squelette est deja compile et perenne, le charger |
|
| 61 | - if (!squelette_obsolete($phpfile, $source)) { |
|
| 62 | - include_once $phpfile; |
|
| 63 | - #if (!squelette_obsolete($phpfile, $source) |
|
| 64 | - # AND lire_fichier ($phpfile, $skel_code, |
|
| 65 | - # array('critique' => 'oui', 'phpcheck' => 'oui'))){ |
|
| 66 | - ## eval('?'.'>'.$skel_code); |
|
| 67 | - # spip_log($skel_code, 'comp') |
|
| 68 | - #} |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - if (file_exists($lib = $squelette . '_fonctions' . '.php')) { |
|
| 72 | - include_once $lib; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - // tester si le eval ci-dessus a mis le squelette en memoire |
|
| 76 | - |
|
| 77 | - if (function_exists($nom)) { |
|
| 78 | - return $nom; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - // charger le source, si possible, et compiler |
|
| 82 | - $skel_code = ''; |
|
| 83 | - if (lire_fichier($source, $skel)) { |
|
| 84 | - $compiler = charger_fonction('compiler', 'public'); |
|
| 85 | - $skel_code = $compiler($skel, $nom, $gram, $source, $connect); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - // Ne plus rien faire si le compilateur n'a pas pu operer. |
|
| 89 | - if (!$skel_code) { |
|
| 90 | - return false; |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - foreach ($skel_code as $id => $boucle) { |
|
| 94 | - $f = $boucle->return; |
|
| 95 | - try { |
|
| 96 | - eval("return true; $f ;"); |
|
| 97 | - } catch (\ParseError $e) { |
|
| 98 | - // Code syntaxiquement faux (critere etc mal programme') |
|
| 99 | - $msg = _T('zbug_erreur_compilation') . ' | Line ' . $e->getLine() . ' : ' . $e->getMessage(); |
|
| 100 | - erreur_squelette($msg, $boucle); |
|
| 101 | - // continuer pour trouver d'autres fautes eventuelles |
|
| 102 | - // mais prevenir que c'est mort |
|
| 103 | - $nom = ''; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - // contexte de compil inutile a present |
|
| 107 | - // (mais la derniere valeur de $boucle est utilisee ci-dessous) |
|
| 108 | - $skel_code[$id] = $f; |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - $code = ''; |
|
| 112 | - if ($nom) { |
|
| 113 | - // Si le code est bon, concatener et mettre en cache |
|
| 114 | - if (function_exists($nom)) { |
|
| 115 | - $code = squelette_traduit($skel, $source, $phpfile, $skel_code); |
|
| 116 | - } else { |
|
| 117 | - // code semantiquement faux: bug du compilateur |
|
| 118 | - // $boucle est en fait ici la fct principale du squelette |
|
| 119 | - $msg = _T('zbug_erreur_compilation'); |
|
| 120 | - erreur_squelette($msg, $boucle); |
|
| 121 | - $nom = ''; |
|
| 122 | - } |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - if (defined('_VAR_MODE') && _VAR_MODE == 'debug') { |
|
| 126 | - // Tracer ce qui vient d'etre compile |
|
| 127 | - $GLOBALS['debug_objets']['code'][$nom . 'tout'] = $code; |
|
| 128 | - |
|
| 129 | - // si c'est ce que demande le debusqueur, lui passer la main |
|
| 130 | - if ( |
|
| 131 | - $GLOBALS['debug_objets']['sourcefile'] |
|
| 132 | - && _request('var_mode_objet') == $nom |
|
| 133 | - && _request('var_mode_affiche') == 'code' |
|
| 134 | - ) { |
|
| 135 | - erreur_squelette(); |
|
| 136 | - } |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - return $nom ?: false; |
|
| 45 | + $skel = null; |
|
| 46 | + $boucle = null; |
|
| 47 | + $nom = calculer_nom_fonction_squel($squelette, $mime_type, $connect); |
|
| 48 | + |
|
| 49 | + // si deja en memoire (INCLURE a repetition) c'est bon. |
|
| 50 | + if (function_exists($nom)) { |
|
| 51 | + return $nom; |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + if (defined('_VAR_MODE') && _VAR_MODE == 'debug') { |
|
| 55 | + $GLOBALS['debug_objets']['courant'] = $nom; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + $phpfile = sous_repertoire(_DIR_SKELS, '', false, true) . $nom . '.php'; |
|
| 59 | + |
|
| 60 | + // si squelette est deja compile et perenne, le charger |
|
| 61 | + if (!squelette_obsolete($phpfile, $source)) { |
|
| 62 | + include_once $phpfile; |
|
| 63 | + #if (!squelette_obsolete($phpfile, $source) |
|
| 64 | + # AND lire_fichier ($phpfile, $skel_code, |
|
| 65 | + # array('critique' => 'oui', 'phpcheck' => 'oui'))){ |
|
| 66 | + ## eval('?'.'>'.$skel_code); |
|
| 67 | + # spip_log($skel_code, 'comp') |
|
| 68 | + #} |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + if (file_exists($lib = $squelette . '_fonctions' . '.php')) { |
|
| 72 | + include_once $lib; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + // tester si le eval ci-dessus a mis le squelette en memoire |
|
| 76 | + |
|
| 77 | + if (function_exists($nom)) { |
|
| 78 | + return $nom; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + // charger le source, si possible, et compiler |
|
| 82 | + $skel_code = ''; |
|
| 83 | + if (lire_fichier($source, $skel)) { |
|
| 84 | + $compiler = charger_fonction('compiler', 'public'); |
|
| 85 | + $skel_code = $compiler($skel, $nom, $gram, $source, $connect); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + // Ne plus rien faire si le compilateur n'a pas pu operer. |
|
| 89 | + if (!$skel_code) { |
|
| 90 | + return false; |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + foreach ($skel_code as $id => $boucle) { |
|
| 94 | + $f = $boucle->return; |
|
| 95 | + try { |
|
| 96 | + eval("return true; $f ;"); |
|
| 97 | + } catch (\ParseError $e) { |
|
| 98 | + // Code syntaxiquement faux (critere etc mal programme') |
|
| 99 | + $msg = _T('zbug_erreur_compilation') . ' | Line ' . $e->getLine() . ' : ' . $e->getMessage(); |
|
| 100 | + erreur_squelette($msg, $boucle); |
|
| 101 | + // continuer pour trouver d'autres fautes eventuelles |
|
| 102 | + // mais prevenir que c'est mort |
|
| 103 | + $nom = ''; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + // contexte de compil inutile a present |
|
| 107 | + // (mais la derniere valeur de $boucle est utilisee ci-dessous) |
|
| 108 | + $skel_code[$id] = $f; |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + $code = ''; |
|
| 112 | + if ($nom) { |
|
| 113 | + // Si le code est bon, concatener et mettre en cache |
|
| 114 | + if (function_exists($nom)) { |
|
| 115 | + $code = squelette_traduit($skel, $source, $phpfile, $skel_code); |
|
| 116 | + } else { |
|
| 117 | + // code semantiquement faux: bug du compilateur |
|
| 118 | + // $boucle est en fait ici la fct principale du squelette |
|
| 119 | + $msg = _T('zbug_erreur_compilation'); |
|
| 120 | + erreur_squelette($msg, $boucle); |
|
| 121 | + $nom = ''; |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + if (defined('_VAR_MODE') && _VAR_MODE == 'debug') { |
|
| 126 | + // Tracer ce qui vient d'etre compile |
|
| 127 | + $GLOBALS['debug_objets']['code'][$nom . 'tout'] = $code; |
|
| 128 | + |
|
| 129 | + // si c'est ce que demande le debusqueur, lui passer la main |
|
| 130 | + if ( |
|
| 131 | + $GLOBALS['debug_objets']['sourcefile'] |
|
| 132 | + && _request('var_mode_objet') == $nom |
|
| 133 | + && _request('var_mode_affiche') == 'code' |
|
| 134 | + ) { |
|
| 135 | + erreur_squelette(); |
|
| 136 | + } |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + return $nom ?: false; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | function squelette_traduit($squelette, $sourcefile, $phpfile, $boucles) { |
| 143 | 143 | |
| 144 | - $code = null; |
|
| 145 | - // Le dernier index est '' (fonction principale) |
|
| 146 | - $noms = substr(join(', ', array_keys($boucles)), 0, -2); |
|
| 147 | - if (CODE_COMMENTE) { |
|
| 148 | - $code = " |
|
| 144 | + $code = null; |
|
| 145 | + // Le dernier index est '' (fonction principale) |
|
| 146 | + $noms = substr(join(', ', array_keys($boucles)), 0, -2); |
|
| 147 | + if (CODE_COMMENTE) { |
|
| 148 | + $code = " |
|
| 149 | 149 | /* |
| 150 | 150 | * Squelette : $sourcefile |
| 151 | 151 | * Date : " . gmdate('D, d M Y H:i:s', @filemtime($sourcefile)) . ' GMT |
| 152 | 152 | * Compile : ' . gmdate('D, d M Y H:i:s', time()) . ' GMT |
| 153 | 153 | * ' . (!$boucles ? 'Pas de boucle' : ('Boucles : ' . $noms)) . ' |
| 154 | 154 | */ '; |
| 155 | - } |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | - $code = '<' . "?php\n" . $code . join('', $boucles) . "\n"; |
|
| 158 | - if (!defined('_VAR_NOCACHE') || !_VAR_NOCACHE) { |
|
| 159 | - ecrire_fichier($phpfile, $code); |
|
| 160 | - } |
|
| 157 | + $code = '<' . "?php\n" . $code . join('', $boucles) . "\n"; |
|
| 158 | + if (!defined('_VAR_NOCACHE') || !_VAR_NOCACHE) { |
|
| 159 | + ecrire_fichier($phpfile, $code); |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - return $code; |
|
| 162 | + return $code; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Le squelette compile est-il trop vieux ? |
| 166 | 166 | function squelette_obsolete($skel, $squelette) { |
| 167 | - static $date_change = null; |
|
| 168 | - // ne verifier la date de mes_fonctions et mes_options qu'une seule fois |
|
| 169 | - // par hit |
|
| 170 | - if (is_null($date_change)) { |
|
| 171 | - if (@file_exists($fonc = 'mes_fonctions.php')) { |
|
| 172 | - $date_change = @filemtime($fonc); |
|
| 173 | - } # compatibilite |
|
| 174 | - if (defined('_FILE_OPTIONS')) { |
|
| 175 | - $date_change = max($date_change, @filemtime(_FILE_OPTIONS)); |
|
| 176 | - } |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - return ( |
|
| 180 | - defined('_VAR_MODE') && in_array(_VAR_MODE, ['recalcul', 'preview', 'debug']) |
|
| 181 | - || !@file_exists($skel) |
|
| 182 | - || (@file_exists($squelette) ? @filemtime($squelette) : 0) > ($date = @filemtime($skel)) |
|
| 183 | - || $date_change > $date |
|
| 184 | - ); |
|
| 167 | + static $date_change = null; |
|
| 168 | + // ne verifier la date de mes_fonctions et mes_options qu'une seule fois |
|
| 169 | + // par hit |
|
| 170 | + if (is_null($date_change)) { |
|
| 171 | + if (@file_exists($fonc = 'mes_fonctions.php')) { |
|
| 172 | + $date_change = @filemtime($fonc); |
|
| 173 | + } # compatibilite |
|
| 174 | + if (defined('_FILE_OPTIONS')) { |
|
| 175 | + $date_change = max($date_change, @filemtime(_FILE_OPTIONS)); |
|
| 176 | + } |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + return ( |
|
| 180 | + defined('_VAR_MODE') && in_array(_VAR_MODE, ['recalcul', 'preview', 'debug']) |
|
| 181 | + || !@file_exists($skel) |
|
| 182 | + || (@file_exists($squelette) ? @filemtime($squelette) : 0) > ($date = @filemtime($skel)) |
|
| 183 | + || $date_change > $date |
|
| 184 | + ); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | // Activer l'invalideur de session |
| 188 | 188 | function invalideur_session(&$Cache, $code = null) { |
| 189 | - $Cache['session'] = spip_session(); |
|
| 189 | + $Cache['session'] = spip_session(); |
|
| 190 | 190 | |
| 191 | - return $code; |
|
| 191 | + return $code; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | function analyse_resultat_skel($nom, $cache, $corps, $source = '') { |
| 196 | - static $filtres = []; |
|
| 197 | - $headers = []; |
|
| 198 | - $corps ??= ''; |
|
| 199 | - |
|
| 200 | - // Recupere les < ?php header('Xx: y'); ? > pour $page['headers'] |
|
| 201 | - // note: on essaie d'attrapper aussi certains de ces entetes codes |
|
| 202 | - // "a la main" dans les squelettes, mais evidemment sans exhaustivite |
|
| 203 | - if ( |
|
| 204 | - stripos($corps, 'header') !== false |
|
| 205 | - && preg_match_all( |
|
| 206 | - '/(<[?]php\s+)@?header\s*\(\s*.([^:\'"]*):?\s*([^)]*)[^)]\s*\)\s*[;]?\s*[?]>/ims', |
|
| 207 | - $corps, |
|
| 208 | - $regs, |
|
| 209 | - PREG_SET_ORDER |
|
| 210 | - ) |
|
| 211 | - ) { |
|
| 212 | - foreach ($regs as $r) { |
|
| 213 | - $corps = str_replace($r[0], '', $corps); |
|
| 214 | - # $j = Content-Type, et pas content-TYPE. |
|
| 215 | - $j = join('-', array_map('ucwords', explode('-', strtolower($r[2])))); |
|
| 216 | - |
|
| 217 | - if ($j == 'X-Spip-Filtre' && isset($headers[$j])) { |
|
| 218 | - $headers[$j] .= '|' . $r[3]; |
|
| 219 | - } else { |
|
| 220 | - $headers[$j] = str_replace(['\\\\',"\\'",'\\"'], ['\\',"'",'"'], $r[3]); |
|
| 221 | - } |
|
| 222 | - } |
|
| 223 | - } |
|
| 224 | - // S'agit-il d'un resultat constant ou contenant du code php |
|
| 225 | - $process_ins = ( |
|
| 226 | - !str_contains($corps, '<' . '?') |
|
| 227 | - || str_contains($corps, '<' . '?xml') && !str_contains(str_replace('<' . '?xml', '', $corps), '<' . '?') |
|
| 228 | - ) |
|
| 229 | - ? 'html' |
|
| 230 | - : 'php'; |
|
| 231 | - |
|
| 232 | - $skel = [ |
|
| 233 | - 'squelette' => $nom, |
|
| 234 | - 'source' => $source, |
|
| 235 | - 'process_ins' => $process_ins, |
|
| 236 | - 'invalideurs' => $cache, |
|
| 237 | - 'entetes' => $headers, |
|
| 238 | - 'duree' => isset($headers['X-Spip-Cache']) ? intval($headers['X-Spip-Cache']) : 0 |
|
| 239 | - ]; |
|
| 240 | - |
|
| 241 | - // traiter #FILTRE{} et filtres |
|
| 242 | - if (!isset($filtres[$nom])) { |
|
| 243 | - $filtres[$nom] = pipeline('declarer_filtres_squelettes', ['args' => $skel, 'data' => []]); |
|
| 244 | - } |
|
| 245 | - $filtres_headers = []; |
|
| 246 | - if (isset($headers['X-Spip-Filtre']) && strlen($headers['X-Spip-Filtre'])) { |
|
| 247 | - $filtres_headers = array_filter(explode('|', $headers['X-Spip-Filtre'])); |
|
| 248 | - unset($headers['X-Spip-Filtre']); |
|
| 249 | - } |
|
| 250 | - if ((is_countable($filtres[$nom]) ? count($filtres[$nom]) : 0) || count($filtres_headers)) { |
|
| 251 | - include_spip('public/sandbox'); |
|
| 252 | - $corps = sandbox_filtrer_squelette($skel, $corps, $filtres_headers, $filtres[$nom]); |
|
| 253 | - |
|
| 254 | - if ($process_ins == 'html') { |
|
| 255 | - $skel['process_ins'] = ( |
|
| 256 | - !str_contains($corps, '<' . '?') |
|
| 257 | - || str_contains($corps, '<' . '?xml') && !str_contains(str_replace('<' . '?xml', '', $corps), '<' . '?') |
|
| 258 | - ) |
|
| 259 | - ? 'html' |
|
| 260 | - : 'php'; |
|
| 261 | - } |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - $skel['entetes'] = $headers; |
|
| 265 | - $skel['texte'] = $corps; |
|
| 266 | - |
|
| 267 | - return $skel; |
|
| 196 | + static $filtres = []; |
|
| 197 | + $headers = []; |
|
| 198 | + $corps ??= ''; |
|
| 199 | + |
|
| 200 | + // Recupere les < ?php header('Xx: y'); ? > pour $page['headers'] |
|
| 201 | + // note: on essaie d'attrapper aussi certains de ces entetes codes |
|
| 202 | + // "a la main" dans les squelettes, mais evidemment sans exhaustivite |
|
| 203 | + if ( |
|
| 204 | + stripos($corps, 'header') !== false |
|
| 205 | + && preg_match_all( |
|
| 206 | + '/(<[?]php\s+)@?header\s*\(\s*.([^:\'"]*):?\s*([^)]*)[^)]\s*\)\s*[;]?\s*[?]>/ims', |
|
| 207 | + $corps, |
|
| 208 | + $regs, |
|
| 209 | + PREG_SET_ORDER |
|
| 210 | + ) |
|
| 211 | + ) { |
|
| 212 | + foreach ($regs as $r) { |
|
| 213 | + $corps = str_replace($r[0], '', $corps); |
|
| 214 | + # $j = Content-Type, et pas content-TYPE. |
|
| 215 | + $j = join('-', array_map('ucwords', explode('-', strtolower($r[2])))); |
|
| 216 | + |
|
| 217 | + if ($j == 'X-Spip-Filtre' && isset($headers[$j])) { |
|
| 218 | + $headers[$j] .= '|' . $r[3]; |
|
| 219 | + } else { |
|
| 220 | + $headers[$j] = str_replace(['\\\\',"\\'",'\\"'], ['\\',"'",'"'], $r[3]); |
|
| 221 | + } |
|
| 222 | + } |
|
| 223 | + } |
|
| 224 | + // S'agit-il d'un resultat constant ou contenant du code php |
|
| 225 | + $process_ins = ( |
|
| 226 | + !str_contains($corps, '<' . '?') |
|
| 227 | + || str_contains($corps, '<' . '?xml') && !str_contains(str_replace('<' . '?xml', '', $corps), '<' . '?') |
|
| 228 | + ) |
|
| 229 | + ? 'html' |
|
| 230 | + : 'php'; |
|
| 231 | + |
|
| 232 | + $skel = [ |
|
| 233 | + 'squelette' => $nom, |
|
| 234 | + 'source' => $source, |
|
| 235 | + 'process_ins' => $process_ins, |
|
| 236 | + 'invalideurs' => $cache, |
|
| 237 | + 'entetes' => $headers, |
|
| 238 | + 'duree' => isset($headers['X-Spip-Cache']) ? intval($headers['X-Spip-Cache']) : 0 |
|
| 239 | + ]; |
|
| 240 | + |
|
| 241 | + // traiter #FILTRE{} et filtres |
|
| 242 | + if (!isset($filtres[$nom])) { |
|
| 243 | + $filtres[$nom] = pipeline('declarer_filtres_squelettes', ['args' => $skel, 'data' => []]); |
|
| 244 | + } |
|
| 245 | + $filtres_headers = []; |
|
| 246 | + if (isset($headers['X-Spip-Filtre']) && strlen($headers['X-Spip-Filtre'])) { |
|
| 247 | + $filtres_headers = array_filter(explode('|', $headers['X-Spip-Filtre'])); |
|
| 248 | + unset($headers['X-Spip-Filtre']); |
|
| 249 | + } |
|
| 250 | + if ((is_countable($filtres[$nom]) ? count($filtres[$nom]) : 0) || count($filtres_headers)) { |
|
| 251 | + include_spip('public/sandbox'); |
|
| 252 | + $corps = sandbox_filtrer_squelette($skel, $corps, $filtres_headers, $filtres[$nom]); |
|
| 253 | + |
|
| 254 | + if ($process_ins == 'html') { |
|
| 255 | + $skel['process_ins'] = ( |
|
| 256 | + !str_contains($corps, '<' . '?') |
|
| 257 | + || str_contains($corps, '<' . '?xml') && !str_contains(str_replace('<' . '?xml', '', $corps), '<' . '?') |
|
| 258 | + ) |
|
| 259 | + ? 'html' |
|
| 260 | + : 'php'; |
|
| 261 | + } |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + $skel['entetes'] = $headers; |
|
| 265 | + $skel['texte'] = $corps; |
|
| 266 | + |
|
| 267 | + return $skel; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | // |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | inserer_balise_dynamique(balise_%s_dyn(%s), array(%s)); |
| 279 | 279 | if ($lang_select) lang_select(); |
| 280 | 280 | ?' |
| 281 | - . '>'); |
|
| 281 | + . '>'); |
|
| 282 | 282 | |
| 283 | 283 | /** |
| 284 | 284 | * Synthétise une balise dynamique : crée l'appel à l'inclusion |
@@ -298,35 +298,35 @@ discard block |
||
| 298 | 298 | * Code PHP pour inclure le squelette de la balise dynamique |
| 299 | 299 | **/ |
| 300 | 300 | function synthetiser_balise_dynamique($nom, $args, $file, $context_compil) { |
| 301 | - if ( |
|
| 302 | - !str_starts_with($file, '/') |
|
| 303 | - // pas de lien symbolique sous Windows |
|
| 304 | - && !(stristr(PHP_OS, 'WIN') && str_contains($file, ':')) |
|
| 305 | - ) { |
|
| 306 | - $file = './" . _DIR_RACINE . "' . $file; |
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - $lang = $context_compil[4]; |
|
| 310 | - if (preg_match(',\W,', $lang)) { |
|
| 311 | - $lang = ''; |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - $args = array_map('argumenter_squelette', $args); |
|
| 315 | - if (!empty($context_compil['appel_php_depuis_modele'])) { |
|
| 316 | - $args[0] = 'arguments_balise_dyn_depuis_modele(' . $args[0] . ')'; |
|
| 317 | - } |
|
| 318 | - $args = join(', ', $args); |
|
| 319 | - |
|
| 320 | - $r = sprintf( |
|
| 321 | - CODE_INCLURE_BALISE, |
|
| 322 | - $file, |
|
| 323 | - $lang, |
|
| 324 | - $nom, |
|
| 325 | - $args, |
|
| 326 | - join(', ', array_map('_q', $context_compil)) |
|
| 327 | - ); |
|
| 328 | - |
|
| 329 | - return $r; |
|
| 301 | + if ( |
|
| 302 | + !str_starts_with($file, '/') |
|
| 303 | + // pas de lien symbolique sous Windows |
|
| 304 | + && !(stristr(PHP_OS, 'WIN') && str_contains($file, ':')) |
|
| 305 | + ) { |
|
| 306 | + $file = './" . _DIR_RACINE . "' . $file; |
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + $lang = $context_compil[4]; |
|
| 310 | + if (preg_match(',\W,', $lang)) { |
|
| 311 | + $lang = ''; |
|
| 312 | + } |
|
| 313 | + |
|
| 314 | + $args = array_map('argumenter_squelette', $args); |
|
| 315 | + if (!empty($context_compil['appel_php_depuis_modele'])) { |
|
| 316 | + $args[0] = 'arguments_balise_dyn_depuis_modele(' . $args[0] . ')'; |
|
| 317 | + } |
|
| 318 | + $args = join(', ', $args); |
|
| 319 | + |
|
| 320 | + $r = sprintf( |
|
| 321 | + CODE_INCLURE_BALISE, |
|
| 322 | + $file, |
|
| 323 | + $lang, |
|
| 324 | + $nom, |
|
| 325 | + $args, |
|
| 326 | + join(', ', array_map('_q', $context_compil)) |
|
| 327 | + ); |
|
| 328 | + |
|
| 329 | + return $r; |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | /** |
@@ -344,18 +344,18 @@ discard block |
||
| 344 | 344 | **/ |
| 345 | 345 | function argumenter_squelette($v) { |
| 346 | 346 | |
| 347 | - if (is_object($v)) { |
|
| 348 | - return var_export($v, true); |
|
| 349 | - } elseif (!is_array($v)) { |
|
| 350 | - return "'" . texte_script((string) $v) . "'"; |
|
| 351 | - } else { |
|
| 352 | - $out = []; |
|
| 353 | - foreach ($v as $k => $val) { |
|
| 354 | - $out [] = argumenter_squelette($k) . '=>' . argumenter_squelette($val); |
|
| 355 | - } |
|
| 356 | - |
|
| 357 | - return 'array(' . join(', ', $out) . ')'; |
|
| 358 | - } |
|
| 347 | + if (is_object($v)) { |
|
| 348 | + return var_export($v, true); |
|
| 349 | + } elseif (!is_array($v)) { |
|
| 350 | + return "'" . texte_script((string) $v) . "'"; |
|
| 351 | + } else { |
|
| 352 | + $out = []; |
|
| 353 | + foreach ($v as $k => $val) { |
|
| 354 | + $out [] = argumenter_squelette($k) . '=>' . argumenter_squelette($val); |
|
| 355 | + } |
|
| 356 | + |
|
| 357 | + return 'array(' . join(', ', $out) . ')'; |
|
| 358 | + } |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /** |
@@ -374,13 +374,13 @@ discard block |
||
| 374 | 374 | * @return string |
| 375 | 375 | */ |
| 376 | 376 | function executer_balise_dynamique_dans_un_modele(...$args) { |
| 377 | - if (test_espace_prive()) { |
|
| 378 | - return executer_balise_dynamique(...$args); |
|
| 379 | - } |
|
| 380 | - else { |
|
| 381 | - $str_args = base64_encode(serialize($args)); |
|
| 382 | - return '<?' . "php \$_zargs=unserialize(base64_decode('$str_args'));echo executer_balise_dynamique(...\$_zargs); ?" . ">\n"; |
|
| 383 | - } |
|
| 377 | + if (test_espace_prive()) { |
|
| 378 | + return executer_balise_dynamique(...$args); |
|
| 379 | + } |
|
| 380 | + else { |
|
| 381 | + $str_args = base64_encode(serialize($args)); |
|
| 382 | + return '<?' . "php \$_zargs=unserialize(base64_decode('$str_args'));echo executer_balise_dynamique(...\$_zargs); ?" . ">\n"; |
|
| 383 | + } |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | |
@@ -411,87 +411,87 @@ discard block |
||
| 411 | 411 | * Code PHP d'exécutant l'inclusion du squelette (ou texte) de la balise dynamique |
| 412 | 412 | **/ |
| 413 | 413 | function executer_balise_dynamique($nom, $args, $context_compil) { |
| 414 | - /** @var string Nom de la balise à charger (balise demandée ou balise générique) */ |
|
| 415 | - $nom_balise = $nom; |
|
| 416 | - /** @var string Nom de la balise générique (si utilisée) */ |
|
| 417 | - $nom_balise_generique = ''; |
|
| 418 | - |
|
| 419 | - $appel_php_depuis_modele = false; |
|
| 420 | - if ( |
|
| 421 | - is_array($context_compil) |
|
| 422 | - && !is_numeric($context_compil[3]) |
|
| 423 | - && empty($context_compil[0]) |
|
| 424 | - && empty($context_compil[1]) |
|
| 425 | - && empty($context_compil[2]) |
|
| 426 | - && empty($context_compil[3]) |
|
| 427 | - ) { |
|
| 428 | - $appel_php_depuis_modele = true; |
|
| 429 | - } |
|
| 430 | - |
|
| 431 | - if (!$fonction_balise = charger_fonction($nom_balise, 'balise', true)) { |
|
| 432 | - // Calculer un nom générique (ie. 'formulaire_' dans 'formulaire_editer_article') |
|
| 433 | - if ($balise_generique = chercher_balise_generique($nom)) { |
|
| 434 | - // injecter en premier arg le nom de la balise |
|
| 435 | - array_unshift($args, $nom); |
|
| 436 | - $nom_balise_generique = $balise_generique['nom_generique']; |
|
| 437 | - $fonction_balise = $balise_generique['fonction_generique']; |
|
| 438 | - $nom_balise = $nom_balise_generique; |
|
| 439 | - } |
|
| 440 | - unset($balise_generique); |
|
| 441 | - } |
|
| 442 | - |
|
| 443 | - if (!$fonction_balise) { |
|
| 444 | - $msg = ['zbug_balise_inexistante', ['from' => 'CVT', 'balise' => $nom]]; |
|
| 445 | - erreur_squelette($msg, $context_compil); |
|
| 446 | - |
|
| 447 | - return ''; |
|
| 448 | - } |
|
| 449 | - |
|
| 450 | - // retrouver le fichier qui a déclaré la fonction |
|
| 451 | - // même si la fonction dynamique est déclarée dans un fichier de fonctions. |
|
| 452 | - // Attention sous windows, getFileName() retourne un antislash. |
|
| 453 | - $reflector = new ReflectionFunction($fonction_balise); |
|
| 454 | - $file = str_replace('\\', '/', $reflector->getFileName()); |
|
| 455 | - if (strncmp($file, str_replace('\\', '/', _ROOT_RACINE), strlen(_ROOT_RACINE)) === 0) { |
|
| 456 | - $file = substr($file, strlen(_ROOT_RACINE)); |
|
| 457 | - } |
|
| 458 | - |
|
| 459 | - // Y a-t-il une fonction de traitement des arguments ? |
|
| 460 | - $f = 'balise_' . $nom_balise . '_stat'; |
|
| 461 | - |
|
| 462 | - $r = !function_exists($f) ? $args : $f($args, $context_compil); |
|
| 463 | - |
|
| 464 | - if (!is_array($r)) { |
|
| 465 | - return $r; |
|
| 466 | - } |
|
| 467 | - |
|
| 468 | - // verifier que la fonction dyn est la, |
|
| 469 | - // sinon se replier sur la generique si elle existe |
|
| 470 | - if (!function_exists('balise_' . $nom_balise . '_dyn')) { |
|
| 471 | - if ( |
|
| 472 | - ($balise_generique = chercher_balise_generique($nom)) |
|
| 473 | - && ($nom_balise_generique = $balise_generique['nom_generique']) |
|
| 474 | - && ($file = include_spip('balise/' . strtolower($nom_balise_generique))) |
|
| 475 | - && function_exists('balise_' . $nom_balise_generique . '_dyn') |
|
| 476 | - ) { |
|
| 477 | - // et lui injecter en premier arg le nom de la balise |
|
| 478 | - array_unshift($r, $nom); |
|
| 479 | - $nom_balise = $nom_balise_generique; |
|
| 480 | - if (!_DIR_RESTREINT) { |
|
| 481 | - $file = _DIR_RESTREINT_ABS . $file; |
|
| 482 | - } |
|
| 483 | - } else { |
|
| 484 | - $msg = ['zbug_balise_inexistante', ['from' => 'CVT', 'balise' => $nom]]; |
|
| 485 | - erreur_squelette($msg, $context_compil); |
|
| 486 | - |
|
| 487 | - return ''; |
|
| 488 | - } |
|
| 489 | - } |
|
| 490 | - |
|
| 491 | - if ($appel_php_depuis_modele) { |
|
| 492 | - $context_compil['appel_php_depuis_modele'] = true; |
|
| 493 | - } |
|
| 494 | - return synthetiser_balise_dynamique($nom_balise, $r, $file, $context_compil); |
|
| 414 | + /** @var string Nom de la balise à charger (balise demandée ou balise générique) */ |
|
| 415 | + $nom_balise = $nom; |
|
| 416 | + /** @var string Nom de la balise générique (si utilisée) */ |
|
| 417 | + $nom_balise_generique = ''; |
|
| 418 | + |
|
| 419 | + $appel_php_depuis_modele = false; |
|
| 420 | + if ( |
|
| 421 | + is_array($context_compil) |
|
| 422 | + && !is_numeric($context_compil[3]) |
|
| 423 | + && empty($context_compil[0]) |
|
| 424 | + && empty($context_compil[1]) |
|
| 425 | + && empty($context_compil[2]) |
|
| 426 | + && empty($context_compil[3]) |
|
| 427 | + ) { |
|
| 428 | + $appel_php_depuis_modele = true; |
|
| 429 | + } |
|
| 430 | + |
|
| 431 | + if (!$fonction_balise = charger_fonction($nom_balise, 'balise', true)) { |
|
| 432 | + // Calculer un nom générique (ie. 'formulaire_' dans 'formulaire_editer_article') |
|
| 433 | + if ($balise_generique = chercher_balise_generique($nom)) { |
|
| 434 | + // injecter en premier arg le nom de la balise |
|
| 435 | + array_unshift($args, $nom); |
|
| 436 | + $nom_balise_generique = $balise_generique['nom_generique']; |
|
| 437 | + $fonction_balise = $balise_generique['fonction_generique']; |
|
| 438 | + $nom_balise = $nom_balise_generique; |
|
| 439 | + } |
|
| 440 | + unset($balise_generique); |
|
| 441 | + } |
|
| 442 | + |
|
| 443 | + if (!$fonction_balise) { |
|
| 444 | + $msg = ['zbug_balise_inexistante', ['from' => 'CVT', 'balise' => $nom]]; |
|
| 445 | + erreur_squelette($msg, $context_compil); |
|
| 446 | + |
|
| 447 | + return ''; |
|
| 448 | + } |
|
| 449 | + |
|
| 450 | + // retrouver le fichier qui a déclaré la fonction |
|
| 451 | + // même si la fonction dynamique est déclarée dans un fichier de fonctions. |
|
| 452 | + // Attention sous windows, getFileName() retourne un antislash. |
|
| 453 | + $reflector = new ReflectionFunction($fonction_balise); |
|
| 454 | + $file = str_replace('\\', '/', $reflector->getFileName()); |
|
| 455 | + if (strncmp($file, str_replace('\\', '/', _ROOT_RACINE), strlen(_ROOT_RACINE)) === 0) { |
|
| 456 | + $file = substr($file, strlen(_ROOT_RACINE)); |
|
| 457 | + } |
|
| 458 | + |
|
| 459 | + // Y a-t-il une fonction de traitement des arguments ? |
|
| 460 | + $f = 'balise_' . $nom_balise . '_stat'; |
|
| 461 | + |
|
| 462 | + $r = !function_exists($f) ? $args : $f($args, $context_compil); |
|
| 463 | + |
|
| 464 | + if (!is_array($r)) { |
|
| 465 | + return $r; |
|
| 466 | + } |
|
| 467 | + |
|
| 468 | + // verifier que la fonction dyn est la, |
|
| 469 | + // sinon se replier sur la generique si elle existe |
|
| 470 | + if (!function_exists('balise_' . $nom_balise . '_dyn')) { |
|
| 471 | + if ( |
|
| 472 | + ($balise_generique = chercher_balise_generique($nom)) |
|
| 473 | + && ($nom_balise_generique = $balise_generique['nom_generique']) |
|
| 474 | + && ($file = include_spip('balise/' . strtolower($nom_balise_generique))) |
|
| 475 | + && function_exists('balise_' . $nom_balise_generique . '_dyn') |
|
| 476 | + ) { |
|
| 477 | + // et lui injecter en premier arg le nom de la balise |
|
| 478 | + array_unshift($r, $nom); |
|
| 479 | + $nom_balise = $nom_balise_generique; |
|
| 480 | + if (!_DIR_RESTREINT) { |
|
| 481 | + $file = _DIR_RESTREINT_ABS . $file; |
|
| 482 | + } |
|
| 483 | + } else { |
|
| 484 | + $msg = ['zbug_balise_inexistante', ['from' => 'CVT', 'balise' => $nom]]; |
|
| 485 | + erreur_squelette($msg, $context_compil); |
|
| 486 | + |
|
| 487 | + return ''; |
|
| 488 | + } |
|
| 489 | + } |
|
| 490 | + |
|
| 491 | + if ($appel_php_depuis_modele) { |
|
| 492 | + $context_compil['appel_php_depuis_modele'] = true; |
|
| 493 | + } |
|
| 494 | + return synthetiser_balise_dynamique($nom_balise, $r, $file, $context_compil); |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | /** |
@@ -506,23 +506,23 @@ discard block |
||
| 506 | 506 | * @return array|null |
| 507 | 507 | */ |
| 508 | 508 | function chercher_balise_generique($nom) { |
| 509 | - if (!str_contains($nom, '_')) { |
|
| 510 | - return null; |
|
| 511 | - } |
|
| 512 | - $nom_generique = $nom; |
|
| 513 | - while (false !== ($p = strrpos($nom_generique, '_'))) { |
|
| 514 | - $nom_generique = substr($nom_generique, 0, $p + 1); |
|
| 515 | - $fonction_generique = charger_fonction($nom_generique, 'balise', true); |
|
| 516 | - if ($fonction_generique) { |
|
| 517 | - return [ |
|
| 518 | - 'nom' => $nom, |
|
| 519 | - 'nom_generique' => $nom_generique, |
|
| 520 | - 'fonction_generique' => $fonction_generique, |
|
| 521 | - ]; |
|
| 522 | - } |
|
| 523 | - $nom_generique = substr($nom_generique, 0, -1); |
|
| 524 | - } |
|
| 525 | - return null; |
|
| 509 | + if (!str_contains($nom, '_')) { |
|
| 510 | + return null; |
|
| 511 | + } |
|
| 512 | + $nom_generique = $nom; |
|
| 513 | + while (false !== ($p = strrpos($nom_generique, '_'))) { |
|
| 514 | + $nom_generique = substr($nom_generique, 0, $p + 1); |
|
| 515 | + $fonction_generique = charger_fonction($nom_generique, 'balise', true); |
|
| 516 | + if ($fonction_generique) { |
|
| 517 | + return [ |
|
| 518 | + 'nom' => $nom, |
|
| 519 | + 'nom_generique' => $nom_generique, |
|
| 520 | + 'fonction_generique' => $fonction_generique, |
|
| 521 | + ]; |
|
| 522 | + } |
|
| 523 | + $nom_generique = substr($nom_generique, 0, -1); |
|
| 524 | + } |
|
| 525 | + return null; |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | |
@@ -546,51 +546,51 @@ discard block |
||
| 546 | 546 | * @return null; |
| 547 | 547 | **/ |
| 548 | 548 | function lang_select_public($lang, $lang_select, $titre = null) { |
| 549 | - // Cas 1. forcer_lang = true et pas de critere {lang_select} |
|
| 550 | - if ( |
|
| 551 | - isset($GLOBALS['forcer_lang']) |
|
| 552 | - && $GLOBALS['forcer_lang'] |
|
| 553 | - && $lang_select !== 'oui' |
|
| 554 | - ) { |
|
| 555 | - $lang = $GLOBALS['spip_lang']; |
|
| 556 | - } // Cas 2. l'objet n'a pas de langue definie (ou definie a '') |
|
| 557 | - elseif (!strlen($lang)) { |
|
| 558 | - $lang = $GLOBALS['spip_lang']; |
|
| 559 | - } // Cas 3. l'objet est multilingue ! |
|
| 560 | - elseif ( |
|
| 561 | - $lang_select !== 'oui' |
|
| 562 | - && strlen($titre) > 10 |
|
| 563 | - && str_contains($titre, '<multi>') |
|
| 564 | - && str_contains(CollecteurHtmlTag::proteger_balisesHtml($titre), '<multi>') |
|
| 565 | - ) { |
|
| 566 | - $lang = $GLOBALS['spip_lang']; |
|
| 567 | - } |
|
| 568 | - |
|
| 569 | - // faire un lang_select() eventuellement sur la langue inchangee |
|
| 570 | - lang_select($lang); |
|
| 571 | - |
|
| 572 | - return; |
|
| 549 | + // Cas 1. forcer_lang = true et pas de critere {lang_select} |
|
| 550 | + if ( |
|
| 551 | + isset($GLOBALS['forcer_lang']) |
|
| 552 | + && $GLOBALS['forcer_lang'] |
|
| 553 | + && $lang_select !== 'oui' |
|
| 554 | + ) { |
|
| 555 | + $lang = $GLOBALS['spip_lang']; |
|
| 556 | + } // Cas 2. l'objet n'a pas de langue definie (ou definie a '') |
|
| 557 | + elseif (!strlen($lang)) { |
|
| 558 | + $lang = $GLOBALS['spip_lang']; |
|
| 559 | + } // Cas 3. l'objet est multilingue ! |
|
| 560 | + elseif ( |
|
| 561 | + $lang_select !== 'oui' |
|
| 562 | + && strlen($titre) > 10 |
|
| 563 | + && str_contains($titre, '<multi>') |
|
| 564 | + && str_contains(CollecteurHtmlTag::proteger_balisesHtml($titre), '<multi>') |
|
| 565 | + ) { |
|
| 566 | + $lang = $GLOBALS['spip_lang']; |
|
| 567 | + } |
|
| 568 | + |
|
| 569 | + // faire un lang_select() eventuellement sur la langue inchangee |
|
| 570 | + lang_select($lang); |
|
| 571 | + |
|
| 572 | + return; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | |
| 576 | 576 | // Si un tableau &doublons[articles] est passe en parametre, |
| 577 | 577 | // il faut le nettoyer car il pourrait etre injecte en SQL |
| 578 | 578 | function nettoyer_env_doublons($envd) { |
| 579 | - foreach ($envd as $table => $liste) { |
|
| 580 | - $n = ''; |
|
| 581 | - foreach (explode(',', $liste) as $val) { |
|
| 582 | - if (($a = intval($val)) && $val === strval($a)) { |
|
| 583 | - $n .= ',' . $val; |
|
| 584 | - } |
|
| 585 | - } |
|
| 586 | - if (strlen($n)) { |
|
| 587 | - $envd[$table] = $n; |
|
| 588 | - } else { |
|
| 589 | - unset($envd[$table]); |
|
| 590 | - } |
|
| 591 | - } |
|
| 592 | - |
|
| 593 | - return $envd; |
|
| 579 | + foreach ($envd as $table => $liste) { |
|
| 580 | + $n = ''; |
|
| 581 | + foreach (explode(',', $liste) as $val) { |
|
| 582 | + if (($a = intval($val)) && $val === strval($a)) { |
|
| 583 | + $n .= ',' . $val; |
|
| 584 | + } |
|
| 585 | + } |
|
| 586 | + if (strlen($n)) { |
|
| 587 | + $envd[$table] = $n; |
|
| 588 | + } else { |
|
| 589 | + unset($envd[$table]); |
|
| 590 | + } |
|
| 591 | + } |
|
| 592 | + |
|
| 593 | + return $envd; |
|
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | /** |
@@ -609,21 +609,21 @@ discard block |
||
| 609 | 609 | * Opérateur trouvé (SELF ou SUBSELECT) sinon false. |
| 610 | 610 | **/ |
| 611 | 611 | function match_self($w) { |
| 612 | - if (is_string($w)) { |
|
| 613 | - return false; |
|
| 614 | - } |
|
| 615 | - if (is_array($w)) { |
|
| 616 | - if (in_array(reset($w), ['SELF', 'SUBSELECT'])) { |
|
| 617 | - return $w; |
|
| 618 | - } |
|
| 619 | - foreach (array_filter($w, 'is_array') as $sw) { |
|
| 620 | - if ($m = match_self($sw)) { |
|
| 621 | - return $m; |
|
| 622 | - } |
|
| 623 | - } |
|
| 624 | - } |
|
| 625 | - |
|
| 626 | - return false; |
|
| 612 | + if (is_string($w)) { |
|
| 613 | + return false; |
|
| 614 | + } |
|
| 615 | + if (is_array($w)) { |
|
| 616 | + if (in_array(reset($w), ['SELF', 'SUBSELECT'])) { |
|
| 617 | + return $w; |
|
| 618 | + } |
|
| 619 | + foreach (array_filter($w, 'is_array') as $sw) { |
|
| 620 | + if ($m = match_self($sw)) { |
|
| 621 | + return $m; |
|
| 622 | + } |
|
| 623 | + } |
|
| 624 | + } |
|
| 625 | + |
|
| 626 | + return false; |
|
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | /** |
@@ -639,16 +639,16 @@ discard block |
||
| 639 | 639 | * est remplacée par son code. |
| 640 | 640 | **/ |
| 641 | 641 | function remplace_sous_requete($w, $sousrequete) { |
| 642 | - if (is_array($w)) { |
|
| 643 | - if (in_array(reset($w), ['SELF', 'SUBSELECT'])) { |
|
| 644 | - return $sousrequete; |
|
| 645 | - } |
|
| 646 | - foreach ($w as $k => $sw) { |
|
| 647 | - $w[$k] = remplace_sous_requete($sw, $sousrequete); |
|
| 648 | - } |
|
| 649 | - } |
|
| 650 | - |
|
| 651 | - return $w; |
|
| 642 | + if (is_array($w)) { |
|
| 643 | + if (in_array(reset($w), ['SELF', 'SUBSELECT'])) { |
|
| 644 | + return $sousrequete; |
|
| 645 | + } |
|
| 646 | + foreach ($w as $k => $sw) { |
|
| 647 | + $w[$k] = remplace_sous_requete($sw, $sousrequete); |
|
| 648 | + } |
|
| 649 | + } |
|
| 650 | + |
|
| 651 | + return $w; |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | /** |
@@ -662,17 +662,17 @@ discard block |
||
| 662 | 662 | * - Conditions avec des sous requêtes |
| 663 | 663 | **/ |
| 664 | 664 | function trouver_sous_requetes($where) { |
| 665 | - $where_simples = []; |
|
| 666 | - $where_sous = []; |
|
| 667 | - foreach ($where as $k => $w) { |
|
| 668 | - if (match_self($w)) { |
|
| 669 | - $where_sous[$k] = $w; |
|
| 670 | - } else { |
|
| 671 | - $where_simples[$k] = $w; |
|
| 672 | - } |
|
| 673 | - } |
|
| 674 | - |
|
| 675 | - return [$where_simples, $where_sous]; |
|
| 665 | + $where_simples = []; |
|
| 666 | + $where_sous = []; |
|
| 667 | + foreach ($where as $k => $w) { |
|
| 668 | + if (match_self($w)) { |
|
| 669 | + $where_sous[$k] = $w; |
|
| 670 | + } else { |
|
| 671 | + $where_simples[$k] = $w; |
|
| 672 | + } |
|
| 673 | + } |
|
| 674 | + |
|
| 675 | + return [$where_simples, $where_sous]; |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | |
@@ -698,293 +698,293 @@ discard block |
||
| 698 | 698 | * @return resource |
| 699 | 699 | */ |
| 700 | 700 | function calculer_select( |
| 701 | - $select = [], |
|
| 702 | - $from = [], |
|
| 703 | - $from_type = [], |
|
| 704 | - $where = [], |
|
| 705 | - $join = [], |
|
| 706 | - $groupby = [], |
|
| 707 | - $orderby = [], |
|
| 708 | - $limit = '', |
|
| 709 | - $having = [], |
|
| 710 | - $table = '', |
|
| 711 | - $id = '', |
|
| 712 | - $serveur = '', |
|
| 713 | - $requeter = true |
|
| 701 | + $select = [], |
|
| 702 | + $from = [], |
|
| 703 | + $from_type = [], |
|
| 704 | + $where = [], |
|
| 705 | + $join = [], |
|
| 706 | + $groupby = [], |
|
| 707 | + $orderby = [], |
|
| 708 | + $limit = '', |
|
| 709 | + $having = [], |
|
| 710 | + $table = '', |
|
| 711 | + $id = '', |
|
| 712 | + $serveur = '', |
|
| 713 | + $requeter = true |
|
| 714 | 714 | ) { |
| 715 | 715 | |
| 716 | - // retirer les criteres vides: |
|
| 717 | - // {X ?} avec X absent de l'URL |
|
| 718 | - // {par #ENV{X}} avec X absent de l'URL |
|
| 719 | - // IN sur collection vide (ce dernier devrait pouvoir etre fait a la compil) |
|
| 720 | - $menage = false; |
|
| 721 | - foreach ($where as $k => $v) { |
|
| 722 | - if (is_array($v) && count($v)) { |
|
| 723 | - if ((count($v) >= 2) && ($v[0] == 'REGEXP') && ($v[2] == "'.*'")) { |
|
| 724 | - $op = false; |
|
| 725 | - } elseif ((count($v) >= 2) && ($v[0] == 'LIKE') && ($v[2] == "'%'")) { |
|
| 726 | - $op = false; |
|
| 727 | - } else { |
|
| 728 | - $op = $v[0] ?: $v; |
|
| 729 | - } |
|
| 730 | - } else { |
|
| 731 | - $op = $v; |
|
| 732 | - } |
|
| 733 | - if (!$op || $op == 1 || $op == '0=0') { |
|
| 734 | - unset($where[$k]); |
|
| 735 | - $menage = true; |
|
| 736 | - } |
|
| 737 | - } |
|
| 738 | - |
|
| 739 | - // evacuer les eventuels groupby vide issus d'un calcul dynamique |
|
| 740 | - $groupby = array_diff($groupby, ['']); |
|
| 741 | - |
|
| 742 | - // remplacer les sous requetes recursives au calcul |
|
| 743 | - [$where_simples, $where_sous] = trouver_sous_requetes($where); |
|
| 744 | - foreach ($where_sous as $k => $w) { |
|
| 745 | - $menage = true; |
|
| 746 | - // on recupere la sous requete |
|
| 747 | - $sous = match_self($w); |
|
| 748 | - if ($sous[0] == 'SELF') { |
|
| 749 | - // c'est une sous requete identique a elle meme sous la forme (SELF,$select,$where) |
|
| 750 | - array_push($where_simples, $sous[2]); |
|
| 751 | - $wheresub = [ |
|
| 752 | - $sous[2], |
|
| 753 | - '0=0' |
|
| 754 | - ]; // pour accepter une string et forcer a faire le menage car on a surement simplifie select et where |
|
| 755 | - $jsub = $join; |
|
| 756 | - // trouver les jointures utiles a |
|
| 757 | - // reinjecter dans le where de la sous requete les conditions supplementaires des jointures qui y sont mentionnees |
|
| 758 | - // ie L1.objet='article' |
|
| 759 | - // on construit le where une fois, puis on ajoute les where complentaires si besoin, et on reconstruit le where en fonction |
|
| 760 | - $i = 0; |
|
| 761 | - do { |
|
| 762 | - $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 763 | - [$sous[1] . ' AS id'], |
|
| 764 | - $from, |
|
| 765 | - $from_type, |
|
| 766 | - $wheresub, |
|
| 767 | - $jsub, |
|
| 768 | - [], |
|
| 769 | - [], |
|
| 770 | - '', |
|
| 771 | - $having, |
|
| 772 | - $table, |
|
| 773 | - $id, |
|
| 774 | - $serveur, |
|
| 775 | - false |
|
| 776 | - ) . ')'); |
|
| 777 | - if (!$i) { |
|
| 778 | - $i = 1; |
|
| 779 | - $wherestring = calculer_where_to_string($where[$k]); |
|
| 780 | - foreach ($join as $cle => $wj) { |
|
| 781 | - if ( |
|
| 782 | - (is_countable($wj) ? count($wj) : 0) == 4 && str_contains($wherestring, (string) "{$cle}.") |
|
| 783 | - ) { |
|
| 784 | - $i = 0; |
|
| 785 | - $wheresub[] = $wj[3]; |
|
| 786 | - unset($jsub[$cle][3]); |
|
| 787 | - } |
|
| 788 | - } |
|
| 789 | - } |
|
| 790 | - } while ($i++ < 1); |
|
| 791 | - } |
|
| 792 | - if ($sous[0] == 'SUBSELECT') { |
|
| 793 | - // c'est une sous requete explicite sous la forme identique a sql_select : (SUBSELECT,$select,$from,$where,$groupby,$orderby,$limit,$having) |
|
| 794 | - array_push($where_simples, $sous[3]); // est-ce utile dans ce cas ? |
|
| 795 | - $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 796 | - $sous[1], # select |
|
| 797 | - $sous[2], #from |
|
| 798 | - [], #from_type |
|
| 799 | - $sous[3] ? (is_array($sous[3]) ? $sous[3] : [$sous[3]]) : [], |
|
| 800 | - #where, qui peut etre de la forme string comme dans sql_select |
|
| 801 | - [], #join |
|
| 802 | - $sous[4] ?: [], #groupby |
|
| 803 | - $sous[5] ?: [], #orderby |
|
| 804 | - $sous[6], #limit |
|
| 805 | - $sous[7] ?: [], #having |
|
| 806 | - $table, |
|
| 807 | - $id, |
|
| 808 | - $serveur, |
|
| 809 | - false |
|
| 810 | - ) . ')'); |
|
| 811 | - } |
|
| 812 | - array_pop($where_simples); |
|
| 813 | - } |
|
| 814 | - |
|
| 815 | - foreach ($having as $k => $v) { |
|
| 816 | - if (!$v || $v == 1 || $v == '0=0') { |
|
| 817 | - unset($having[$k]); |
|
| 818 | - } |
|
| 819 | - } |
|
| 820 | - |
|
| 821 | - // Installer les jointures. |
|
| 822 | - // Retirer celles seulement utiles aux criteres finalement absents mais |
|
| 823 | - // parcourir de la plus recente a la moins recente pour pouvoir eliminer Ln |
|
| 824 | - // si elle est seulement utile a Ln+1 elle meme inutile |
|
| 825 | - |
|
| 826 | - $afrom = []; |
|
| 827 | - $equiv = []; |
|
| 828 | - $k = count($join); |
|
| 829 | - foreach (array_reverse($join, true) as $cledef => $j) { |
|
| 830 | - $cle = $cledef; |
|
| 831 | - // le format de join est : |
|
| 832 | - // array(table depart, cle depart [,cle arrivee[,condition optionnelle and ...]]) |
|
| 833 | - $join[$cle] = array_values($join[$cle]); // recalculer les cles car des unset ont pu perturber |
|
| 834 | - if (count($join[$cle]) == 2) { |
|
| 835 | - $join[$cle][] = $join[$cle][1]; |
|
| 836 | - } |
|
| 837 | - if ((is_countable($join[$cle]) ? count($join[$cle]) : 0) == 3) { |
|
| 838 | - $join[$cle][] = ''; |
|
| 839 | - } |
|
| 840 | - [$t, $c, $carr, $and] = $join[$cle]; |
|
| 841 | - // si le nom de la jointure n'a pas ete specifiee, on prend Lx avec x sont rang dans la liste |
|
| 842 | - // pour compat avec ancienne convention |
|
| 843 | - if (is_numeric($cle)) { |
|
| 844 | - $cle = "L$k"; |
|
| 845 | - } |
|
| 846 | - $cle_where_lie = "JOIN-$cle"; |
|
| 847 | - if ( |
|
| 848 | - !$menage |
|
| 849 | - || isset($afrom[$cle]) |
|
| 850 | - || calculer_jointnul($cle, $select) |
|
| 851 | - || calculer_jointnul($cle, array_diff_key($join, [$cle => $join[$cle]])) |
|
| 852 | - || calculer_jointnul($cle, $having) |
|
| 853 | - || calculer_jointnul($cle, array_diff_key($where_simples, [$cle_where_lie => ''])) |
|
| 854 | - ) { |
|
| 855 | - // corriger les references non explicites dans select |
|
| 856 | - // ou groupby |
|
| 857 | - foreach ($select as $i => $s) { |
|
| 858 | - if ($s == $c) { |
|
| 859 | - $select[$i] = "$cle.$c AS $c"; |
|
| 860 | - break; |
|
| 861 | - } |
|
| 862 | - } |
|
| 863 | - foreach ($groupby as $i => $g) { |
|
| 864 | - if ($g == $c) { |
|
| 865 | - $groupby[$i] = "$cle.$c"; |
|
| 866 | - break; |
|
| 867 | - } |
|
| 868 | - } |
|
| 869 | - // on garde une ecriture decomposee pour permettre une simplification ulterieure si besoin |
|
| 870 | - // sans recours a preg_match |
|
| 871 | - // un implode(' ',..) est fait dans reinjecte_joint un peu plus bas |
|
| 872 | - $afrom[$t][$cle] = [ |
|
| 873 | - "\n" . |
|
| 874 | - ($from_type[$cle] ?? 'INNER') . ' JOIN', |
|
| 875 | - $from[$cle], |
|
| 876 | - "AS $cle", |
|
| 877 | - 'ON (', |
|
| 878 | - "$cle.$c", |
|
| 879 | - '=', |
|
| 880 | - "$t.$carr", |
|
| 881 | - ($and ? 'AND ' . $and : '') . |
|
| 882 | - ')' |
|
| 883 | - ]; |
|
| 884 | - if (isset($afrom[$cle])) { |
|
| 885 | - $afrom[$t] = $afrom[$t] + $afrom[$cle]; |
|
| 886 | - unset($afrom[$cle]); |
|
| 887 | - } |
|
| 888 | - $equiv[] = $carr; |
|
| 889 | - } else { |
|
| 890 | - unset($join[$cledef]); |
|
| 891 | - if (isset($where_simples[$cle_where_lie])) { |
|
| 892 | - unset($where_simples[$cle_where_lie]); |
|
| 893 | - unset($where[$cle_where_lie]); |
|
| 894 | - } |
|
| 895 | - } |
|
| 896 | - unset($from[$cle]); |
|
| 897 | - $k--; |
|
| 898 | - } |
|
| 899 | - |
|
| 900 | - if (count($afrom)) { |
|
| 901 | - // Regarder si la table principale ne sert finalement a rien comme dans |
|
| 902 | - //<BOUCLE3(MOTS){id_article}{id_mot}> class='on'</BOUCLE3> |
|
| 903 | - //<BOUCLE2(MOTS){id_article} />#TOTAL_BOUCLE<//B2> |
|
| 904 | - //<BOUCLE5(RUBRIQUES){id_mot}{tout} />#TOTAL_BOUCLE<//B5> |
|
| 905 | - // ou dans |
|
| 906 | - //<BOUCLE8(HIERARCHIE){id_rubrique}{tout}{type='Squelette'}{inverse}{0,1}{lang_select=non} />#TOTAL_BOUCLE<//B8> |
|
| 907 | - // qui comporte plusieurs jointures |
|
| 908 | - // ou dans |
|
| 909 | - // <BOUCLE6(ARTICLES){id_mot=2}{statut==.*} />#TOTAL_BOUCLE<//B6> |
|
| 910 | - // <BOUCLE7(ARTICLES){id_mot>0}{statut?} />#TOTAL_BOUCLE<//B7> |
|
| 911 | - // penser a regarder aussi la clause orderby pour ne pas simplifier abusivement |
|
| 912 | - // <BOUCLE9(ARTICLES){recherche truc}{par titre}>#ID_ARTICLE</BOUCLE9> |
|
| 913 | - // penser a regarder aussi la clause groubpy pour ne pas simplifier abusivement |
|
| 914 | - // <BOUCLE10(EVENEMENTS){id_rubrique} />#TOTAL_BOUCLE<//B10> |
|
| 915 | - |
|
| 916 | - $t = key($from); |
|
| 917 | - $c = current($from); |
|
| 918 | - reset($from); |
|
| 919 | - $e = '/\b(' . "$t\\." . join('|' . $t . '\.', $equiv) . ')\b/'; |
|
| 920 | - if ( |
|
| 921 | - !( |
|
| 922 | - strpos($t, ' ') |
|
| 923 | - // jointure des le depart cf boucle_doc |
|
| 924 | - || calculer_jointnul($t, $select, $e) |
|
| 925 | - || calculer_jointnul($t, $join, $e) |
|
| 926 | - || calculer_jointnul($t, $where, $e) |
|
| 927 | - || calculer_jointnul($t, $orderby, $e) |
|
| 928 | - || calculer_jointnul($t, $groupby, $e) || calculer_jointnul($t, $having, $e) |
|
| 929 | - ) |
|
| 930 | - && count($afrom[$t]) |
|
| 931 | - ) { |
|
| 932 | - $nfrom = reset($afrom[$t]); |
|
| 933 | - $nt = array_key_first($afrom[$t]); |
|
| 934 | - unset($from[$t]); |
|
| 935 | - $from[$nt] = $nfrom[1]; |
|
| 936 | - unset($afrom[$t][$nt]); |
|
| 937 | - $afrom[$nt] = $afrom[$t]; |
|
| 938 | - unset($afrom[$t]); |
|
| 939 | - $e = '/\b' . preg_quote($nfrom[6]) . '\b/'; |
|
| 940 | - $t = $nfrom[4]; |
|
| 941 | - $alias = ''; |
|
| 942 | - // verifier que les deux cles sont homonymes, sinon installer un alias dans le select |
|
| 943 | - $oldcle = explode('.', $nfrom[6]); |
|
| 944 | - $oldcle = end($oldcle); |
|
| 945 | - $newcle = explode('.', $nfrom[4]); |
|
| 946 | - $newcle = end($newcle); |
|
| 947 | - if ($newcle != $oldcle) { |
|
| 948 | - // si l'ancienne cle etait deja dans le select avec un AS |
|
| 949 | - // reprendre simplement ce AS |
|
| 950 | - $as = '/\b' . preg_quote($nfrom[6]) . '\s+(AS\s+\w+)\b/'; |
|
| 951 | - if (preg_match($as, implode(',', $select), $m)) { |
|
| 952 | - $alias = ''; |
|
| 953 | - } else { |
|
| 954 | - $alias = ', ' . $nfrom[4] . " AS $oldcle"; |
|
| 955 | - } |
|
| 956 | - } |
|
| 957 | - $select = remplacer_jointnul($t . $alias, $select, $e); |
|
| 958 | - $join = remplacer_jointnul($t, $join, $e); |
|
| 959 | - $where = remplacer_jointnul($t, $where, $e); |
|
| 960 | - $having = remplacer_jointnul($t, $having, $e); |
|
| 961 | - $groupby = remplacer_jointnul($t, $groupby, $e); |
|
| 962 | - $orderby = remplacer_jointnul($t, $orderby, $e); |
|
| 963 | - } |
|
| 964 | - $from = reinjecte_joint($afrom, $from); |
|
| 965 | - } |
|
| 966 | - if (empty($GLOBALS['debug']) || !is_array($GLOBALS['debug'])) { |
|
| 967 | - $wasdebug = empty($GLOBALS['debug']) ? false : $GLOBALS['debug']; |
|
| 968 | - $GLOBALS['debug'] = []; |
|
| 969 | - if ($wasdebug) { |
|
| 970 | - $GLOBALS['debug']['debug'] = true; |
|
| 971 | - } |
|
| 972 | - } |
|
| 973 | - $GLOBALS['debug']['aucasou'] = [$table, $id, $serveur, $requeter]; |
|
| 974 | - $r = sql_select( |
|
| 975 | - $select, |
|
| 976 | - $from, |
|
| 977 | - $where, |
|
| 978 | - $groupby, |
|
| 979 | - array_filter($orderby), |
|
| 980 | - $limit, |
|
| 981 | - $having, |
|
| 982 | - $serveur, |
|
| 983 | - $requeter |
|
| 984 | - ); |
|
| 985 | - unset($GLOBALS['debug']['aucasou']); |
|
| 986 | - |
|
| 987 | - return $r; |
|
| 716 | + // retirer les criteres vides: |
|
| 717 | + // {X ?} avec X absent de l'URL |
|
| 718 | + // {par #ENV{X}} avec X absent de l'URL |
|
| 719 | + // IN sur collection vide (ce dernier devrait pouvoir etre fait a la compil) |
|
| 720 | + $menage = false; |
|
| 721 | + foreach ($where as $k => $v) { |
|
| 722 | + if (is_array($v) && count($v)) { |
|
| 723 | + if ((count($v) >= 2) && ($v[0] == 'REGEXP') && ($v[2] == "'.*'")) { |
|
| 724 | + $op = false; |
|
| 725 | + } elseif ((count($v) >= 2) && ($v[0] == 'LIKE') && ($v[2] == "'%'")) { |
|
| 726 | + $op = false; |
|
| 727 | + } else { |
|
| 728 | + $op = $v[0] ?: $v; |
|
| 729 | + } |
|
| 730 | + } else { |
|
| 731 | + $op = $v; |
|
| 732 | + } |
|
| 733 | + if (!$op || $op == 1 || $op == '0=0') { |
|
| 734 | + unset($where[$k]); |
|
| 735 | + $menage = true; |
|
| 736 | + } |
|
| 737 | + } |
|
| 738 | + |
|
| 739 | + // evacuer les eventuels groupby vide issus d'un calcul dynamique |
|
| 740 | + $groupby = array_diff($groupby, ['']); |
|
| 741 | + |
|
| 742 | + // remplacer les sous requetes recursives au calcul |
|
| 743 | + [$where_simples, $where_sous] = trouver_sous_requetes($where); |
|
| 744 | + foreach ($where_sous as $k => $w) { |
|
| 745 | + $menage = true; |
|
| 746 | + // on recupere la sous requete |
|
| 747 | + $sous = match_self($w); |
|
| 748 | + if ($sous[0] == 'SELF') { |
|
| 749 | + // c'est une sous requete identique a elle meme sous la forme (SELF,$select,$where) |
|
| 750 | + array_push($where_simples, $sous[2]); |
|
| 751 | + $wheresub = [ |
|
| 752 | + $sous[2], |
|
| 753 | + '0=0' |
|
| 754 | + ]; // pour accepter une string et forcer a faire le menage car on a surement simplifie select et where |
|
| 755 | + $jsub = $join; |
|
| 756 | + // trouver les jointures utiles a |
|
| 757 | + // reinjecter dans le where de la sous requete les conditions supplementaires des jointures qui y sont mentionnees |
|
| 758 | + // ie L1.objet='article' |
|
| 759 | + // on construit le where une fois, puis on ajoute les where complentaires si besoin, et on reconstruit le where en fonction |
|
| 760 | + $i = 0; |
|
| 761 | + do { |
|
| 762 | + $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 763 | + [$sous[1] . ' AS id'], |
|
| 764 | + $from, |
|
| 765 | + $from_type, |
|
| 766 | + $wheresub, |
|
| 767 | + $jsub, |
|
| 768 | + [], |
|
| 769 | + [], |
|
| 770 | + '', |
|
| 771 | + $having, |
|
| 772 | + $table, |
|
| 773 | + $id, |
|
| 774 | + $serveur, |
|
| 775 | + false |
|
| 776 | + ) . ')'); |
|
| 777 | + if (!$i) { |
|
| 778 | + $i = 1; |
|
| 779 | + $wherestring = calculer_where_to_string($where[$k]); |
|
| 780 | + foreach ($join as $cle => $wj) { |
|
| 781 | + if ( |
|
| 782 | + (is_countable($wj) ? count($wj) : 0) == 4 && str_contains($wherestring, (string) "{$cle}.") |
|
| 783 | + ) { |
|
| 784 | + $i = 0; |
|
| 785 | + $wheresub[] = $wj[3]; |
|
| 786 | + unset($jsub[$cle][3]); |
|
| 787 | + } |
|
| 788 | + } |
|
| 789 | + } |
|
| 790 | + } while ($i++ < 1); |
|
| 791 | + } |
|
| 792 | + if ($sous[0] == 'SUBSELECT') { |
|
| 793 | + // c'est une sous requete explicite sous la forme identique a sql_select : (SUBSELECT,$select,$from,$where,$groupby,$orderby,$limit,$having) |
|
| 794 | + array_push($where_simples, $sous[3]); // est-ce utile dans ce cas ? |
|
| 795 | + $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 796 | + $sous[1], # select |
|
| 797 | + $sous[2], #from |
|
| 798 | + [], #from_type |
|
| 799 | + $sous[3] ? (is_array($sous[3]) ? $sous[3] : [$sous[3]]) : [], |
|
| 800 | + #where, qui peut etre de la forme string comme dans sql_select |
|
| 801 | + [], #join |
|
| 802 | + $sous[4] ?: [], #groupby |
|
| 803 | + $sous[5] ?: [], #orderby |
|
| 804 | + $sous[6], #limit |
|
| 805 | + $sous[7] ?: [], #having |
|
| 806 | + $table, |
|
| 807 | + $id, |
|
| 808 | + $serveur, |
|
| 809 | + false |
|
| 810 | + ) . ')'); |
|
| 811 | + } |
|
| 812 | + array_pop($where_simples); |
|
| 813 | + } |
|
| 814 | + |
|
| 815 | + foreach ($having as $k => $v) { |
|
| 816 | + if (!$v || $v == 1 || $v == '0=0') { |
|
| 817 | + unset($having[$k]); |
|
| 818 | + } |
|
| 819 | + } |
|
| 820 | + |
|
| 821 | + // Installer les jointures. |
|
| 822 | + // Retirer celles seulement utiles aux criteres finalement absents mais |
|
| 823 | + // parcourir de la plus recente a la moins recente pour pouvoir eliminer Ln |
|
| 824 | + // si elle est seulement utile a Ln+1 elle meme inutile |
|
| 825 | + |
|
| 826 | + $afrom = []; |
|
| 827 | + $equiv = []; |
|
| 828 | + $k = count($join); |
|
| 829 | + foreach (array_reverse($join, true) as $cledef => $j) { |
|
| 830 | + $cle = $cledef; |
|
| 831 | + // le format de join est : |
|
| 832 | + // array(table depart, cle depart [,cle arrivee[,condition optionnelle and ...]]) |
|
| 833 | + $join[$cle] = array_values($join[$cle]); // recalculer les cles car des unset ont pu perturber |
|
| 834 | + if (count($join[$cle]) == 2) { |
|
| 835 | + $join[$cle][] = $join[$cle][1]; |
|
| 836 | + } |
|
| 837 | + if ((is_countable($join[$cle]) ? count($join[$cle]) : 0) == 3) { |
|
| 838 | + $join[$cle][] = ''; |
|
| 839 | + } |
|
| 840 | + [$t, $c, $carr, $and] = $join[$cle]; |
|
| 841 | + // si le nom de la jointure n'a pas ete specifiee, on prend Lx avec x sont rang dans la liste |
|
| 842 | + // pour compat avec ancienne convention |
|
| 843 | + if (is_numeric($cle)) { |
|
| 844 | + $cle = "L$k"; |
|
| 845 | + } |
|
| 846 | + $cle_where_lie = "JOIN-$cle"; |
|
| 847 | + if ( |
|
| 848 | + !$menage |
|
| 849 | + || isset($afrom[$cle]) |
|
| 850 | + || calculer_jointnul($cle, $select) |
|
| 851 | + || calculer_jointnul($cle, array_diff_key($join, [$cle => $join[$cle]])) |
|
| 852 | + || calculer_jointnul($cle, $having) |
|
| 853 | + || calculer_jointnul($cle, array_diff_key($where_simples, [$cle_where_lie => ''])) |
|
| 854 | + ) { |
|
| 855 | + // corriger les references non explicites dans select |
|
| 856 | + // ou groupby |
|
| 857 | + foreach ($select as $i => $s) { |
|
| 858 | + if ($s == $c) { |
|
| 859 | + $select[$i] = "$cle.$c AS $c"; |
|
| 860 | + break; |
|
| 861 | + } |
|
| 862 | + } |
|
| 863 | + foreach ($groupby as $i => $g) { |
|
| 864 | + if ($g == $c) { |
|
| 865 | + $groupby[$i] = "$cle.$c"; |
|
| 866 | + break; |
|
| 867 | + } |
|
| 868 | + } |
|
| 869 | + // on garde une ecriture decomposee pour permettre une simplification ulterieure si besoin |
|
| 870 | + // sans recours a preg_match |
|
| 871 | + // un implode(' ',..) est fait dans reinjecte_joint un peu plus bas |
|
| 872 | + $afrom[$t][$cle] = [ |
|
| 873 | + "\n" . |
|
| 874 | + ($from_type[$cle] ?? 'INNER') . ' JOIN', |
|
| 875 | + $from[$cle], |
|
| 876 | + "AS $cle", |
|
| 877 | + 'ON (', |
|
| 878 | + "$cle.$c", |
|
| 879 | + '=', |
|
| 880 | + "$t.$carr", |
|
| 881 | + ($and ? 'AND ' . $and : '') . |
|
| 882 | + ')' |
|
| 883 | + ]; |
|
| 884 | + if (isset($afrom[$cle])) { |
|
| 885 | + $afrom[$t] = $afrom[$t] + $afrom[$cle]; |
|
| 886 | + unset($afrom[$cle]); |
|
| 887 | + } |
|
| 888 | + $equiv[] = $carr; |
|
| 889 | + } else { |
|
| 890 | + unset($join[$cledef]); |
|
| 891 | + if (isset($where_simples[$cle_where_lie])) { |
|
| 892 | + unset($where_simples[$cle_where_lie]); |
|
| 893 | + unset($where[$cle_where_lie]); |
|
| 894 | + } |
|
| 895 | + } |
|
| 896 | + unset($from[$cle]); |
|
| 897 | + $k--; |
|
| 898 | + } |
|
| 899 | + |
|
| 900 | + if (count($afrom)) { |
|
| 901 | + // Regarder si la table principale ne sert finalement a rien comme dans |
|
| 902 | + //<BOUCLE3(MOTS){id_article}{id_mot}> class='on'</BOUCLE3> |
|
| 903 | + //<BOUCLE2(MOTS){id_article} />#TOTAL_BOUCLE<//B2> |
|
| 904 | + //<BOUCLE5(RUBRIQUES){id_mot}{tout} />#TOTAL_BOUCLE<//B5> |
|
| 905 | + // ou dans |
|
| 906 | + //<BOUCLE8(HIERARCHIE){id_rubrique}{tout}{type='Squelette'}{inverse}{0,1}{lang_select=non} />#TOTAL_BOUCLE<//B8> |
|
| 907 | + // qui comporte plusieurs jointures |
|
| 908 | + // ou dans |
|
| 909 | + // <BOUCLE6(ARTICLES){id_mot=2}{statut==.*} />#TOTAL_BOUCLE<//B6> |
|
| 910 | + // <BOUCLE7(ARTICLES){id_mot>0}{statut?} />#TOTAL_BOUCLE<//B7> |
|
| 911 | + // penser a regarder aussi la clause orderby pour ne pas simplifier abusivement |
|
| 912 | + // <BOUCLE9(ARTICLES){recherche truc}{par titre}>#ID_ARTICLE</BOUCLE9> |
|
| 913 | + // penser a regarder aussi la clause groubpy pour ne pas simplifier abusivement |
|
| 914 | + // <BOUCLE10(EVENEMENTS){id_rubrique} />#TOTAL_BOUCLE<//B10> |
|
| 915 | + |
|
| 916 | + $t = key($from); |
|
| 917 | + $c = current($from); |
|
| 918 | + reset($from); |
|
| 919 | + $e = '/\b(' . "$t\\." . join('|' . $t . '\.', $equiv) . ')\b/'; |
|
| 920 | + if ( |
|
| 921 | + !( |
|
| 922 | + strpos($t, ' ') |
|
| 923 | + // jointure des le depart cf boucle_doc |
|
| 924 | + || calculer_jointnul($t, $select, $e) |
|
| 925 | + || calculer_jointnul($t, $join, $e) |
|
| 926 | + || calculer_jointnul($t, $where, $e) |
|
| 927 | + || calculer_jointnul($t, $orderby, $e) |
|
| 928 | + || calculer_jointnul($t, $groupby, $e) || calculer_jointnul($t, $having, $e) |
|
| 929 | + ) |
|
| 930 | + && count($afrom[$t]) |
|
| 931 | + ) { |
|
| 932 | + $nfrom = reset($afrom[$t]); |
|
| 933 | + $nt = array_key_first($afrom[$t]); |
|
| 934 | + unset($from[$t]); |
|
| 935 | + $from[$nt] = $nfrom[1]; |
|
| 936 | + unset($afrom[$t][$nt]); |
|
| 937 | + $afrom[$nt] = $afrom[$t]; |
|
| 938 | + unset($afrom[$t]); |
|
| 939 | + $e = '/\b' . preg_quote($nfrom[6]) . '\b/'; |
|
| 940 | + $t = $nfrom[4]; |
|
| 941 | + $alias = ''; |
|
| 942 | + // verifier que les deux cles sont homonymes, sinon installer un alias dans le select |
|
| 943 | + $oldcle = explode('.', $nfrom[6]); |
|
| 944 | + $oldcle = end($oldcle); |
|
| 945 | + $newcle = explode('.', $nfrom[4]); |
|
| 946 | + $newcle = end($newcle); |
|
| 947 | + if ($newcle != $oldcle) { |
|
| 948 | + // si l'ancienne cle etait deja dans le select avec un AS |
|
| 949 | + // reprendre simplement ce AS |
|
| 950 | + $as = '/\b' . preg_quote($nfrom[6]) . '\s+(AS\s+\w+)\b/'; |
|
| 951 | + if (preg_match($as, implode(',', $select), $m)) { |
|
| 952 | + $alias = ''; |
|
| 953 | + } else { |
|
| 954 | + $alias = ', ' . $nfrom[4] . " AS $oldcle"; |
|
| 955 | + } |
|
| 956 | + } |
|
| 957 | + $select = remplacer_jointnul($t . $alias, $select, $e); |
|
| 958 | + $join = remplacer_jointnul($t, $join, $e); |
|
| 959 | + $where = remplacer_jointnul($t, $where, $e); |
|
| 960 | + $having = remplacer_jointnul($t, $having, $e); |
|
| 961 | + $groupby = remplacer_jointnul($t, $groupby, $e); |
|
| 962 | + $orderby = remplacer_jointnul($t, $orderby, $e); |
|
| 963 | + } |
|
| 964 | + $from = reinjecte_joint($afrom, $from); |
|
| 965 | + } |
|
| 966 | + if (empty($GLOBALS['debug']) || !is_array($GLOBALS['debug'])) { |
|
| 967 | + $wasdebug = empty($GLOBALS['debug']) ? false : $GLOBALS['debug']; |
|
| 968 | + $GLOBALS['debug'] = []; |
|
| 969 | + if ($wasdebug) { |
|
| 970 | + $GLOBALS['debug']['debug'] = true; |
|
| 971 | + } |
|
| 972 | + } |
|
| 973 | + $GLOBALS['debug']['aucasou'] = [$table, $id, $serveur, $requeter]; |
|
| 974 | + $r = sql_select( |
|
| 975 | + $select, |
|
| 976 | + $from, |
|
| 977 | + $where, |
|
| 978 | + $groupby, |
|
| 979 | + array_filter($orderby), |
|
| 980 | + $limit, |
|
| 981 | + $having, |
|
| 982 | + $serveur, |
|
| 983 | + $requeter |
|
| 984 | + ); |
|
| 985 | + unset($GLOBALS['debug']['aucasou']); |
|
| 986 | + |
|
| 987 | + return $r; |
|
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | /** |
@@ -995,79 +995,79 @@ discard block |
||
| 995 | 995 | * @return string |
| 996 | 996 | */ |
| 997 | 997 | function calculer_where_to_string($v, $join = 'AND') { |
| 998 | - if (empty($v)) { |
|
| 999 | - return ''; |
|
| 1000 | - } |
|
| 1001 | - |
|
| 1002 | - if (!is_array($v)) { |
|
| 1003 | - return $v; |
|
| 1004 | - } else { |
|
| 1005 | - $exp = ''; |
|
| 1006 | - if (strtoupper($join) === 'AND') { |
|
| 1007 | - return $exp . join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 1008 | - } else { |
|
| 1009 | - return $exp . join($join, $v); |
|
| 1010 | - } |
|
| 1011 | - } |
|
| 998 | + if (empty($v)) { |
|
| 999 | + return ''; |
|
| 1000 | + } |
|
| 1001 | + |
|
| 1002 | + if (!is_array($v)) { |
|
| 1003 | + return $v; |
|
| 1004 | + } else { |
|
| 1005 | + $exp = ''; |
|
| 1006 | + if (strtoupper($join) === 'AND') { |
|
| 1007 | + return $exp . join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 1008 | + } else { |
|
| 1009 | + return $exp . join($join, $v); |
|
| 1010 | + } |
|
| 1011 | + } |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | |
| 1015 | 1015 | //condition suffisante (mais non necessaire) pour qu'une table soit utile |
| 1016 | 1016 | |
| 1017 | 1017 | function calculer_jointnul($cle, $exp, $equiv = '') { |
| 1018 | - if (!is_array($exp)) { |
|
| 1019 | - if ($equiv) { |
|
| 1020 | - $exp = preg_replace($equiv, '', $exp); |
|
| 1021 | - } |
|
| 1022 | - |
|
| 1023 | - return preg_match("/\\b$cle\\./", $exp); |
|
| 1024 | - } else { |
|
| 1025 | - foreach ($exp as $v) { |
|
| 1026 | - if (calculer_jointnul($cle, $v, $equiv)) { |
|
| 1027 | - return true; |
|
| 1028 | - } |
|
| 1029 | - } |
|
| 1030 | - |
|
| 1031 | - return false; |
|
| 1032 | - } |
|
| 1018 | + if (!is_array($exp)) { |
|
| 1019 | + if ($equiv) { |
|
| 1020 | + $exp = preg_replace($equiv, '', $exp); |
|
| 1021 | + } |
|
| 1022 | + |
|
| 1023 | + return preg_match("/\\b$cle\\./", $exp); |
|
| 1024 | + } else { |
|
| 1025 | + foreach ($exp as $v) { |
|
| 1026 | + if (calculer_jointnul($cle, $v, $equiv)) { |
|
| 1027 | + return true; |
|
| 1028 | + } |
|
| 1029 | + } |
|
| 1030 | + |
|
| 1031 | + return false; |
|
| 1032 | + } |
|
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | function reinjecte_joint($afrom, $from) { |
| 1036 | - $from_synth = []; |
|
| 1037 | - foreach ($from as $k => $v) { |
|
| 1038 | - $from_synth[$k] = $from[$k]; |
|
| 1039 | - if (isset($afrom[$k])) { |
|
| 1040 | - foreach ($afrom[$k] as $kk => $vv) { |
|
| 1041 | - $afrom[$k][$kk] = implode(' ', $afrom[$k][$kk]); |
|
| 1042 | - } |
|
| 1043 | - $from_synth["$k@"] = implode(' ', $afrom[$k]); |
|
| 1044 | - unset($afrom[$k]); |
|
| 1045 | - } |
|
| 1046 | - } |
|
| 1047 | - |
|
| 1048 | - return $from_synth; |
|
| 1036 | + $from_synth = []; |
|
| 1037 | + foreach ($from as $k => $v) { |
|
| 1038 | + $from_synth[$k] = $from[$k]; |
|
| 1039 | + if (isset($afrom[$k])) { |
|
| 1040 | + foreach ($afrom[$k] as $kk => $vv) { |
|
| 1041 | + $afrom[$k][$kk] = implode(' ', $afrom[$k][$kk]); |
|
| 1042 | + } |
|
| 1043 | + $from_synth["$k@"] = implode(' ', $afrom[$k]); |
|
| 1044 | + unset($afrom[$k]); |
|
| 1045 | + } |
|
| 1046 | + } |
|
| 1047 | + |
|
| 1048 | + return $from_synth; |
|
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | function remplacer_jointnul($cle, $exp, $equiv = '') { |
| 1052 | - if (!is_array($exp)) { |
|
| 1053 | - return preg_replace($equiv, $cle, $exp); |
|
| 1054 | - } else { |
|
| 1055 | - foreach ($exp as $k => $v) { |
|
| 1056 | - $exp[$k] = remplacer_jointnul($cle, $v, $equiv); |
|
| 1057 | - } |
|
| 1058 | - |
|
| 1059 | - return $exp; |
|
| 1060 | - } |
|
| 1052 | + if (!is_array($exp)) { |
|
| 1053 | + return preg_replace($equiv, $cle, $exp); |
|
| 1054 | + } else { |
|
| 1055 | + foreach ($exp as $k => $v) { |
|
| 1056 | + $exp[$k] = remplacer_jointnul($cle, $v, $equiv); |
|
| 1057 | + } |
|
| 1058 | + |
|
| 1059 | + return $exp; |
|
| 1060 | + } |
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | // calcul du nom du squelette |
| 1064 | 1064 | function calculer_nom_fonction_squel($skel, $mime_type = 'html', string $connect = '') { |
| 1065 | - // ne pas doublonner les squelette selon qu'ils sont calcules depuis ecrire/ ou depuis la racine |
|
| 1066 | - if (($l = strlen(_DIR_RACINE)) && strncmp($skel, _DIR_RACINE, $l) == 0) { |
|
| 1067 | - $skel = substr($skel, strlen(_DIR_RACINE)); |
|
| 1068 | - } |
|
| 1069 | - |
|
| 1070 | - return $mime_type |
|
| 1071 | - . (!$connect ? '' : preg_replace('/\W/', '_', $connect)) . '_' |
|
| 1072 | - . md5($GLOBALS['spip_version_code'] . ' * ' . $skel . (isset($GLOBALS['marqueur_skel']) ? '*' . $GLOBALS['marqueur_skel'] : '')); |
|
| 1065 | + // ne pas doublonner les squelette selon qu'ils sont calcules depuis ecrire/ ou depuis la racine |
|
| 1066 | + if (($l = strlen(_DIR_RACINE)) && strncmp($skel, _DIR_RACINE, $l) == 0) { |
|
| 1067 | + $skel = substr($skel, strlen(_DIR_RACINE)); |
|
| 1068 | + } |
|
| 1069 | + |
|
| 1070 | + return $mime_type |
|
| 1071 | + . (!$connect ? '' : preg_replace('/\W/', '_', $connect)) . '_' |
|
| 1072 | + . md5($GLOBALS['spip_version_code'] . ' * ' . $skel . (isset($GLOBALS['marqueur_skel']) ? '*' . $GLOBALS['marqueur_skel'] : '')); |
|
| 1073 | 1073 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -28,50 +28,50 @@ discard block |
||
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | - /** @var bool Évaluation réussie ? */ |
|
| 31 | + /** @var bool Évaluation réussie ? */ |
|
| 32 | 32 | $res = true; |
| 33 | 33 | |
| 34 | 34 | // Cas d'une page contenant du PHP : |
| 35 | 35 | if (empty($page['process_ins']) || $page['process_ins'] != 'html') { |
| 36 | - include_spip('inc/lang'); |
|
| 36 | + include_spip('inc/lang'); |
|
| 37 | 37 | |
| 38 | - // restaurer l'etat des notes avant calcul |
|
| 39 | - if ( |
|
| 40 | - isset($page['notes']) |
|
| 41 | - && $page['notes'] |
|
| 42 | - && ($notes = charger_fonction('notes', 'inc', true)) |
|
| 43 | - ) { |
|
| 44 | - $notes($page['notes'], 'restaurer_etat'); |
|
| 45 | - } |
|
| 46 | - ob_start(); |
|
| 47 | - if (str_contains((string) $page['texte'], '?xml')) { |
|
| 48 | - $page['texte'] = str_replace('<?xml', "<\1?xml", (string) $page['texte']); |
|
| 49 | - } |
|
| 38 | + // restaurer l'etat des notes avant calcul |
|
| 39 | + if ( |
|
| 40 | + isset($page['notes']) |
|
| 41 | + && $page['notes'] |
|
| 42 | + && ($notes = charger_fonction('notes', 'inc', true)) |
|
| 43 | + ) { |
|
| 44 | + $notes($page['notes'], 'restaurer_etat'); |
|
| 45 | + } |
|
| 46 | + ob_start(); |
|
| 47 | + if (str_contains((string) $page['texte'], '?xml')) { |
|
| 48 | + $page['texte'] = str_replace('<?xml', "<\1?xml", (string) $page['texte']); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - try { |
|
| 52 | - $res = eval('?' . '>' . $page['texte']); |
|
| 53 | - $page['texte'] = ob_get_contents(); |
|
| 54 | - } catch (\Throwable $e) { |
|
| 55 | - $code = $page['texte']; |
|
| 56 | - $GLOBALS['numero_ligne_php'] = 1; |
|
| 57 | - if (!function_exists('numerote_ligne_php')) { |
|
| 58 | - function numerote_ligne_php($match) { |
|
| 59 | - $GLOBALS['numero_ligne_php']++; |
|
| 60 | - return "\n/*" . str_pad((string) $GLOBALS['numero_ligne_php'], 3, '0', STR_PAD_LEFT) . '*/'; |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - $code = '/*001*/' . preg_replace_callback(",\n,", 'numerote_ligne_php', (string) $code); |
|
| 64 | - $code = trim(highlight_string($code, true)); |
|
| 65 | - erreur_squelette('L' . $e->getLine() . ': ' . $e->getMessage() . '<br />' . $code, [$page['source'],'',$e->getFile(),'',$GLOBALS['spip_lang']]); |
|
| 66 | - $page['texte'] = '<!-- Erreur -->'; |
|
| 67 | - } |
|
| 68 | - ob_end_clean(); |
|
| 51 | + try { |
|
| 52 | + $res = eval('?' . '>' . $page['texte']); |
|
| 53 | + $page['texte'] = ob_get_contents(); |
|
| 54 | + } catch (\Throwable $e) { |
|
| 55 | + $code = $page['texte']; |
|
| 56 | + $GLOBALS['numero_ligne_php'] = 1; |
|
| 57 | + if (!function_exists('numerote_ligne_php')) { |
|
| 58 | + function numerote_ligne_php($match) { |
|
| 59 | + $GLOBALS['numero_ligne_php']++; |
|
| 60 | + return "\n/*" . str_pad((string) $GLOBALS['numero_ligne_php'], 3, '0', STR_PAD_LEFT) . '*/'; |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + $code = '/*001*/' . preg_replace_callback(",\n,", 'numerote_ligne_php', (string) $code); |
|
| 64 | + $code = trim(highlight_string($code, true)); |
|
| 65 | + erreur_squelette('L' . $e->getLine() . ': ' . $e->getMessage() . '<br />' . $code, [$page['source'],'',$e->getFile(),'',$GLOBALS['spip_lang']]); |
|
| 66 | + $page['texte'] = '<!-- Erreur -->'; |
|
| 67 | + } |
|
| 68 | + ob_end_clean(); |
|
| 69 | 69 | |
| 70 | - $page['process_ins'] = 'html'; |
|
| 70 | + $page['process_ins'] = 'html'; |
|
| 71 | 71 | |
| 72 | - if (str_contains((string) $page['texte'], '?xml')) { |
|
| 73 | - $page['texte'] = str_replace("<\1?xml", '<?xml', (string) $page['texte']); |
|
| 74 | - } |
|
| 72 | + if (str_contains((string) $page['texte'], '?xml')) { |
|
| 73 | + $page['texte'] = str_replace("<\1?xml", '<?xml', (string) $page['texte']); |
|
| 74 | + } |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // le résultat de calcul d'un squelette est toujours de type string |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | **/ |
| 28 | 28 | |
| 29 | 29 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 30 | - return; |
|
| 30 | + return; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** Début de la partie principale d'une boucle */ |
@@ -74,54 +74,54 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | function phraser_inclure(string $texte, int $ligne, array $result): array { |
| 76 | 76 | |
| 77 | - while ( |
|
| 78 | - (($p = strpos($texte, '<INC')) !== false) |
|
| 79 | - && preg_match(BALISE_INCLURE, $texte, $match, PREG_OFFSET_CAPTURE, $p) |
|
| 80 | - ) { |
|
| 81 | - $poss = array_column($match, 1); |
|
| 82 | - $match = array_column($match, 0); |
|
| 83 | - $match = array_pad($match, 3, null); |
|
| 84 | - |
|
| 85 | - $p = $poss[0]; |
|
| 86 | - $debut = substr($texte, 0, $p); |
|
| 87 | - if ($p) { |
|
| 88 | - $result = phraser_idiomes($debut, $ligne, $result); |
|
| 89 | - } |
|
| 90 | - $ligne += public_compte_ligne($debut); |
|
| 91 | - |
|
| 92 | - $champ = new Inclure(); |
|
| 93 | - $champ->ligne = $ligne; |
|
| 94 | - $ligne += public_compte_ligne((string) $match[0]); |
|
| 95 | - $fichier = $match[2]; |
|
| 96 | - $champ->texte = $fichier; |
|
| 97 | - |
|
| 98 | - $texte = substr($texte, $p + strlen((string) $match[0])); |
|
| 99 | - |
|
| 100 | - // on assimile {var=val} a une liste de un argument sans fonction |
|
| 101 | - $pos_apres = 0; |
|
| 102 | - phraser_args($texte, '/>', '', $result, $champ, $pos_apres); |
|
| 103 | - if (!$champ->texte || (is_countable($champ->param) ? count($champ->param) : 0) > 1) { |
|
| 104 | - if (!function_exists('normaliser_inclure')) { |
|
| 105 | - include_spip('public/normaliser'); |
|
| 106 | - } |
|
| 107 | - normaliser_inclure($champ); |
|
| 108 | - } |
|
| 109 | - $pos_fin = strpos($texte, '>', $pos_apres) + 1; |
|
| 110 | - if ( |
|
| 111 | - (strpos($texte, '</INCLUDE>', $pos_fin) === $pos_fin) |
|
| 112 | - || (strpos($texte, '</INCLURE>', $pos_fin) === $pos_fin) |
|
| 113 | - ) { |
|
| 114 | - $pos_fin += 10; |
|
| 115 | - } |
|
| 116 | - $texte = substr($texte, $pos_fin); |
|
| 117 | - $result[] = $champ; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - if ($texte != '') { |
|
| 121 | - $result = phraser_idiomes($texte, $ligne, $result); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - return $result; |
|
| 77 | + while ( |
|
| 78 | + (($p = strpos($texte, '<INC')) !== false) |
|
| 79 | + && preg_match(BALISE_INCLURE, $texte, $match, PREG_OFFSET_CAPTURE, $p) |
|
| 80 | + ) { |
|
| 81 | + $poss = array_column($match, 1); |
|
| 82 | + $match = array_column($match, 0); |
|
| 83 | + $match = array_pad($match, 3, null); |
|
| 84 | + |
|
| 85 | + $p = $poss[0]; |
|
| 86 | + $debut = substr($texte, 0, $p); |
|
| 87 | + if ($p) { |
|
| 88 | + $result = phraser_idiomes($debut, $ligne, $result); |
|
| 89 | + } |
|
| 90 | + $ligne += public_compte_ligne($debut); |
|
| 91 | + |
|
| 92 | + $champ = new Inclure(); |
|
| 93 | + $champ->ligne = $ligne; |
|
| 94 | + $ligne += public_compte_ligne((string) $match[0]); |
|
| 95 | + $fichier = $match[2]; |
|
| 96 | + $champ->texte = $fichier; |
|
| 97 | + |
|
| 98 | + $texte = substr($texte, $p + strlen((string) $match[0])); |
|
| 99 | + |
|
| 100 | + // on assimile {var=val} a une liste de un argument sans fonction |
|
| 101 | + $pos_apres = 0; |
|
| 102 | + phraser_args($texte, '/>', '', $result, $champ, $pos_apres); |
|
| 103 | + if (!$champ->texte || (is_countable($champ->param) ? count($champ->param) : 0) > 1) { |
|
| 104 | + if (!function_exists('normaliser_inclure')) { |
|
| 105 | + include_spip('public/normaliser'); |
|
| 106 | + } |
|
| 107 | + normaliser_inclure($champ); |
|
| 108 | + } |
|
| 109 | + $pos_fin = strpos($texte, '>', $pos_apres) + 1; |
|
| 110 | + if ( |
|
| 111 | + (strpos($texte, '</INCLUDE>', $pos_fin) === $pos_fin) |
|
| 112 | + || (strpos($texte, '</INCLURE>', $pos_fin) === $pos_fin) |
|
| 113 | + ) { |
|
| 114 | + $pos_fin += 10; |
|
| 115 | + } |
|
| 116 | + $texte = substr($texte, $pos_fin); |
|
| 117 | + $result[] = $champ; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + if ($texte != '') { |
|
| 121 | + $result = phraser_idiomes($texte, $ligne, $result); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + return $result; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -133,38 +133,38 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | function phraser_polyglotte(string $texte, int $ligne, array $result): array { |
| 135 | 135 | |
| 136 | - $collecteur = new Spip\Texte\Collecteur\Multis(); |
|
| 137 | - $multis = $collecteur->collecter($texte); |
|
| 138 | - |
|
| 139 | - if (!empty($multis)) { |
|
| 140 | - $pos_prev = 0; |
|
| 141 | - foreach ($multis as $multi) { |
|
| 142 | - if ($multi['pos'] > $pos_prev) { |
|
| 143 | - $champ = new Texte(); |
|
| 144 | - $champ->texte = substr($texte, $pos_prev, $multi['pos'] - $pos_prev); |
|
| 145 | - $champ->ligne = $ligne; |
|
| 146 | - $result[] = $champ; |
|
| 147 | - $ligne += public_compte_ligne($champ->texte); |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - $champ = new Polyglotte(); |
|
| 151 | - $champ->ligne = $ligne; |
|
| 152 | - $champ->traductions = $multi['trads']; |
|
| 153 | - $result[] = $champ; |
|
| 154 | - $ligne += public_compte_ligne($multi['raw']); |
|
| 155 | - $pos_prev = $multi['pos'] + $multi['length']; |
|
| 156 | - } |
|
| 157 | - $texte = substr($texte, $pos_prev); |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - if ($texte !== '') { |
|
| 161 | - $champ = new Texte(); |
|
| 162 | - $champ->texte = $texte; |
|
| 163 | - $champ->ligne = $ligne; |
|
| 164 | - $result[] = $champ; |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - return $result; |
|
| 136 | + $collecteur = new Spip\Texte\Collecteur\Multis(); |
|
| 137 | + $multis = $collecteur->collecter($texte); |
|
| 138 | + |
|
| 139 | + if (!empty($multis)) { |
|
| 140 | + $pos_prev = 0; |
|
| 141 | + foreach ($multis as $multi) { |
|
| 142 | + if ($multi['pos'] > $pos_prev) { |
|
| 143 | + $champ = new Texte(); |
|
| 144 | + $champ->texte = substr($texte, $pos_prev, $multi['pos'] - $pos_prev); |
|
| 145 | + $champ->ligne = $ligne; |
|
| 146 | + $result[] = $champ; |
|
| 147 | + $ligne += public_compte_ligne($champ->texte); |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + $champ = new Polyglotte(); |
|
| 151 | + $champ->ligne = $ligne; |
|
| 152 | + $champ->traductions = $multi['trads']; |
|
| 153 | + $result[] = $champ; |
|
| 154 | + $ligne += public_compte_ligne($multi['raw']); |
|
| 155 | + $pos_prev = $multi['pos'] + $multi['length']; |
|
| 156 | + } |
|
| 157 | + $texte = substr($texte, $pos_prev); |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + if ($texte !== '') { |
|
| 161 | + $champ = new Texte(); |
|
| 162 | + $champ->texte = $texte; |
|
| 163 | + $champ->ligne = $ligne; |
|
| 164 | + $result[] = $champ; |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + return $result; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | |
@@ -187,64 +187,64 @@ discard block |
||
| 187 | 187 | **/ |
| 188 | 188 | function phraser_idiomes(string $texte, int $ligne, array $result): array { |
| 189 | 189 | |
| 190 | - while ( |
|
| 191 | - (($p = strpos($texte, '<:')) !== false) |
|
| 192 | - && preg_match(BALISE_IDIOMES, $texte, $match, PREG_OFFSET_CAPTURE, $p) |
|
| 193 | - ) { |
|
| 194 | - $poss = array_column($match, 1); |
|
| 195 | - $match = array_column($match, 0); |
|
| 196 | - $match = array_pad($match, 8, null); |
|
| 197 | - $p = $poss[0]; |
|
| 198 | - |
|
| 199 | - $idiome = (string) $match[0]; |
|
| 200 | - // faux idiome ? |
|
| 201 | - if (!$match[3] && (empty($match[5]) || $match[5][0] !== '=')) { |
|
| 202 | - $debut = substr($texte, 0, $p + strlen($idiome)); |
|
| 203 | - $result = phraser_champs($debut, $ligne, $result); |
|
| 204 | - $ligne += public_compte_ligne($debut); |
|
| 205 | - continue; |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - $debut = substr($texte, 0, $p); |
|
| 209 | - $result = phraser_champs($debut, $ligne, $result); |
|
| 210 | - $ligne += public_compte_ligne($debut); |
|
| 211 | - |
|
| 212 | - $texte = substr($texte, $p + strlen($idiome)); |
|
| 213 | - |
|
| 214 | - $champ = new Idiome(); |
|
| 215 | - $champ->ligne = $ligne; |
|
| 216 | - $ligne += public_compte_ligne($idiome); |
|
| 217 | - // Stocker les arguments de la balise de traduction |
|
| 218 | - $args = []; |
|
| 219 | - $largs = (string) $match[5]; |
|
| 220 | - while ( |
|
| 221 | - str_contains($largs, '=') |
|
| 222 | - && preg_match(BALISE_IDIOMES_ARGS, $largs, $r) |
|
| 223 | - ) { |
|
| 224 | - $args[$r[1]] = phraser_champs($r[2], 0, []); |
|
| 225 | - $largs = substr($largs, strlen($r[0])); |
|
| 226 | - } |
|
| 227 | - $champ->arg = $args; |
|
| 228 | - |
|
| 229 | - // TODO : supprimer ce strtolower cf https://git.spip.net/spip/spip/issues/2536 |
|
| 230 | - $champ->nom_champ = strtolower((string) $match[3]); |
|
| 231 | - $champ->module = $match[2]; |
|
| 232 | - |
|
| 233 | - // pas d'imbrication pour les filtres sur langue |
|
| 234 | - $champ->apres = ''; |
|
| 235 | - if (!is_null($match[7])) { |
|
| 236 | - $pos_apres = 0; |
|
| 237 | - phraser_args($match[7], ':', '', [], $champ, $pos_apres); |
|
| 238 | - $champ->apres = substr($match[7], $pos_apres); |
|
| 239 | - } |
|
| 240 | - $result[] = $champ; |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - if ($texte !== '') { |
|
| 244 | - $result = phraser_champs($texte, $ligne, $result); |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - return $result; |
|
| 190 | + while ( |
|
| 191 | + (($p = strpos($texte, '<:')) !== false) |
|
| 192 | + && preg_match(BALISE_IDIOMES, $texte, $match, PREG_OFFSET_CAPTURE, $p) |
|
| 193 | + ) { |
|
| 194 | + $poss = array_column($match, 1); |
|
| 195 | + $match = array_column($match, 0); |
|
| 196 | + $match = array_pad($match, 8, null); |
|
| 197 | + $p = $poss[0]; |
|
| 198 | + |
|
| 199 | + $idiome = (string) $match[0]; |
|
| 200 | + // faux idiome ? |
|
| 201 | + if (!$match[3] && (empty($match[5]) || $match[5][0] !== '=')) { |
|
| 202 | + $debut = substr($texte, 0, $p + strlen($idiome)); |
|
| 203 | + $result = phraser_champs($debut, $ligne, $result); |
|
| 204 | + $ligne += public_compte_ligne($debut); |
|
| 205 | + continue; |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + $debut = substr($texte, 0, $p); |
|
| 209 | + $result = phraser_champs($debut, $ligne, $result); |
|
| 210 | + $ligne += public_compte_ligne($debut); |
|
| 211 | + |
|
| 212 | + $texte = substr($texte, $p + strlen($idiome)); |
|
| 213 | + |
|
| 214 | + $champ = new Idiome(); |
|
| 215 | + $champ->ligne = $ligne; |
|
| 216 | + $ligne += public_compte_ligne($idiome); |
|
| 217 | + // Stocker les arguments de la balise de traduction |
|
| 218 | + $args = []; |
|
| 219 | + $largs = (string) $match[5]; |
|
| 220 | + while ( |
|
| 221 | + str_contains($largs, '=') |
|
| 222 | + && preg_match(BALISE_IDIOMES_ARGS, $largs, $r) |
|
| 223 | + ) { |
|
| 224 | + $args[$r[1]] = phraser_champs($r[2], 0, []); |
|
| 225 | + $largs = substr($largs, strlen($r[0])); |
|
| 226 | + } |
|
| 227 | + $champ->arg = $args; |
|
| 228 | + |
|
| 229 | + // TODO : supprimer ce strtolower cf https://git.spip.net/spip/spip/issues/2536 |
|
| 230 | + $champ->nom_champ = strtolower((string) $match[3]); |
|
| 231 | + $champ->module = $match[2]; |
|
| 232 | + |
|
| 233 | + // pas d'imbrication pour les filtres sur langue |
|
| 234 | + $champ->apres = ''; |
|
| 235 | + if (!is_null($match[7])) { |
|
| 236 | + $pos_apres = 0; |
|
| 237 | + phraser_args($match[7], ':', '', [], $champ, $pos_apres); |
|
| 238 | + $champ->apres = substr($match[7], $pos_apres); |
|
| 239 | + } |
|
| 240 | + $result[] = $champ; |
|
| 241 | + } |
|
| 242 | + |
|
| 243 | + if ($texte !== '') { |
|
| 244 | + $result = phraser_champs($texte, $ligne, $result); |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + return $result; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -263,53 +263,53 @@ discard block |
||
| 263 | 263 | **/ |
| 264 | 264 | function phraser_champs(string $texte, int $ligne, array $result): array { |
| 265 | 265 | |
| 266 | - while ( |
|
| 267 | - (($p = strpos($texte, '#')) !== false) |
|
| 268 | - && preg_match('/' . NOM_DE_CHAMP . '/S', $texte, $match, PREG_OFFSET_CAPTURE, $p) |
|
| 269 | - ) { |
|
| 270 | - $poss = array_column($match, 1); |
|
| 271 | - $match = array_column($match, 0); |
|
| 272 | - |
|
| 273 | - $p = $poss[0]; |
|
| 274 | - if ($p) { |
|
| 275 | - $debut = substr($texte, 0, $p); |
|
| 276 | - $result = phraser_polyglotte($debut, $ligne, $result); |
|
| 277 | - $ligne += public_compte_ligne($debut); |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - $champ = new Champ(); |
|
| 281 | - $champ->ligne = $ligne; |
|
| 282 | - $ligne += public_compte_ligne($match[0]); |
|
| 283 | - $champ->nom_boucle = $match[2]; |
|
| 284 | - $champ->nom_champ = $match[3]; |
|
| 285 | - $champ->etoile = $match[5]; |
|
| 286 | - |
|
| 287 | - // texte après la balise |
|
| 288 | - $suite = substr($texte, $p + strlen($match[0])); |
|
| 289 | - if ($suite && str_starts_with($suite, '{')) { |
|
| 290 | - phraser_arg($suite, '', [], $champ); |
|
| 291 | - // ce ltrim est une ereur de conception |
|
| 292 | - // mais on le conserve par souci de compatibilite |
|
| 293 | - $texte = ltrim((string) $suite); |
|
| 294 | - // Il faudrait le normaliser dans l'arbre de syntaxe abstraite |
|
| 295 | - // pour faire sauter ce cas particulier a la decompilation. |
|
| 296 | - /* Ce qui suit est malheureusement incomplet pour cela: |
|
| 266 | + while ( |
|
| 267 | + (($p = strpos($texte, '#')) !== false) |
|
| 268 | + && preg_match('/' . NOM_DE_CHAMP . '/S', $texte, $match, PREG_OFFSET_CAPTURE, $p) |
|
| 269 | + ) { |
|
| 270 | + $poss = array_column($match, 1); |
|
| 271 | + $match = array_column($match, 0); |
|
| 272 | + |
|
| 273 | + $p = $poss[0]; |
|
| 274 | + if ($p) { |
|
| 275 | + $debut = substr($texte, 0, $p); |
|
| 276 | + $result = phraser_polyglotte($debut, $ligne, $result); |
|
| 277 | + $ligne += public_compte_ligne($debut); |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + $champ = new Champ(); |
|
| 281 | + $champ->ligne = $ligne; |
|
| 282 | + $ligne += public_compte_ligne($match[0]); |
|
| 283 | + $champ->nom_boucle = $match[2]; |
|
| 284 | + $champ->nom_champ = $match[3]; |
|
| 285 | + $champ->etoile = $match[5]; |
|
| 286 | + |
|
| 287 | + // texte après la balise |
|
| 288 | + $suite = substr($texte, $p + strlen($match[0])); |
|
| 289 | + if ($suite && str_starts_with($suite, '{')) { |
|
| 290 | + phraser_arg($suite, '', [], $champ); |
|
| 291 | + // ce ltrim est une ereur de conception |
|
| 292 | + // mais on le conserve par souci de compatibilite |
|
| 293 | + $texte = ltrim((string) $suite); |
|
| 294 | + // Il faudrait le normaliser dans l'arbre de syntaxe abstraite |
|
| 295 | + // pour faire sauter ce cas particulier a la decompilation. |
|
| 296 | + /* Ce qui suit est malheureusement incomplet pour cela: |
|
| 297 | 297 | if ($n = (strlen($suite) - strlen($texte))) { |
| 298 | 298 | $champ->apres = array(new Texte); |
| 299 | 299 | $champ->apres[0]->texte = substr($suite,0,$n); |
| 300 | 300 | } |
| 301 | 301 | */ |
| 302 | - } else { |
|
| 303 | - $texte = $suite; |
|
| 304 | - } |
|
| 305 | - phraser_vieux($champ); |
|
| 306 | - $result[] = $champ; |
|
| 307 | - } |
|
| 308 | - if ($texte !== '') { |
|
| 309 | - $result = phraser_polyglotte($texte, $ligne, $result); |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - return $result; |
|
| 302 | + } else { |
|
| 303 | + $texte = $suite; |
|
| 304 | + } |
|
| 305 | + phraser_vieux($champ); |
|
| 306 | + $result[] = $champ; |
|
| 307 | + } |
|
| 308 | + if ($texte !== '') { |
|
| 309 | + $result = phraser_polyglotte($texte, $ligne, $result); |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + return $result; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -324,17 +324,17 @@ discard block |
||
| 324 | 324 | * @see phraser_champs_interieurs() |
| 325 | 325 | */ |
| 326 | 326 | function phraser_champs_etendus(string $texte, int $ligne, array $result): array { |
| 327 | - if ($texte === '') { |
|
| 328 | - return $result; |
|
| 329 | - } |
|
| 327 | + if ($texte === '') { |
|
| 328 | + return $result; |
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | - $sep = '##'; |
|
| 332 | - while (str_contains($texte, $sep)) { |
|
| 333 | - $sep .= '#'; |
|
| 334 | - } |
|
| 331 | + $sep = '##'; |
|
| 332 | + while (str_contains($texte, $sep)) { |
|
| 333 | + $sep .= '#'; |
|
| 334 | + } |
|
| 335 | 335 | |
| 336 | - $champs = phraser_champs_interieurs($texte, $ligne, $sep); |
|
| 337 | - return array_merge($result, $champs); |
|
| 336 | + $champs = phraser_champs_interieurs($texte, $ligne, $sep); |
|
| 337 | + return array_merge($result, $champs); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
@@ -347,156 +347,156 @@ discard block |
||
| 347 | 347 | * @param Champ|Inclure|Idiome|Boucle $pointeur_champ |
| 348 | 348 | */ |
| 349 | 349 | function phraser_args(string $texte, string $fin, string $sep, array $result, &$pointeur_champ, int &$pos_debut): array { |
| 350 | - $length = strlen($texte); |
|
| 351 | - while ($pos_debut < $length && trim($texte[$pos_debut]) === '') { |
|
| 352 | - $pos_debut++; |
|
| 353 | - } |
|
| 354 | - while (($pos_debut < $length) && !str_contains($fin, $texte[$pos_debut])) { |
|
| 355 | - // phraser_arg modifie directement le $texte, on fait donc avec ici en passant par une sous chaine |
|
| 356 | - $st = substr($texte, $pos_debut); |
|
| 357 | - $result = phraser_arg($st, $sep, $result, $pointeur_champ); |
|
| 358 | - $pos_debut = $length - strlen((string) $st); |
|
| 359 | - while ($pos_debut < $length && trim($texte[$pos_debut]) === '') { |
|
| 360 | - $pos_debut++; |
|
| 361 | - } |
|
| 362 | - } |
|
| 363 | - |
|
| 364 | - return $result; |
|
| 350 | + $length = strlen($texte); |
|
| 351 | + while ($pos_debut < $length && trim($texte[$pos_debut]) === '') { |
|
| 352 | + $pos_debut++; |
|
| 353 | + } |
|
| 354 | + while (($pos_debut < $length) && !str_contains($fin, $texte[$pos_debut])) { |
|
| 355 | + // phraser_arg modifie directement le $texte, on fait donc avec ici en passant par une sous chaine |
|
| 356 | + $st = substr($texte, $pos_debut); |
|
| 357 | + $result = phraser_arg($st, $sep, $result, $pointeur_champ); |
|
| 358 | + $pos_debut = $length - strlen((string) $st); |
|
| 359 | + while ($pos_debut < $length && trim($texte[$pos_debut]) === '') { |
|
| 360 | + $pos_debut++; |
|
| 361 | + } |
|
| 362 | + } |
|
| 363 | + |
|
| 364 | + return $result; |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | function phraser_arg(&$texte, $sep, $result, &$pointeur_champ) { |
| 368 | - preg_match(',^(\|?[^}{)|]*)(.*)$,ms', (string) $texte, $match); |
|
| 369 | - $suite = ltrim($match[2]); |
|
| 370 | - $fonc = trim($match[1]); |
|
| 371 | - if ($fonc && $fonc[0] == '|') { |
|
| 372 | - $fonc = ltrim(substr($fonc, 1)); |
|
| 373 | - } |
|
| 374 | - $res = [$fonc]; |
|
| 375 | - $err_f = ''; |
|
| 376 | - // cas du filtre sans argument ou du critere / |
|
| 377 | - if (($suite && ($suite[0] != '{')) || ($fonc && $fonc[0] == '/')) { |
|
| 378 | - // si pas d'argument, alors il faut une fonction ou un double | |
|
| 379 | - if (!$match[1]) { |
|
| 380 | - $err_f = ['zbug_erreur_filtre', ['filtre' => $texte]]; |
|
| 381 | - erreur_squelette($err_f, $pointeur_champ); |
|
| 382 | - $texte = ''; |
|
| 383 | - } else { |
|
| 384 | - $texte = $suite; |
|
| 385 | - } |
|
| 386 | - if ($err_f) { |
|
| 387 | - $pointeur_champ->param = false; |
|
| 388 | - } elseif ($fonc !== '') { |
|
| 389 | - $pointeur_champ->param[] = $res; |
|
| 390 | - } |
|
| 391 | - // pour les balises avec faux filtres qui boudent ce dur larbeur |
|
| 392 | - $pointeur_champ->fonctions[] = [$fonc, '']; |
|
| 393 | - |
|
| 394 | - return $result; |
|
| 395 | - } |
|
| 396 | - $args = ltrim(substr($suite, 1)); // virer le '(' initial |
|
| 397 | - $collecte = []; |
|
| 398 | - while ($args && $args[0] != '}') { |
|
| 399 | - if ($args[0] == '"') { |
|
| 400 | - preg_match('/^(")([^"]*)(")(.*)$/ms', $args, $regs); |
|
| 401 | - } elseif ($args[0] == "'") { |
|
| 402 | - preg_match("/^(')([^']*)(')(.*)$/ms", $args, $regs); |
|
| 403 | - } else { |
|
| 404 | - preg_match('/^([[:space:]]*)([^,([{}]*([(\[{][^])}]*[])}])?[^,}]*)([,}].*)$/ms', $args, $regs); |
|
| 405 | - if (!isset($regs[2]) || !strlen($regs[2])) { |
|
| 406 | - $err_f = ['zbug_erreur_filtre', ['filtre' => $args]]; |
|
| 407 | - erreur_squelette($err_f, $pointeur_champ); |
|
| 408 | - $champ = new Texte(); |
|
| 409 | - $champ->apres = $champ->avant = $args = ''; |
|
| 410 | - break; |
|
| 411 | - } |
|
| 412 | - } |
|
| 413 | - $arg = $regs[2]; |
|
| 414 | - if (trim($regs[1])) { |
|
| 415 | - $champ = new Texte(); |
|
| 416 | - $champ->texte = $arg; |
|
| 417 | - $champ->apres = $champ->avant = $regs[1]; |
|
| 418 | - $result[] = $champ; |
|
| 419 | - $collecte[] = $champ; |
|
| 420 | - $args = ltrim($regs[count($regs) - 1]); |
|
| 421 | - } else { |
|
| 422 | - if (!preg_match('/' . NOM_DE_CHAMP . '([{|])/', $arg, $r)) { |
|
| 423 | - // 0 est un aveu d'impuissance. A completer |
|
| 424 | - $arg = phraser_champs_exterieurs($arg, 0, $sep, $result); |
|
| 425 | - |
|
| 426 | - $args = ltrim($regs[count($regs) - 1]); |
|
| 427 | - $collecte = array_merge($collecte, $arg); |
|
| 428 | - $result = array_merge($result, $arg); |
|
| 429 | - } else { |
|
| 430 | - $n = strpos($args, (string) $r[0]); |
|
| 431 | - $pred = substr($args, 0, $n); |
|
| 432 | - $par = ',}'; |
|
| 433 | - if (preg_match('/^(.*)\($/', $pred, $m)) { |
|
| 434 | - $pred = $m[1]; |
|
| 435 | - $par = ')'; |
|
| 436 | - } |
|
| 437 | - if ($pred) { |
|
| 438 | - $champ = new Texte(); |
|
| 439 | - $champ->texte = $pred; |
|
| 440 | - $champ->apres = $champ->avant = ''; |
|
| 441 | - $result[] = $champ; |
|
| 442 | - $collecte[] = $champ; |
|
| 443 | - } |
|
| 444 | - $rec = substr($args, $n + strlen($r[0]) - 1); |
|
| 445 | - $champ = new Champ(); |
|
| 446 | - $champ->nom_boucle = $r[2]; |
|
| 447 | - $champ->nom_champ = $r[3]; |
|
| 448 | - $champ->etoile = $r[5]; |
|
| 449 | - $next = $r[6]; |
|
| 450 | - while ($next == '{') { |
|
| 451 | - phraser_arg($rec, $sep, [], $champ); |
|
| 452 | - $args = ltrim((string) $rec); |
|
| 453 | - $next = $args[0] ?? ''; |
|
| 454 | - } |
|
| 455 | - while ($next == '|') { |
|
| 456 | - $pos_apres = 0; |
|
| 457 | - phraser_args($rec, $par, $sep, [], $champ, $pos_apres); |
|
| 458 | - $args = substr((string) $rec, $pos_apres); |
|
| 459 | - $next = $args[0] ?? ''; |
|
| 460 | - } |
|
| 461 | - // Si erreur de syntaxe dans un sous-argument, propager. |
|
| 462 | - if ($champ->param === false) { |
|
| 463 | - $err_f = true; |
|
| 464 | - } else { |
|
| 465 | - phraser_vieux($champ); |
|
| 466 | - } |
|
| 467 | - if ($par == ')') { |
|
| 468 | - $args = substr($args, 1); |
|
| 469 | - } |
|
| 470 | - $collecte[] = $champ; |
|
| 471 | - $result[] = $champ; |
|
| 472 | - } |
|
| 473 | - } |
|
| 474 | - if (isset($args[0]) && $args[0] == ',') { |
|
| 475 | - $args = ltrim(substr($args, 1)); |
|
| 476 | - if ($collecte) { |
|
| 477 | - $res[] = $collecte; |
|
| 478 | - $collecte = []; |
|
| 479 | - } |
|
| 480 | - } |
|
| 481 | - } |
|
| 482 | - if ($collecte) { |
|
| 483 | - $res[] = $collecte; |
|
| 484 | - $collecte = []; |
|
| 485 | - } |
|
| 486 | - $texte = substr($args, 1); |
|
| 487 | - $source = substr($suite, 0, strlen($suite) - strlen($texte)); |
|
| 488 | - // propager les erreurs, et ignorer les param vides |
|
| 489 | - if ($pointeur_champ->param !== false) { |
|
| 490 | - if ($err_f) { |
|
| 491 | - $pointeur_champ->param = false; |
|
| 492 | - } elseif ($fonc !== '' || count($res) > 1) { |
|
| 493 | - $pointeur_champ->param[] = $res; |
|
| 494 | - } |
|
| 495 | - } |
|
| 496 | - // pour les balises avec faux filtres qui boudent ce dur larbeur |
|
| 497 | - $pointeur_champ->fonctions[] = [$fonc, $source]; |
|
| 498 | - |
|
| 499 | - return $result; |
|
| 368 | + preg_match(',^(\|?[^}{)|]*)(.*)$,ms', (string) $texte, $match); |
|
| 369 | + $suite = ltrim($match[2]); |
|
| 370 | + $fonc = trim($match[1]); |
|
| 371 | + if ($fonc && $fonc[0] == '|') { |
|
| 372 | + $fonc = ltrim(substr($fonc, 1)); |
|
| 373 | + } |
|
| 374 | + $res = [$fonc]; |
|
| 375 | + $err_f = ''; |
|
| 376 | + // cas du filtre sans argument ou du critere / |
|
| 377 | + if (($suite && ($suite[0] != '{')) || ($fonc && $fonc[0] == '/')) { |
|
| 378 | + // si pas d'argument, alors il faut une fonction ou un double | |
|
| 379 | + if (!$match[1]) { |
|
| 380 | + $err_f = ['zbug_erreur_filtre', ['filtre' => $texte]]; |
|
| 381 | + erreur_squelette($err_f, $pointeur_champ); |
|
| 382 | + $texte = ''; |
|
| 383 | + } else { |
|
| 384 | + $texte = $suite; |
|
| 385 | + } |
|
| 386 | + if ($err_f) { |
|
| 387 | + $pointeur_champ->param = false; |
|
| 388 | + } elseif ($fonc !== '') { |
|
| 389 | + $pointeur_champ->param[] = $res; |
|
| 390 | + } |
|
| 391 | + // pour les balises avec faux filtres qui boudent ce dur larbeur |
|
| 392 | + $pointeur_champ->fonctions[] = [$fonc, '']; |
|
| 393 | + |
|
| 394 | + return $result; |
|
| 395 | + } |
|
| 396 | + $args = ltrim(substr($suite, 1)); // virer le '(' initial |
|
| 397 | + $collecte = []; |
|
| 398 | + while ($args && $args[0] != '}') { |
|
| 399 | + if ($args[0] == '"') { |
|
| 400 | + preg_match('/^(")([^"]*)(")(.*)$/ms', $args, $regs); |
|
| 401 | + } elseif ($args[0] == "'") { |
|
| 402 | + preg_match("/^(')([^']*)(')(.*)$/ms", $args, $regs); |
|
| 403 | + } else { |
|
| 404 | + preg_match('/^([[:space:]]*)([^,([{}]*([(\[{][^])}]*[])}])?[^,}]*)([,}].*)$/ms', $args, $regs); |
|
| 405 | + if (!isset($regs[2]) || !strlen($regs[2])) { |
|
| 406 | + $err_f = ['zbug_erreur_filtre', ['filtre' => $args]]; |
|
| 407 | + erreur_squelette($err_f, $pointeur_champ); |
|
| 408 | + $champ = new Texte(); |
|
| 409 | + $champ->apres = $champ->avant = $args = ''; |
|
| 410 | + break; |
|
| 411 | + } |
|
| 412 | + } |
|
| 413 | + $arg = $regs[2]; |
|
| 414 | + if (trim($regs[1])) { |
|
| 415 | + $champ = new Texte(); |
|
| 416 | + $champ->texte = $arg; |
|
| 417 | + $champ->apres = $champ->avant = $regs[1]; |
|
| 418 | + $result[] = $champ; |
|
| 419 | + $collecte[] = $champ; |
|
| 420 | + $args = ltrim($regs[count($regs) - 1]); |
|
| 421 | + } else { |
|
| 422 | + if (!preg_match('/' . NOM_DE_CHAMP . '([{|])/', $arg, $r)) { |
|
| 423 | + // 0 est un aveu d'impuissance. A completer |
|
| 424 | + $arg = phraser_champs_exterieurs($arg, 0, $sep, $result); |
|
| 425 | + |
|
| 426 | + $args = ltrim($regs[count($regs) - 1]); |
|
| 427 | + $collecte = array_merge($collecte, $arg); |
|
| 428 | + $result = array_merge($result, $arg); |
|
| 429 | + } else { |
|
| 430 | + $n = strpos($args, (string) $r[0]); |
|
| 431 | + $pred = substr($args, 0, $n); |
|
| 432 | + $par = ',}'; |
|
| 433 | + if (preg_match('/^(.*)\($/', $pred, $m)) { |
|
| 434 | + $pred = $m[1]; |
|
| 435 | + $par = ')'; |
|
| 436 | + } |
|
| 437 | + if ($pred) { |
|
| 438 | + $champ = new Texte(); |
|
| 439 | + $champ->texte = $pred; |
|
| 440 | + $champ->apres = $champ->avant = ''; |
|
| 441 | + $result[] = $champ; |
|
| 442 | + $collecte[] = $champ; |
|
| 443 | + } |
|
| 444 | + $rec = substr($args, $n + strlen($r[0]) - 1); |
|
| 445 | + $champ = new Champ(); |
|
| 446 | + $champ->nom_boucle = $r[2]; |
|
| 447 | + $champ->nom_champ = $r[3]; |
|
| 448 | + $champ->etoile = $r[5]; |
|
| 449 | + $next = $r[6]; |
|
| 450 | + while ($next == '{') { |
|
| 451 | + phraser_arg($rec, $sep, [], $champ); |
|
| 452 | + $args = ltrim((string) $rec); |
|
| 453 | + $next = $args[0] ?? ''; |
|
| 454 | + } |
|
| 455 | + while ($next == '|') { |
|
| 456 | + $pos_apres = 0; |
|
| 457 | + phraser_args($rec, $par, $sep, [], $champ, $pos_apres); |
|
| 458 | + $args = substr((string) $rec, $pos_apres); |
|
| 459 | + $next = $args[0] ?? ''; |
|
| 460 | + } |
|
| 461 | + // Si erreur de syntaxe dans un sous-argument, propager. |
|
| 462 | + if ($champ->param === false) { |
|
| 463 | + $err_f = true; |
|
| 464 | + } else { |
|
| 465 | + phraser_vieux($champ); |
|
| 466 | + } |
|
| 467 | + if ($par == ')') { |
|
| 468 | + $args = substr($args, 1); |
|
| 469 | + } |
|
| 470 | + $collecte[] = $champ; |
|
| 471 | + $result[] = $champ; |
|
| 472 | + } |
|
| 473 | + } |
|
| 474 | + if (isset($args[0]) && $args[0] == ',') { |
|
| 475 | + $args = ltrim(substr($args, 1)); |
|
| 476 | + if ($collecte) { |
|
| 477 | + $res[] = $collecte; |
|
| 478 | + $collecte = []; |
|
| 479 | + } |
|
| 480 | + } |
|
| 481 | + } |
|
| 482 | + if ($collecte) { |
|
| 483 | + $res[] = $collecte; |
|
| 484 | + $collecte = []; |
|
| 485 | + } |
|
| 486 | + $texte = substr($args, 1); |
|
| 487 | + $source = substr($suite, 0, strlen($suite) - strlen($texte)); |
|
| 488 | + // propager les erreurs, et ignorer les param vides |
|
| 489 | + if ($pointeur_champ->param !== false) { |
|
| 490 | + if ($err_f) { |
|
| 491 | + $pointeur_champ->param = false; |
|
| 492 | + } elseif ($fonc !== '' || count($res) > 1) { |
|
| 493 | + $pointeur_champ->param[] = $res; |
|
| 494 | + } |
|
| 495 | + } |
|
| 496 | + // pour les balises avec faux filtres qui boudent ce dur larbeur |
|
| 497 | + $pointeur_champ->fonctions[] = [$fonc, $source]; |
|
| 498 | + |
|
| 499 | + return $result; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | /** |
@@ -504,28 +504,28 @@ discard block |
||
| 504 | 504 | * et phraser les inclure sur les morceaux intermédiaires |
| 505 | 505 | */ |
| 506 | 506 | function phraser_champs_exterieurs(string $texte, int $ligne, string $sep, array $nested_res): array { |
| 507 | - $res = []; |
|
| 508 | - $preg = ',^%' . preg_quote($sep, ',') . '([0-9]+)(\n*)@,'; |
|
| 509 | - while (($p = strpos($texte, "%$sep")) !== false) { |
|
| 510 | - $suite = substr($texte, $p); |
|
| 511 | - if (!preg_match($preg, $suite, $m)) { |
|
| 512 | - break; |
|
| 513 | - } |
|
| 514 | - if ($p) { |
|
| 515 | - $debut = substr($texte, 0, $p); |
|
| 516 | - $res = phraser_inclure($debut, $ligne, $res); |
|
| 517 | - $ligne += public_compte_ligne($debut); |
|
| 518 | - } |
|
| 519 | - $res[] = $nested_res[$m[1]]; |
|
| 520 | - $ligne += strlen($m[2]); |
|
| 521 | - $texte = substr($suite, strlen($m[0])); |
|
| 522 | - } |
|
| 523 | - |
|
| 524 | - if ($texte !== '') { |
|
| 525 | - $res = phraser_inclure($texte, $ligne, $res); |
|
| 526 | - } |
|
| 527 | - |
|
| 528 | - return $res; |
|
| 507 | + $res = []; |
|
| 508 | + $preg = ',^%' . preg_quote($sep, ',') . '([0-9]+)(\n*)@,'; |
|
| 509 | + while (($p = strpos($texte, "%$sep")) !== false) { |
|
| 510 | + $suite = substr($texte, $p); |
|
| 511 | + if (!preg_match($preg, $suite, $m)) { |
|
| 512 | + break; |
|
| 513 | + } |
|
| 514 | + if ($p) { |
|
| 515 | + $debut = substr($texte, 0, $p); |
|
| 516 | + $res = phraser_inclure($debut, $ligne, $res); |
|
| 517 | + $ligne += public_compte_ligne($debut); |
|
| 518 | + } |
|
| 519 | + $res[] = $nested_res[$m[1]]; |
|
| 520 | + $ligne += strlen($m[2]); |
|
| 521 | + $texte = substr($suite, strlen($m[0])); |
|
| 522 | + } |
|
| 523 | + |
|
| 524 | + if ($texte !== '') { |
|
| 525 | + $res = phraser_inclure($texte, $ligne, $res); |
|
| 526 | + } |
|
| 527 | + |
|
| 528 | + return $res; |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | /** |
@@ -542,75 +542,75 @@ discard block |
||
| 542 | 542 | */ |
| 543 | 543 | function phraser_champs_interieurs(string $texte, int $no_ligne, string $sep): array { |
| 544 | 544 | |
| 545 | - $champs_trouves = []; |
|
| 546 | - do { |
|
| 547 | - $parties = []; |
|
| 548 | - $nbl = $no_ligne; |
|
| 549 | - $search_pos = 0; |
|
| 550 | - |
|
| 551 | - // trouver tous les champs intérieurs (sans autre champs imbriqués), les analyser, et les remplacer par un placehoder |
|
| 552 | - // le $texte est découpé en parties qu'on re-parse ensuite jusqu'à ce qu'on ne trouve plus de nouveaux champs |
|
| 553 | - while ( |
|
| 554 | - (($p = strpos($texte, '[', $search_pos)) !== false) |
|
| 555 | - && preg_match(CHAMP_ETENDU, $texte, $match, PREG_OFFSET_CAPTURE, $p) |
|
| 556 | - ) { |
|
| 557 | - $poss = array_column($match, 1); |
|
| 558 | - $match = array_column($match, 0); |
|
| 559 | - // si jamais il y a une sous balise inclue dans la partie 7, alors on est pas dans le champ le plus interieur, on continue le search plus loin |
|
| 560 | - if (str_contains($match[7], '[') && preg_match(CHAMP_ETENDU, $texte, $r, 0, $poss[7])) { |
|
| 561 | - $search_pos = $poss[7]; |
|
| 562 | - continue; |
|
| 563 | - } |
|
| 564 | - |
|
| 565 | - $nbl_debut = 0; |
|
| 566 | - if ($poss[0]) { |
|
| 567 | - $nbl_debut = public_compte_ligne($texte, 0, $poss[0]); |
|
| 568 | - $parties[] = substr($texte, 0, $poss[0]); |
|
| 569 | - } |
|
| 570 | - $nbl += $nbl_debut; |
|
| 571 | - |
|
| 572 | - $champ = new Champ(); |
|
| 573 | - $champ->ligne = $nbl; |
|
| 574 | - $champ->nom_boucle = $match[3]; |
|
| 575 | - $champ->nom_champ = $match[4]; |
|
| 576 | - $champ->etoile = $match[6]; |
|
| 577 | - $nbl_champ = public_compte_ligne($texte, $poss[0], $poss[0] + strlen($match[0])); |
|
| 578 | - |
|
| 579 | - // phraser_args indiquera ou commence apres |
|
| 580 | - $pos_apres = 0; |
|
| 581 | - $champs_trouves = phraser_args($match[7], ')', $sep, $champs_trouves, $champ, $pos_apres); |
|
| 582 | - phraser_vieux($champ); |
|
| 583 | - $champ->avant = phraser_champs_exterieurs($match[1], $nbl, $sep, $champs_trouves); |
|
| 584 | - $apres = substr($match[7], $pos_apres + 1); |
|
| 585 | - |
|
| 586 | - $nbl_debut_champ = 0; |
|
| 587 | - if (!empty($apres)) { |
|
| 588 | - $nbl_debut_champ = public_compte_ligne($texte, $poss[0], $poss[7] + $pos_apres + 1); |
|
| 589 | - } |
|
| 590 | - $champ->apres = phraser_champs_exterieurs($apres, $nbl + $nbl_debut_champ, $sep, $champs_trouves); |
|
| 591 | - |
|
| 592 | - // reinjecter la boucle si c'en est une |
|
| 593 | - phraser_boucle_placeholder($champ); |
|
| 594 | - |
|
| 595 | - $champs_trouves[] = $champ; |
|
| 596 | - $j = count($champs_trouves) - 1; |
|
| 597 | - // on remplace ce champ par un placeholder |
|
| 598 | - // ajouter $nbl_champ retour ligne pour que la partie conserve le nombre de lignes lors des itérations suivantes |
|
| 599 | - $parties[] = ($t = "%{$sep}{$j}" . str_repeat("\n", $nbl_champ) . '@'); |
|
| 600 | - $nbl += $nbl_champ; |
|
| 601 | - |
|
| 602 | - $texte = substr($texte, $poss[0] + strlen($match[0])); |
|
| 603 | - $search_pos = 0; |
|
| 604 | - } |
|
| 605 | - |
|
| 606 | - // si on a trouvé des morceaux, il faut recommencer |
|
| 607 | - if (count($parties)) { |
|
| 608 | - // reprenons tous les morceaux qu'on a mis de côté car ne matchant pas (encore) |
|
| 609 | - $texte = implode('', $parties) . $texte; |
|
| 610 | - } |
|
| 611 | - } while (count($parties)); |
|
| 612 | - |
|
| 613 | - return phraser_champs_exterieurs($texte, $no_ligne, $sep, $champs_trouves); |
|
| 545 | + $champs_trouves = []; |
|
| 546 | + do { |
|
| 547 | + $parties = []; |
|
| 548 | + $nbl = $no_ligne; |
|
| 549 | + $search_pos = 0; |
|
| 550 | + |
|
| 551 | + // trouver tous les champs intérieurs (sans autre champs imbriqués), les analyser, et les remplacer par un placehoder |
|
| 552 | + // le $texte est découpé en parties qu'on re-parse ensuite jusqu'à ce qu'on ne trouve plus de nouveaux champs |
|
| 553 | + while ( |
|
| 554 | + (($p = strpos($texte, '[', $search_pos)) !== false) |
|
| 555 | + && preg_match(CHAMP_ETENDU, $texte, $match, PREG_OFFSET_CAPTURE, $p) |
|
| 556 | + ) { |
|
| 557 | + $poss = array_column($match, 1); |
|
| 558 | + $match = array_column($match, 0); |
|
| 559 | + // si jamais il y a une sous balise inclue dans la partie 7, alors on est pas dans le champ le plus interieur, on continue le search plus loin |
|
| 560 | + if (str_contains($match[7], '[') && preg_match(CHAMP_ETENDU, $texte, $r, 0, $poss[7])) { |
|
| 561 | + $search_pos = $poss[7]; |
|
| 562 | + continue; |
|
| 563 | + } |
|
| 564 | + |
|
| 565 | + $nbl_debut = 0; |
|
| 566 | + if ($poss[0]) { |
|
| 567 | + $nbl_debut = public_compte_ligne($texte, 0, $poss[0]); |
|
| 568 | + $parties[] = substr($texte, 0, $poss[0]); |
|
| 569 | + } |
|
| 570 | + $nbl += $nbl_debut; |
|
| 571 | + |
|
| 572 | + $champ = new Champ(); |
|
| 573 | + $champ->ligne = $nbl; |
|
| 574 | + $champ->nom_boucle = $match[3]; |
|
| 575 | + $champ->nom_champ = $match[4]; |
|
| 576 | + $champ->etoile = $match[6]; |
|
| 577 | + $nbl_champ = public_compte_ligne($texte, $poss[0], $poss[0] + strlen($match[0])); |
|
| 578 | + |
|
| 579 | + // phraser_args indiquera ou commence apres |
|
| 580 | + $pos_apres = 0; |
|
| 581 | + $champs_trouves = phraser_args($match[7], ')', $sep, $champs_trouves, $champ, $pos_apres); |
|
| 582 | + phraser_vieux($champ); |
|
| 583 | + $champ->avant = phraser_champs_exterieurs($match[1], $nbl, $sep, $champs_trouves); |
|
| 584 | + $apres = substr($match[7], $pos_apres + 1); |
|
| 585 | + |
|
| 586 | + $nbl_debut_champ = 0; |
|
| 587 | + if (!empty($apres)) { |
|
| 588 | + $nbl_debut_champ = public_compte_ligne($texte, $poss[0], $poss[7] + $pos_apres + 1); |
|
| 589 | + } |
|
| 590 | + $champ->apres = phraser_champs_exterieurs($apres, $nbl + $nbl_debut_champ, $sep, $champs_trouves); |
|
| 591 | + |
|
| 592 | + // reinjecter la boucle si c'en est une |
|
| 593 | + phraser_boucle_placeholder($champ); |
|
| 594 | + |
|
| 595 | + $champs_trouves[] = $champ; |
|
| 596 | + $j = count($champs_trouves) - 1; |
|
| 597 | + // on remplace ce champ par un placeholder |
|
| 598 | + // ajouter $nbl_champ retour ligne pour que la partie conserve le nombre de lignes lors des itérations suivantes |
|
| 599 | + $parties[] = ($t = "%{$sep}{$j}" . str_repeat("\n", $nbl_champ) . '@'); |
|
| 600 | + $nbl += $nbl_champ; |
|
| 601 | + |
|
| 602 | + $texte = substr($texte, $poss[0] + strlen($match[0])); |
|
| 603 | + $search_pos = 0; |
|
| 604 | + } |
|
| 605 | + |
|
| 606 | + // si on a trouvé des morceaux, il faut recommencer |
|
| 607 | + if (count($parties)) { |
|
| 608 | + // reprenons tous les morceaux qu'on a mis de côté car ne matchant pas (encore) |
|
| 609 | + $texte = implode('', $parties) . $texte; |
|
| 610 | + } |
|
| 611 | + } while (count($parties)); |
|
| 612 | + |
|
| 613 | + return phraser_champs_exterieurs($texte, $no_ligne, $sep, $champs_trouves); |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | /** |
@@ -621,20 +621,20 @@ discard block |
||
| 621 | 621 | * @return void |
| 622 | 622 | */ |
| 623 | 623 | function phraser_vieux(&$champ) { |
| 624 | - $nom = $champ->nom_champ; |
|
| 625 | - if ($champ->param) { |
|
| 626 | - if ($nom == 'MODELE') { |
|
| 627 | - if (!function_exists('phraser_vieux_modele')) { |
|
| 628 | - include_spip('public/normaliser'); |
|
| 629 | - } |
|
| 630 | - phraser_vieux_modele($champ); |
|
| 631 | - } elseif ($nom == 'INCLURE' || $nom == 'INCLUDE') { |
|
| 632 | - if (!function_exists('phraser_vieux_inclu')) { |
|
| 633 | - include_spip('public/normaliser'); |
|
| 634 | - } |
|
| 635 | - phraser_vieux_inclu($champ); |
|
| 636 | - } |
|
| 637 | - } |
|
| 624 | + $nom = $champ->nom_champ; |
|
| 625 | + if ($champ->param) { |
|
| 626 | + if ($nom == 'MODELE') { |
|
| 627 | + if (!function_exists('phraser_vieux_modele')) { |
|
| 628 | + include_spip('public/normaliser'); |
|
| 629 | + } |
|
| 630 | + phraser_vieux_modele($champ); |
|
| 631 | + } elseif ($nom == 'INCLURE' || $nom == 'INCLUDE') { |
|
| 632 | + if (!function_exists('phraser_vieux_inclu')) { |
|
| 633 | + include_spip('public/normaliser'); |
|
| 634 | + } |
|
| 635 | + phraser_vieux_inclu($champ); |
|
| 636 | + } |
|
| 637 | + } |
|
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | |
@@ -662,199 +662,199 @@ discard block |
||
| 662 | 662 | **/ |
| 663 | 663 | function phraser_criteres($params, &$result) { |
| 664 | 664 | |
| 665 | - $err_ci = ''; // indiquera s'il y a eu une erreur |
|
| 666 | - $args = []; |
|
| 667 | - $type = $result->type_requete; |
|
| 668 | - $doublons = []; |
|
| 669 | - foreach ($params as $v) { |
|
| 670 | - $var = $v[1][0]; |
|
| 671 | - $param = ($var->type != 'texte') ? '' : $var->texte; |
|
| 672 | - if (((is_countable($v) ? count($v) : 0) > 2) && (!preg_match(',[^A-Za-z]IN[^A-Za-z],i', (string) $param))) { |
|
| 673 | - // plus d'un argument et pas le critere IN: |
|
| 674 | - // detecter comme on peut si c'est le critere implicite LIMIT debut, fin |
|
| 675 | - if ( |
|
| 676 | - $var->type != 'texte' || preg_match('/^(n|n-|(n-)?\d+)$/S', (string) $param) |
|
| 677 | - ) { |
|
| 678 | - $op = ','; |
|
| 679 | - $not = false; |
|
| 680 | - $cond = false; |
|
| 681 | - } else { |
|
| 682 | - // Le debut du premier argument est l'operateur |
|
| 683 | - preg_match('/^([!]?)([a-zA-Z]\w*)[[:space:]]*(\??)[[:space:]]*(.*)$/ms', (string) $param, $m); |
|
| 684 | - $op = $m[2]; |
|
| 685 | - $not = (bool) $m[1]; |
|
| 686 | - $cond = (bool) $m[3]; |
|
| 687 | - // virer le premier argument, |
|
| 688 | - // et mettre son reliquat eventuel |
|
| 689 | - // Recopier pour ne pas alterer le texte source |
|
| 690 | - // utile au debusqueur |
|
| 691 | - if ($m[4]) { |
|
| 692 | - // une maniere tres sale de supprimer les "' autour de {critere "xxx","yyy"} |
|
| 693 | - if (preg_match(',^(["\'])(.*)\1$,', $m[4])) { |
|
| 694 | - $c = null; |
|
| 695 | - eval('$c = ' . $m[4] . ';'); |
|
| 696 | - if (isset($c)) { |
|
| 697 | - $m[4] = $c; |
|
| 698 | - } |
|
| 699 | - } |
|
| 700 | - $texte = new Texte(); |
|
| 701 | - $texte->texte = $m[4]; |
|
| 702 | - $v[1][0] = $texte; |
|
| 703 | - } else { |
|
| 704 | - array_shift($v[1]); |
|
| 705 | - } |
|
| 706 | - } |
|
| 707 | - array_shift($v); // $v[O] est vide |
|
| 708 | - $crit = new Critere(); |
|
| 709 | - $crit->op = $op; |
|
| 710 | - $crit->not = $not; |
|
| 711 | - $crit->cond = $cond; |
|
| 712 | - $crit->exclus = ''; |
|
| 713 | - $crit->param = $v; |
|
| 714 | - $args[] = $crit; |
|
| 715 | - } else { |
|
| 716 | - if ($var->type != 'texte') { |
|
| 717 | - // cas 1 seul arg ne commencant pas par du texte brut: |
|
| 718 | - // erreur ou critere infixe "/" |
|
| 719 | - if (($v[1][1]->type != 'texte') || (trim((string) $v[1][1]->texte) != '/')) { |
|
| 720 | - $err_ci = [ |
|
| 721 | - 'zbug_critere_inconnu', |
|
| 722 | - ['critere' => $var->nom_champ] |
|
| 723 | - ]; |
|
| 724 | - erreur_squelette($err_ci, $result); |
|
| 725 | - } else { |
|
| 726 | - $crit = new Critere(); |
|
| 727 | - $crit->op = '/'; |
|
| 728 | - $crit->not = false; |
|
| 729 | - $crit->exclus = ''; |
|
| 730 | - $crit->param = [[$v[1][0]], [$v[1][2]]]; |
|
| 731 | - $args[] = $crit; |
|
| 732 | - } |
|
| 733 | - } else { |
|
| 734 | - // traiter qq lexemes particuliers pour faciliter la suite |
|
| 735 | - // les separateurs |
|
| 736 | - if ($var->apres) { |
|
| 737 | - $result->separateur[] = $param; |
|
| 738 | - } elseif ($param == 'tout' || $param == 'tous') { |
|
| 739 | - $result->modificateur['tout'] = true; |
|
| 740 | - } elseif ($param == 'plat') { |
|
| 741 | - $result->modificateur['plat'] = true; |
|
| 742 | - } |
|
| 743 | - |
|
| 744 | - // Boucle hierarchie, analyser le critere id_rubrique |
|
| 745 | - // et les autres critères {id_x} pour forcer {tout} sur |
|
| 746 | - // ceux-ci pour avoir la rubrique mere... |
|
| 747 | - // Les autres critères de la boucle hierarchie doivent être |
|
| 748 | - // traités normalement. |
|
| 749 | - elseif ( |
|
| 750 | - strcasecmp($type, 'hierarchie') == 0 |
|
| 751 | - && !preg_match(",^id_rubrique\b,", (string) $param) |
|
| 752 | - && preg_match(',^id_\w+\s*$,', (string) $param) |
|
| 753 | - ) { |
|
| 754 | - $result->modificateur['tout'] = true; |
|
| 755 | - } elseif (strcasecmp($type, 'hierarchie') == 0 && $param == 'id_rubrique') { |
|
| 756 | - // rien a faire sur {id_rubrique} tout seul |
|
| 757 | - } else { |
|
| 758 | - // pas d'emplacement statique, faut un dynamique |
|
| 759 | - // mais il y a 2 cas qui ont les 2 ! |
|
| 760 | - if (($param == 'unique') || (preg_match(',^!?doublons *,', (string) $param))) { |
|
| 761 | - // cette variable sera inseree dans le code |
|
| 762 | - // et son nom sert d'indicateur des maintenant |
|
| 763 | - $result->doublons = '$doublons_index'; |
|
| 764 | - if ($param == 'unique') { |
|
| 765 | - $param = 'doublons'; |
|
| 766 | - } |
|
| 767 | - } elseif ($param == 'recherche') { |
|
| 768 | - // meme chose (a cause de #nom_de_boucle:URL_*) |
|
| 769 | - $result->hash = ' '; |
|
| 770 | - } |
|
| 771 | - |
|
| 772 | - if (preg_match(',^ *([0-9-]+) *(/) *(.+) *$,', (string) $param, $m)) { |
|
| 773 | - $crit = phraser_critere_infixe($m[1], $m[3], $v, '/', '', ''); |
|
| 774 | - } elseif ( |
|
| 775 | - preg_match(',^([!]?)(' . CHAMP_SQL_PLUS_FONC . |
|
| 776 | - ')[[:space:]]*(\??)(!?)(<=?|>=?|==?|\b(?:IN|LIKE)\b)(.*)$,is', (string) $param, $m) |
|
| 777 | - ) { |
|
| 778 | - $a2 = trim($m[8]); |
|
| 779 | - if ($a2 && ($a2[0] == "'" || $a2[0] == '"') && $a2[0] == substr($a2, -1)) { |
|
| 780 | - $a2 = substr($a2, 1, -1); |
|
| 781 | - } |
|
| 782 | - $crit = phraser_critere_infixe( |
|
| 783 | - $m[2], |
|
| 784 | - $a2, |
|
| 785 | - $v, |
|
| 786 | - (($m[2] == 'lang_select') ? $m[2] : $m[7]), |
|
| 787 | - $m[6], |
|
| 788 | - $m[5] |
|
| 789 | - ); |
|
| 790 | - $crit->exclus = $m[1]; |
|
| 791 | - } elseif ( |
|
| 792 | - preg_match('/^([!]?)\s*(' . |
|
| 793 | - CHAMP_SQL_PLUS_FONC . |
|
| 794 | - ')\s*(\??)(.*)$/is', (string) $param, $m) |
|
| 795 | - ) { |
|
| 796 | - // contient aussi les comparaisons implicites ! |
|
| 797 | - // Comme ci-dessus: |
|
| 798 | - // le premier arg contient l'operateur |
|
| 799 | - array_shift($v); |
|
| 800 | - if ($m[6]) { |
|
| 801 | - $v[0][0] = new Texte(); |
|
| 802 | - $v[0][0]->texte = $m[6]; |
|
| 803 | - } else { |
|
| 804 | - array_shift($v[0]); |
|
| 805 | - if (!$v[0]) { |
|
| 806 | - array_shift($v); |
|
| 807 | - } |
|
| 808 | - } |
|
| 809 | - $crit = new Critere(); |
|
| 810 | - $crit->op = $m[2]; |
|
| 811 | - $crit->param = $v; |
|
| 812 | - $crit->not = (bool) $m[1]; |
|
| 813 | - $crit->cond = (bool) $m[5]; |
|
| 814 | - } else { |
|
| 815 | - $err_ci = [ |
|
| 816 | - 'zbug_critere_inconnu', |
|
| 817 | - ['critere' => $param] |
|
| 818 | - ]; |
|
| 819 | - erreur_squelette($err_ci, $result); |
|
| 820 | - } |
|
| 821 | - |
|
| 822 | - if ((!preg_match(',^!?doublons *,', (string) $param)) || $crit->not) { |
|
| 823 | - $args[] = $crit; |
|
| 824 | - } else { |
|
| 825 | - $doublons[] = $crit; |
|
| 826 | - } |
|
| 827 | - } |
|
| 828 | - } |
|
| 829 | - } |
|
| 830 | - } |
|
| 831 | - |
|
| 832 | - // les doublons non nies doivent etre le dernier critere |
|
| 833 | - // pour que la variable $doublon_index ait la bonne valeur |
|
| 834 | - // cf critere_doublon |
|
| 835 | - if ($doublons) { |
|
| 836 | - $args = [...$args, ...$doublons]; |
|
| 837 | - } |
|
| 838 | - |
|
| 839 | - // Si erreur, laisser la chaine dans ce champ pour le HTTP 503 |
|
| 840 | - if (!$err_ci) { |
|
| 841 | - $result->criteres = $args; |
|
| 842 | - } |
|
| 665 | + $err_ci = ''; // indiquera s'il y a eu une erreur |
|
| 666 | + $args = []; |
|
| 667 | + $type = $result->type_requete; |
|
| 668 | + $doublons = []; |
|
| 669 | + foreach ($params as $v) { |
|
| 670 | + $var = $v[1][0]; |
|
| 671 | + $param = ($var->type != 'texte') ? '' : $var->texte; |
|
| 672 | + if (((is_countable($v) ? count($v) : 0) > 2) && (!preg_match(',[^A-Za-z]IN[^A-Za-z],i', (string) $param))) { |
|
| 673 | + // plus d'un argument et pas le critere IN: |
|
| 674 | + // detecter comme on peut si c'est le critere implicite LIMIT debut, fin |
|
| 675 | + if ( |
|
| 676 | + $var->type != 'texte' || preg_match('/^(n|n-|(n-)?\d+)$/S', (string) $param) |
|
| 677 | + ) { |
|
| 678 | + $op = ','; |
|
| 679 | + $not = false; |
|
| 680 | + $cond = false; |
|
| 681 | + } else { |
|
| 682 | + // Le debut du premier argument est l'operateur |
|
| 683 | + preg_match('/^([!]?)([a-zA-Z]\w*)[[:space:]]*(\??)[[:space:]]*(.*)$/ms', (string) $param, $m); |
|
| 684 | + $op = $m[2]; |
|
| 685 | + $not = (bool) $m[1]; |
|
| 686 | + $cond = (bool) $m[3]; |
|
| 687 | + // virer le premier argument, |
|
| 688 | + // et mettre son reliquat eventuel |
|
| 689 | + // Recopier pour ne pas alterer le texte source |
|
| 690 | + // utile au debusqueur |
|
| 691 | + if ($m[4]) { |
|
| 692 | + // une maniere tres sale de supprimer les "' autour de {critere "xxx","yyy"} |
|
| 693 | + if (preg_match(',^(["\'])(.*)\1$,', $m[4])) { |
|
| 694 | + $c = null; |
|
| 695 | + eval('$c = ' . $m[4] . ';'); |
|
| 696 | + if (isset($c)) { |
|
| 697 | + $m[4] = $c; |
|
| 698 | + } |
|
| 699 | + } |
|
| 700 | + $texte = new Texte(); |
|
| 701 | + $texte->texte = $m[4]; |
|
| 702 | + $v[1][0] = $texte; |
|
| 703 | + } else { |
|
| 704 | + array_shift($v[1]); |
|
| 705 | + } |
|
| 706 | + } |
|
| 707 | + array_shift($v); // $v[O] est vide |
|
| 708 | + $crit = new Critere(); |
|
| 709 | + $crit->op = $op; |
|
| 710 | + $crit->not = $not; |
|
| 711 | + $crit->cond = $cond; |
|
| 712 | + $crit->exclus = ''; |
|
| 713 | + $crit->param = $v; |
|
| 714 | + $args[] = $crit; |
|
| 715 | + } else { |
|
| 716 | + if ($var->type != 'texte') { |
|
| 717 | + // cas 1 seul arg ne commencant pas par du texte brut: |
|
| 718 | + // erreur ou critere infixe "/" |
|
| 719 | + if (($v[1][1]->type != 'texte') || (trim((string) $v[1][1]->texte) != '/')) { |
|
| 720 | + $err_ci = [ |
|
| 721 | + 'zbug_critere_inconnu', |
|
| 722 | + ['critere' => $var->nom_champ] |
|
| 723 | + ]; |
|
| 724 | + erreur_squelette($err_ci, $result); |
|
| 725 | + } else { |
|
| 726 | + $crit = new Critere(); |
|
| 727 | + $crit->op = '/'; |
|
| 728 | + $crit->not = false; |
|
| 729 | + $crit->exclus = ''; |
|
| 730 | + $crit->param = [[$v[1][0]], [$v[1][2]]]; |
|
| 731 | + $args[] = $crit; |
|
| 732 | + } |
|
| 733 | + } else { |
|
| 734 | + // traiter qq lexemes particuliers pour faciliter la suite |
|
| 735 | + // les separateurs |
|
| 736 | + if ($var->apres) { |
|
| 737 | + $result->separateur[] = $param; |
|
| 738 | + } elseif ($param == 'tout' || $param == 'tous') { |
|
| 739 | + $result->modificateur['tout'] = true; |
|
| 740 | + } elseif ($param == 'plat') { |
|
| 741 | + $result->modificateur['plat'] = true; |
|
| 742 | + } |
|
| 743 | + |
|
| 744 | + // Boucle hierarchie, analyser le critere id_rubrique |
|
| 745 | + // et les autres critères {id_x} pour forcer {tout} sur |
|
| 746 | + // ceux-ci pour avoir la rubrique mere... |
|
| 747 | + // Les autres critères de la boucle hierarchie doivent être |
|
| 748 | + // traités normalement. |
|
| 749 | + elseif ( |
|
| 750 | + strcasecmp($type, 'hierarchie') == 0 |
|
| 751 | + && !preg_match(",^id_rubrique\b,", (string) $param) |
|
| 752 | + && preg_match(',^id_\w+\s*$,', (string) $param) |
|
| 753 | + ) { |
|
| 754 | + $result->modificateur['tout'] = true; |
|
| 755 | + } elseif (strcasecmp($type, 'hierarchie') == 0 && $param == 'id_rubrique') { |
|
| 756 | + // rien a faire sur {id_rubrique} tout seul |
|
| 757 | + } else { |
|
| 758 | + // pas d'emplacement statique, faut un dynamique |
|
| 759 | + // mais il y a 2 cas qui ont les 2 ! |
|
| 760 | + if (($param == 'unique') || (preg_match(',^!?doublons *,', (string) $param))) { |
|
| 761 | + // cette variable sera inseree dans le code |
|
| 762 | + // et son nom sert d'indicateur des maintenant |
|
| 763 | + $result->doublons = '$doublons_index'; |
|
| 764 | + if ($param == 'unique') { |
|
| 765 | + $param = 'doublons'; |
|
| 766 | + } |
|
| 767 | + } elseif ($param == 'recherche') { |
|
| 768 | + // meme chose (a cause de #nom_de_boucle:URL_*) |
|
| 769 | + $result->hash = ' '; |
|
| 770 | + } |
|
| 771 | + |
|
| 772 | + if (preg_match(',^ *([0-9-]+) *(/) *(.+) *$,', (string) $param, $m)) { |
|
| 773 | + $crit = phraser_critere_infixe($m[1], $m[3], $v, '/', '', ''); |
|
| 774 | + } elseif ( |
|
| 775 | + preg_match(',^([!]?)(' . CHAMP_SQL_PLUS_FONC . |
|
| 776 | + ')[[:space:]]*(\??)(!?)(<=?|>=?|==?|\b(?:IN|LIKE)\b)(.*)$,is', (string) $param, $m) |
|
| 777 | + ) { |
|
| 778 | + $a2 = trim($m[8]); |
|
| 779 | + if ($a2 && ($a2[0] == "'" || $a2[0] == '"') && $a2[0] == substr($a2, -1)) { |
|
| 780 | + $a2 = substr($a2, 1, -1); |
|
| 781 | + } |
|
| 782 | + $crit = phraser_critere_infixe( |
|
| 783 | + $m[2], |
|
| 784 | + $a2, |
|
| 785 | + $v, |
|
| 786 | + (($m[2] == 'lang_select') ? $m[2] : $m[7]), |
|
| 787 | + $m[6], |
|
| 788 | + $m[5] |
|
| 789 | + ); |
|
| 790 | + $crit->exclus = $m[1]; |
|
| 791 | + } elseif ( |
|
| 792 | + preg_match('/^([!]?)\s*(' . |
|
| 793 | + CHAMP_SQL_PLUS_FONC . |
|
| 794 | + ')\s*(\??)(.*)$/is', (string) $param, $m) |
|
| 795 | + ) { |
|
| 796 | + // contient aussi les comparaisons implicites ! |
|
| 797 | + // Comme ci-dessus: |
|
| 798 | + // le premier arg contient l'operateur |
|
| 799 | + array_shift($v); |
|
| 800 | + if ($m[6]) { |
|
| 801 | + $v[0][0] = new Texte(); |
|
| 802 | + $v[0][0]->texte = $m[6]; |
|
| 803 | + } else { |
|
| 804 | + array_shift($v[0]); |
|
| 805 | + if (!$v[0]) { |
|
| 806 | + array_shift($v); |
|
| 807 | + } |
|
| 808 | + } |
|
| 809 | + $crit = new Critere(); |
|
| 810 | + $crit->op = $m[2]; |
|
| 811 | + $crit->param = $v; |
|
| 812 | + $crit->not = (bool) $m[1]; |
|
| 813 | + $crit->cond = (bool) $m[5]; |
|
| 814 | + } else { |
|
| 815 | + $err_ci = [ |
|
| 816 | + 'zbug_critere_inconnu', |
|
| 817 | + ['critere' => $param] |
|
| 818 | + ]; |
|
| 819 | + erreur_squelette($err_ci, $result); |
|
| 820 | + } |
|
| 821 | + |
|
| 822 | + if ((!preg_match(',^!?doublons *,', (string) $param)) || $crit->not) { |
|
| 823 | + $args[] = $crit; |
|
| 824 | + } else { |
|
| 825 | + $doublons[] = $crit; |
|
| 826 | + } |
|
| 827 | + } |
|
| 828 | + } |
|
| 829 | + } |
|
| 830 | + } |
|
| 831 | + |
|
| 832 | + // les doublons non nies doivent etre le dernier critere |
|
| 833 | + // pour que la variable $doublon_index ait la bonne valeur |
|
| 834 | + // cf critere_doublon |
|
| 835 | + if ($doublons) { |
|
| 836 | + $args = [...$args, ...$doublons]; |
|
| 837 | + } |
|
| 838 | + |
|
| 839 | + // Si erreur, laisser la chaine dans ce champ pour le HTTP 503 |
|
| 840 | + if (!$err_ci) { |
|
| 841 | + $result->criteres = $args; |
|
| 842 | + } |
|
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | function phraser_critere_infixe($arg1, $arg2, $args, $op, $not, $cond) { |
| 846 | - $args[0] = new Texte(); |
|
| 847 | - $args[0]->texte = $arg1; |
|
| 848 | - $args[0] = [$args[0]]; |
|
| 849 | - $args[1][0] = new Texte(); |
|
| 850 | - $args[1][0]->texte = $arg2; |
|
| 851 | - $crit = new Critere(); |
|
| 852 | - $crit->op = $op; |
|
| 853 | - $crit->not = (bool) $not; |
|
| 854 | - $crit->cond = (bool) $cond; |
|
| 855 | - $crit->param = $args; |
|
| 856 | - |
|
| 857 | - return $crit; |
|
| 846 | + $args[0] = new Texte(); |
|
| 847 | + $args[0]->texte = $arg1; |
|
| 848 | + $args[0] = [$args[0]]; |
|
| 849 | + $args[1][0] = new Texte(); |
|
| 850 | + $args[1][0]->texte = $arg2; |
|
| 851 | + $crit = new Critere(); |
|
| 852 | + $crit->op = $op; |
|
| 853 | + $crit->not = (bool) $not; |
|
| 854 | + $crit->cond = (bool) $cond; |
|
| 855 | + $crit->param = $args; |
|
| 856 | + |
|
| 857 | + return $crit; |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | /** |
@@ -865,11 +865,11 @@ discard block |
||
| 865 | 865 | * @return int |
| 866 | 866 | */ |
| 867 | 867 | function public_compte_ligne($texte, $debut = 0, $fin = null) { |
| 868 | - if (is_null($fin)) { |
|
| 869 | - return substr_count((string) $texte, "\n", $debut); |
|
| 870 | - } else { |
|
| 871 | - return substr_count((string) $texte, "\n", $debut, $fin - $debut); |
|
| 872 | - } |
|
| 868 | + if (is_null($fin)) { |
|
| 869 | + return substr_count((string) $texte, "\n", $debut); |
|
| 870 | + } else { |
|
| 871 | + return substr_count((string) $texte, "\n", $debut, $fin - $debut); |
|
| 872 | + } |
|
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | |
@@ -879,87 +879,87 @@ discard block |
||
| 879 | 879 | * et ensuite on regarde son vrai debut soit <B_xxx> soit <BB_xxx> |
| 880 | 880 | */ |
| 881 | 881 | function public_trouver_premiere_boucle(string $texte, string $id_parent, array $descr, int $pos_debut_texte = 0): ?array { |
| 882 | - $premiere_boucle = null; |
|
| 883 | - $pos_derniere_boucle_anonyme = $pos_debut_texte; |
|
| 884 | - |
|
| 885 | - $current_pos = $pos_debut_texte; |
|
| 886 | - while (($pos_boucle = strpos((string) $texte, BALISE_BOUCLE, $current_pos)) !== false) { |
|
| 887 | - $current_pos = $pos_boucle + 1; |
|
| 888 | - $pos_parent = strpos((string) $texte, '(', $pos_boucle); |
|
| 889 | - |
|
| 890 | - $id_boucle = ''; |
|
| 891 | - if ($pos_parent !== false) { |
|
| 892 | - $id_boucle = trim(substr((string) $texte, $pos_boucle + strlen(BALISE_BOUCLE), $pos_parent - $pos_boucle - strlen(BALISE_BOUCLE))); |
|
| 893 | - } |
|
| 894 | - if ( |
|
| 895 | - $pos_parent === false |
|
| 896 | - || strlen($id_boucle) && (!is_numeric($id_boucle) && !str_starts_with($id_boucle, '_')) |
|
| 897 | - ) { |
|
| 898 | - $result = new Boucle(); |
|
| 899 | - $result->id_parent = $id_parent; |
|
| 900 | - $result->descr = $descr; |
|
| 901 | - |
|
| 902 | - // un id_boucle pour l'affichage de l'erreur |
|
| 903 | - if (!strlen($id_boucle)) { |
|
| 904 | - $id_boucle = substr((string) $texte, $pos_boucle + strlen(BALISE_BOUCLE), 15); |
|
| 905 | - } |
|
| 906 | - $result->id_boucle = $id_boucle; |
|
| 907 | - $err_b = ['zbug_erreur_boucle_syntaxe', ['id' => $id_boucle]]; |
|
| 908 | - erreur_squelette($err_b, $result); |
|
| 909 | - |
|
| 910 | - continue; |
|
| 911 | - } |
|
| 912 | - else { |
|
| 913 | - $boucle = [ |
|
| 914 | - 'id_boucle' => $id_boucle, |
|
| 915 | - 'id_boucle_err' => $id_boucle, |
|
| 916 | - 'debut_boucle' => $pos_boucle, |
|
| 917 | - 'pos_boucle' => $pos_boucle, |
|
| 918 | - 'pos_parent' => $pos_parent, |
|
| 919 | - 'pos_precond' => false, |
|
| 920 | - 'pos_precond_inside' => false, |
|
| 921 | - 'pos_preaff' => false, |
|
| 922 | - 'pos_preaff_inside' => false, |
|
| 923 | - ]; |
|
| 924 | - |
|
| 925 | - // un id_boucle pour l'affichage de l'erreur sur les boucle anonymes |
|
| 926 | - if (!strlen($id_boucle)) { |
|
| 927 | - $boucle['id_boucle_err'] = substr((string) $texte, $pos_boucle + strlen(BALISE_BOUCLE), 15); |
|
| 928 | - } |
|
| 929 | - |
|
| 930 | - // trouver sa position de depart reelle : au <Bxx> ou au <BBxx> |
|
| 931 | - $precond_boucle = BALISE_PRECOND_BOUCLE . $id_boucle . '>'; |
|
| 932 | - $pos_precond = strpos((string) $texte, $precond_boucle, $id_boucle ? $pos_debut_texte : $pos_derniere_boucle_anonyme); |
|
| 933 | - if ( |
|
| 934 | - $pos_precond !== false |
|
| 935 | - && $pos_precond < $boucle['debut_boucle'] |
|
| 936 | - ) { |
|
| 937 | - $boucle['debut_boucle'] = $pos_precond; |
|
| 938 | - $boucle['pos_precond'] = $pos_precond; |
|
| 939 | - $boucle['pos_precond_inside'] = $pos_precond + strlen($precond_boucle); |
|
| 940 | - } |
|
| 941 | - |
|
| 942 | - $preaff_boucle = BALISE_PREAFF_BOUCLE . $id_boucle . '>'; |
|
| 943 | - $pos_preaff = strpos((string) $texte, $preaff_boucle, $id_boucle ? $pos_debut_texte : $pos_derniere_boucle_anonyme); |
|
| 944 | - if ( |
|
| 945 | - $pos_preaff !== false |
|
| 946 | - && $pos_preaff < $boucle['debut_boucle'] |
|
| 947 | - ) { |
|
| 948 | - $boucle['debut_boucle'] = $pos_preaff; |
|
| 949 | - $boucle['pos_preaff'] = $pos_preaff; |
|
| 950 | - $boucle['pos_preaff_inside'] = $pos_preaff + strlen($preaff_boucle); |
|
| 951 | - } |
|
| 952 | - if (!strlen($id_boucle)) { |
|
| 953 | - $pos_derniere_boucle_anonyme = $pos_boucle; |
|
| 954 | - } |
|
| 955 | - |
|
| 956 | - if (is_null($premiere_boucle) || $premiere_boucle['debut_boucle'] > $boucle['debut_boucle']) { |
|
| 957 | - $premiere_boucle = $boucle; |
|
| 958 | - } |
|
| 959 | - } |
|
| 960 | - } |
|
| 961 | - |
|
| 962 | - return $premiere_boucle; |
|
| 882 | + $premiere_boucle = null; |
|
| 883 | + $pos_derniere_boucle_anonyme = $pos_debut_texte; |
|
| 884 | + |
|
| 885 | + $current_pos = $pos_debut_texte; |
|
| 886 | + while (($pos_boucle = strpos((string) $texte, BALISE_BOUCLE, $current_pos)) !== false) { |
|
| 887 | + $current_pos = $pos_boucle + 1; |
|
| 888 | + $pos_parent = strpos((string) $texte, '(', $pos_boucle); |
|
| 889 | + |
|
| 890 | + $id_boucle = ''; |
|
| 891 | + if ($pos_parent !== false) { |
|
| 892 | + $id_boucle = trim(substr((string) $texte, $pos_boucle + strlen(BALISE_BOUCLE), $pos_parent - $pos_boucle - strlen(BALISE_BOUCLE))); |
|
| 893 | + } |
|
| 894 | + if ( |
|
| 895 | + $pos_parent === false |
|
| 896 | + || strlen($id_boucle) && (!is_numeric($id_boucle) && !str_starts_with($id_boucle, '_')) |
|
| 897 | + ) { |
|
| 898 | + $result = new Boucle(); |
|
| 899 | + $result->id_parent = $id_parent; |
|
| 900 | + $result->descr = $descr; |
|
| 901 | + |
|
| 902 | + // un id_boucle pour l'affichage de l'erreur |
|
| 903 | + if (!strlen($id_boucle)) { |
|
| 904 | + $id_boucle = substr((string) $texte, $pos_boucle + strlen(BALISE_BOUCLE), 15); |
|
| 905 | + } |
|
| 906 | + $result->id_boucle = $id_boucle; |
|
| 907 | + $err_b = ['zbug_erreur_boucle_syntaxe', ['id' => $id_boucle]]; |
|
| 908 | + erreur_squelette($err_b, $result); |
|
| 909 | + |
|
| 910 | + continue; |
|
| 911 | + } |
|
| 912 | + else { |
|
| 913 | + $boucle = [ |
|
| 914 | + 'id_boucle' => $id_boucle, |
|
| 915 | + 'id_boucle_err' => $id_boucle, |
|
| 916 | + 'debut_boucle' => $pos_boucle, |
|
| 917 | + 'pos_boucle' => $pos_boucle, |
|
| 918 | + 'pos_parent' => $pos_parent, |
|
| 919 | + 'pos_precond' => false, |
|
| 920 | + 'pos_precond_inside' => false, |
|
| 921 | + 'pos_preaff' => false, |
|
| 922 | + 'pos_preaff_inside' => false, |
|
| 923 | + ]; |
|
| 924 | + |
|
| 925 | + // un id_boucle pour l'affichage de l'erreur sur les boucle anonymes |
|
| 926 | + if (!strlen($id_boucle)) { |
|
| 927 | + $boucle['id_boucle_err'] = substr((string) $texte, $pos_boucle + strlen(BALISE_BOUCLE), 15); |
|
| 928 | + } |
|
| 929 | + |
|
| 930 | + // trouver sa position de depart reelle : au <Bxx> ou au <BBxx> |
|
| 931 | + $precond_boucle = BALISE_PRECOND_BOUCLE . $id_boucle . '>'; |
|
| 932 | + $pos_precond = strpos((string) $texte, $precond_boucle, $id_boucle ? $pos_debut_texte : $pos_derniere_boucle_anonyme); |
|
| 933 | + if ( |
|
| 934 | + $pos_precond !== false |
|
| 935 | + && $pos_precond < $boucle['debut_boucle'] |
|
| 936 | + ) { |
|
| 937 | + $boucle['debut_boucle'] = $pos_precond; |
|
| 938 | + $boucle['pos_precond'] = $pos_precond; |
|
| 939 | + $boucle['pos_precond_inside'] = $pos_precond + strlen($precond_boucle); |
|
| 940 | + } |
|
| 941 | + |
|
| 942 | + $preaff_boucle = BALISE_PREAFF_BOUCLE . $id_boucle . '>'; |
|
| 943 | + $pos_preaff = strpos((string) $texte, $preaff_boucle, $id_boucle ? $pos_debut_texte : $pos_derniere_boucle_anonyme); |
|
| 944 | + if ( |
|
| 945 | + $pos_preaff !== false |
|
| 946 | + && $pos_preaff < $boucle['debut_boucle'] |
|
| 947 | + ) { |
|
| 948 | + $boucle['debut_boucle'] = $pos_preaff; |
|
| 949 | + $boucle['pos_preaff'] = $pos_preaff; |
|
| 950 | + $boucle['pos_preaff_inside'] = $pos_preaff + strlen($preaff_boucle); |
|
| 951 | + } |
|
| 952 | + if (!strlen($id_boucle)) { |
|
| 953 | + $pos_derniere_boucle_anonyme = $pos_boucle; |
|
| 954 | + } |
|
| 955 | + |
|
| 956 | + if (is_null($premiere_boucle) || $premiere_boucle['debut_boucle'] > $boucle['debut_boucle']) { |
|
| 957 | + $premiere_boucle = $boucle; |
|
| 958 | + } |
|
| 959 | + } |
|
| 960 | + } |
|
| 961 | + |
|
| 962 | + return $premiere_boucle; |
|
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | /** |
@@ -975,68 +975,68 @@ discard block |
||
| 975 | 975 | * la description de la boucle dans un tableau associatif |
| 976 | 976 | */ |
| 977 | 977 | function public_trouver_fin_boucle(string $texte, string $id_parent, array $boucle, int $pos_debut_texte, $result): array { |
| 978 | - $id_boucle = $boucle['id_boucle']; |
|
| 979 | - $pos_courante = $pos_debut_texte; |
|
| 980 | - |
|
| 981 | - $boucle['pos_postcond'] = false; |
|
| 982 | - $boucle['pos_postcond_inside'] = false; |
|
| 983 | - $boucle['pos_altern'] = false; |
|
| 984 | - $boucle['pos_altern_inside'] = false; |
|
| 985 | - $boucle['pos_postaff'] = false; |
|
| 986 | - $boucle['pos_postaff_inside'] = false; |
|
| 987 | - |
|
| 988 | - $pos_anonyme_next = null; |
|
| 989 | - // si c'est une boucle anonyme, chercher la position de la prochaine boucle anonyme |
|
| 990 | - if (!strlen((string) $id_boucle)) { |
|
| 991 | - $pos_anonyme_next = strpos((string) $texte, BALISE_BOUCLE . '(', $pos_courante); |
|
| 992 | - } |
|
| 993 | - |
|
| 994 | - // |
|
| 995 | - // 1. Recuperer la partie conditionnelle apres |
|
| 996 | - // |
|
| 997 | - $apres_boucle = BALISE_POSTCOND_BOUCLE . $id_boucle . '>'; |
|
| 998 | - $pos_apres = strpos((string) $texte, $apres_boucle, $pos_courante); |
|
| 999 | - if ( |
|
| 1000 | - $pos_apres !== false |
|
| 1001 | - && (!$pos_anonyme_next || $pos_apres < $pos_anonyme_next) |
|
| 1002 | - ) { |
|
| 1003 | - $boucle['pos_postcond'] = $pos_apres; |
|
| 1004 | - $pos_apres += strlen($apres_boucle); |
|
| 1005 | - $boucle['pos_postcond_inside'] = $pos_apres; |
|
| 1006 | - $pos_courante = $pos_apres ; |
|
| 1007 | - } |
|
| 1008 | - |
|
| 1009 | - // |
|
| 1010 | - // 2. Récuperer la partie alternative apres |
|
| 1011 | - // |
|
| 1012 | - $altern_boucle = BALISE_ALT_BOUCLE . $id_boucle . '>'; |
|
| 1013 | - $pos_altern = strpos((string) $texte, $altern_boucle, $pos_courante); |
|
| 1014 | - if ( |
|
| 1015 | - $pos_altern !== false |
|
| 1016 | - && (!$pos_anonyme_next || $pos_altern < $pos_anonyme_next) |
|
| 1017 | - ) { |
|
| 1018 | - $boucle['pos_altern'] = $pos_altern; |
|
| 1019 | - $pos_altern += strlen($altern_boucle); |
|
| 1020 | - $boucle['pos_altern_inside'] = $pos_altern; |
|
| 1021 | - $pos_courante = $pos_altern; |
|
| 1022 | - } |
|
| 1023 | - |
|
| 1024 | - // |
|
| 1025 | - // 3. Recuperer la partie footer non alternative |
|
| 1026 | - // |
|
| 1027 | - $postaff_boucle = BALISE_POSTAFF_BOUCLE . $id_boucle . '>'; |
|
| 1028 | - $pos_postaff = strpos((string) $texte, $postaff_boucle, $pos_courante); |
|
| 1029 | - if ( |
|
| 1030 | - $pos_postaff !== false |
|
| 1031 | - && (!$pos_anonyme_next || $pos_postaff < $pos_anonyme_next) |
|
| 1032 | - ) { |
|
| 1033 | - $boucle['pos_postaff'] = $pos_postaff; |
|
| 1034 | - $pos_postaff += strlen($postaff_boucle); |
|
| 1035 | - $boucle['pos_postaff_inside'] = $pos_postaff; |
|
| 1036 | - $pos_courante = $pos_postaff ; |
|
| 1037 | - } |
|
| 1038 | - |
|
| 1039 | - return $boucle; |
|
| 978 | + $id_boucle = $boucle['id_boucle']; |
|
| 979 | + $pos_courante = $pos_debut_texte; |
|
| 980 | + |
|
| 981 | + $boucle['pos_postcond'] = false; |
|
| 982 | + $boucle['pos_postcond_inside'] = false; |
|
| 983 | + $boucle['pos_altern'] = false; |
|
| 984 | + $boucle['pos_altern_inside'] = false; |
|
| 985 | + $boucle['pos_postaff'] = false; |
|
| 986 | + $boucle['pos_postaff_inside'] = false; |
|
| 987 | + |
|
| 988 | + $pos_anonyme_next = null; |
|
| 989 | + // si c'est une boucle anonyme, chercher la position de la prochaine boucle anonyme |
|
| 990 | + if (!strlen((string) $id_boucle)) { |
|
| 991 | + $pos_anonyme_next = strpos((string) $texte, BALISE_BOUCLE . '(', $pos_courante); |
|
| 992 | + } |
|
| 993 | + |
|
| 994 | + // |
|
| 995 | + // 1. Recuperer la partie conditionnelle apres |
|
| 996 | + // |
|
| 997 | + $apres_boucle = BALISE_POSTCOND_BOUCLE . $id_boucle . '>'; |
|
| 998 | + $pos_apres = strpos((string) $texte, $apres_boucle, $pos_courante); |
|
| 999 | + if ( |
|
| 1000 | + $pos_apres !== false |
|
| 1001 | + && (!$pos_anonyme_next || $pos_apres < $pos_anonyme_next) |
|
| 1002 | + ) { |
|
| 1003 | + $boucle['pos_postcond'] = $pos_apres; |
|
| 1004 | + $pos_apres += strlen($apres_boucle); |
|
| 1005 | + $boucle['pos_postcond_inside'] = $pos_apres; |
|
| 1006 | + $pos_courante = $pos_apres ; |
|
| 1007 | + } |
|
| 1008 | + |
|
| 1009 | + // |
|
| 1010 | + // 2. Récuperer la partie alternative apres |
|
| 1011 | + // |
|
| 1012 | + $altern_boucle = BALISE_ALT_BOUCLE . $id_boucle . '>'; |
|
| 1013 | + $pos_altern = strpos((string) $texte, $altern_boucle, $pos_courante); |
|
| 1014 | + if ( |
|
| 1015 | + $pos_altern !== false |
|
| 1016 | + && (!$pos_anonyme_next || $pos_altern < $pos_anonyme_next) |
|
| 1017 | + ) { |
|
| 1018 | + $boucle['pos_altern'] = $pos_altern; |
|
| 1019 | + $pos_altern += strlen($altern_boucle); |
|
| 1020 | + $boucle['pos_altern_inside'] = $pos_altern; |
|
| 1021 | + $pos_courante = $pos_altern; |
|
| 1022 | + } |
|
| 1023 | + |
|
| 1024 | + // |
|
| 1025 | + // 3. Recuperer la partie footer non alternative |
|
| 1026 | + // |
|
| 1027 | + $postaff_boucle = BALISE_POSTAFF_BOUCLE . $id_boucle . '>'; |
|
| 1028 | + $pos_postaff = strpos((string) $texte, $postaff_boucle, $pos_courante); |
|
| 1029 | + if ( |
|
| 1030 | + $pos_postaff !== false |
|
| 1031 | + && (!$pos_anonyme_next || $pos_postaff < $pos_anonyme_next) |
|
| 1032 | + ) { |
|
| 1033 | + $boucle['pos_postaff'] = $pos_postaff; |
|
| 1034 | + $pos_postaff += strlen($postaff_boucle); |
|
| 1035 | + $boucle['pos_postaff_inside'] = $pos_postaff; |
|
| 1036 | + $pos_courante = $pos_postaff ; |
|
| 1037 | + } |
|
| 1038 | + |
|
| 1039 | + return $boucle; |
|
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | |
@@ -1045,21 +1045,21 @@ discard block |
||
| 1045 | 1045 | * @param null|object $boucle |
| 1046 | 1046 | */ |
| 1047 | 1047 | function phraser_boucle_placeholder(&$champ, ?string $boucle_placeholder = null, $boucle = null) { |
| 1048 | - static $boucles_connues = []; |
|
| 1049 | - // si c'est un appel pour memoriser une boucle, memorisons la |
|
| 1050 | - if (is_string($champ) && !empty($boucle_placeholder) && !empty($boucle)) { |
|
| 1051 | - $boucles_connues[$boucle_placeholder][$champ] = &$boucle; |
|
| 1052 | - } |
|
| 1053 | - else { |
|
| 1054 | - if (!empty($champ->nom_champ) && !empty($boucles_connues[$champ->nom_champ])) { |
|
| 1055 | - $placeholder = $champ->nom_champ; |
|
| 1056 | - $id = reset($champ->param[0][1]); |
|
| 1057 | - $id = $id->texte; |
|
| 1058 | - if (!empty($boucles_connues[$placeholder][$id])) { |
|
| 1059 | - $champ = $boucles_connues[$placeholder][$id]; |
|
| 1060 | - } |
|
| 1061 | - } |
|
| 1062 | - } |
|
| 1048 | + static $boucles_connues = []; |
|
| 1049 | + // si c'est un appel pour memoriser une boucle, memorisons la |
|
| 1050 | + if (is_string($champ) && !empty($boucle_placeholder) && !empty($boucle)) { |
|
| 1051 | + $boucles_connues[$boucle_placeholder][$champ] = &$boucle; |
|
| 1052 | + } |
|
| 1053 | + else { |
|
| 1054 | + if (!empty($champ->nom_champ) && !empty($boucles_connues[$champ->nom_champ])) { |
|
| 1055 | + $placeholder = $champ->nom_champ; |
|
| 1056 | + $id = reset($champ->param[0][1]); |
|
| 1057 | + $id = $id->texte; |
|
| 1058 | + if (!empty($boucles_connues[$placeholder][$id])) { |
|
| 1059 | + $champ = $boucles_connues[$placeholder][$id]; |
|
| 1060 | + } |
|
| 1061 | + } |
|
| 1062 | + } |
|
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | 1065 | |
@@ -1069,11 +1069,11 @@ discard block |
||
| 1069 | 1069 | * @return string |
| 1070 | 1070 | */ |
| 1071 | 1071 | function public_generer_boucle_placeholder(string $id_boucle, &$boucle, string $boucle_placeholder, int $nb_lignes): string { |
| 1072 | - $placeholder = "[(#{$boucle_placeholder}{" . $id_boucle . '})' . str_pad('', $nb_lignes, "\n") . ']'; |
|
| 1073 | - //memoriser la boucle a reinjecter |
|
| 1074 | - $id_boucle = "$id_boucle"; |
|
| 1075 | - phraser_boucle_placeholder($id_boucle, $boucle_placeholder, $boucle); |
|
| 1076 | - return $placeholder; |
|
| 1072 | + $placeholder = "[(#{$boucle_placeholder}{" . $id_boucle . '})' . str_pad('', $nb_lignes, "\n") . ']'; |
|
| 1073 | + //memoriser la boucle a reinjecter |
|
| 1074 | + $id_boucle = "$id_boucle"; |
|
| 1075 | + phraser_boucle_placeholder($id_boucle, $boucle_placeholder, $boucle); |
|
| 1076 | + return $placeholder; |
|
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | /** |
@@ -1086,264 +1086,264 @@ discard block |
||
| 1086 | 1086 | */ |
| 1087 | 1087 | function public_phraser_html_dist(string $texte, string $id_parent, array &$boucles, array $descr, int $ligne_debut_texte = 1, ?string $boucle_placeholder = null): array { |
| 1088 | 1088 | |
| 1089 | - $all_res = []; |
|
| 1090 | - // definir un placholder pour les boucles dont on est sur d'avoir aucune occurence dans le squelette |
|
| 1091 | - if (is_null($boucle_placeholder)) { |
|
| 1092 | - do { |
|
| 1093 | - $boucle_placeholder = 'BOUCLE_PLACEHOLDER_' . strtoupper(md5(uniqid())); |
|
| 1094 | - } while (str_contains((string) $texte, $boucle_placeholder)); |
|
| 1095 | - } |
|
| 1096 | - |
|
| 1097 | - $ligne_debut_initial = $ligne_debut_texte; |
|
| 1098 | - $pos_debut_texte = 0; |
|
| 1099 | - while ($boucle = public_trouver_premiere_boucle($texte, $id_parent, $descr, $pos_debut_texte)) { |
|
| 1100 | - $err_b = ''; // indiquera s'il y a eu une erreur |
|
| 1101 | - $result = new Boucle(); |
|
| 1102 | - $result->id_parent = $id_parent; |
|
| 1103 | - $result->descr = $descr; |
|
| 1104 | - |
|
| 1105 | - $pos_courante = $boucle['pos_boucle']; |
|
| 1106 | - $pos_parent = $boucle['pos_parent']; |
|
| 1107 | - $id_boucle_search = $id_boucle = $boucle['id_boucle']; |
|
| 1108 | - |
|
| 1109 | - $ligne_preaff = $ligne_avant = $ligne_milieu = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_parent); |
|
| 1110 | - |
|
| 1111 | - // boucle anonyme ? |
|
| 1112 | - if (!strlen((string) $id_boucle)) { |
|
| 1113 | - $id_boucle = '_anon_L' . $ligne_milieu . '_' . substr(md5('anonyme:' . $id_parent . ':' . json_encode($boucle, JSON_THROW_ON_ERROR)), 0, 8); |
|
| 1114 | - } |
|
| 1115 | - |
|
| 1116 | - $pos_debut_boucle = $pos_courante; |
|
| 1117 | - |
|
| 1118 | - $pos_milieu = $pos_parent; |
|
| 1119 | - |
|
| 1120 | - // Regarder si on a une partie conditionnelle avant <B_xxx> |
|
| 1121 | - if ($boucle['pos_precond'] !== false) { |
|
| 1122 | - $pos_debut_boucle = $boucle['pos_precond']; |
|
| 1123 | - |
|
| 1124 | - $pos_avant = $boucle['pos_precond_inside']; |
|
| 1125 | - $result->avant = substr((string) $texte, $pos_avant, $pos_courante - $pos_avant); |
|
| 1126 | - $ligne_avant = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_avant); |
|
| 1127 | - } |
|
| 1128 | - |
|
| 1129 | - // Regarder si on a une partie inconditionnelle avant <BB_xxx> |
|
| 1130 | - if ($boucle['pos_preaff'] !== false) { |
|
| 1131 | - $end_preaff = $pos_debut_boucle; |
|
| 1132 | - |
|
| 1133 | - $pos_preaff = $boucle['pos_preaff_inside']; |
|
| 1134 | - $result->preaff = substr((string) $texte, $pos_preaff, $end_preaff - $pos_preaff); |
|
| 1135 | - $ligne_preaff = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_preaff); |
|
| 1136 | - } |
|
| 1137 | - |
|
| 1138 | - $result->id_boucle = $id_boucle; |
|
| 1139 | - |
|
| 1140 | - if ( |
|
| 1141 | - !preg_match(SPEC_BOUCLE, (string) $texte, $match, 0, $pos_milieu) |
|
| 1142 | - || ($pos_match = strpos((string) $texte, (string) $match[0], $pos_milieu)) === false |
|
| 1143 | - || $pos_match > $pos_milieu |
|
| 1144 | - ) { |
|
| 1145 | - $err_b = ['zbug_erreur_boucle_syntaxe', ['id' => $id_boucle]]; |
|
| 1146 | - erreur_squelette($err_b, $result); |
|
| 1147 | - |
|
| 1148 | - $ligne_debut_texte += public_compte_ligne($texte, $pos_debut_texte, $pos_courante + 1); |
|
| 1149 | - $pos_debut_texte = $pos_courante + 1; |
|
| 1150 | - continue; |
|
| 1151 | - } |
|
| 1152 | - |
|
| 1153 | - $result->type_requete = $match[0]; |
|
| 1154 | - $pos_milieu += strlen($match[0]); |
|
| 1155 | - $pos_courante = $pos_milieu; // on s'en sert pour compter les lignes plus precisemment |
|
| 1156 | - |
|
| 1157 | - $type = $match[1]; |
|
| 1158 | - $jointures = trim($match[2]); |
|
| 1159 | - $table_optionnelle = ($match[3]); |
|
| 1160 | - if ($jointures) { |
|
| 1161 | - // on affecte pas ici les jointures explicites, mais dans la compilation |
|
| 1162 | - // ou elles seront completees des jointures declarees |
|
| 1163 | - $result->jointures_explicites = $jointures; |
|
| 1164 | - } |
|
| 1165 | - |
|
| 1166 | - if ($table_optionnelle) { |
|
| 1167 | - $result->table_optionnelle = true; |
|
| 1168 | - $result->type_table_optionnelle = $type; |
|
| 1169 | - } |
|
| 1170 | - |
|
| 1171 | - // 1ere passe sur les criteres, vu comme des arguments sans fct |
|
| 1172 | - // Resultat mis dans result->param |
|
| 1173 | - $pos_fin_criteres = $pos_milieu; |
|
| 1174 | - phraser_args($texte, '/>', '', $all_res, $result, $pos_fin_criteres); |
|
| 1175 | - |
|
| 1176 | - // En 2e passe result->criteres contiendra un tableau |
|
| 1177 | - // pour l'instant on met le source (chaine) : |
|
| 1178 | - // si elle reste ici au final, c'est qu'elle contient une erreur |
|
| 1179 | - $pos_courante = $pos_fin_criteres; // on s'en sert pour compter les lignes plus precisemment |
|
| 1180 | - $result->criteres = substr((string) $texte, $pos_milieu, $pos_fin_criteres - $pos_milieu); |
|
| 1181 | - $pos_milieu = $pos_fin_criteres; |
|
| 1182 | - |
|
| 1183 | - // |
|
| 1184 | - // Recuperer la fin : |
|
| 1185 | - // |
|
| 1186 | - if ($texte[$pos_milieu] === '/') { |
|
| 1187 | - // boucle autofermante : pas de partie conditionnelle apres |
|
| 1188 | - $pos_courante += 2; |
|
| 1189 | - $result->milieu = ''; |
|
| 1190 | - } else { |
|
| 1191 | - $pos_milieu += 1; |
|
| 1192 | - |
|
| 1193 | - $fin_boucle = BALISE_FIN_BOUCLE . $id_boucle_search . '>'; |
|
| 1194 | - $pos_fin = strpos((string) $texte, $fin_boucle, $pos_milieu); |
|
| 1195 | - if ($pos_fin === false) { |
|
| 1196 | - $err_b = [ |
|
| 1197 | - 'zbug_erreur_boucle_fermant', |
|
| 1198 | - ['id' => $id_boucle] |
|
| 1199 | - ]; |
|
| 1200 | - erreur_squelette($err_b, $result); |
|
| 1201 | - $pos_courante += strlen($fin_boucle); |
|
| 1202 | - } |
|
| 1203 | - else { |
|
| 1204 | - // verifier une eventuelle imbrication d'une boucle homonyme |
|
| 1205 | - // (interdite, generera une erreur plus loin, mais permet de signaler la bonne erreur) |
|
| 1206 | - $search_debut_boucle = BALISE_BOUCLE . $id_boucle_search . '('; |
|
| 1207 | - $search_from = $pos_milieu; |
|
| 1208 | - $nb_open = 1; |
|
| 1209 | - $nb_close = 1; |
|
| 1210 | - $maxiter = 0; |
|
| 1211 | - do { |
|
| 1212 | - while ( |
|
| 1213 | - $nb_close < $nb_open |
|
| 1214 | - && ($p = strpos((string) $texte, $fin_boucle, $pos_fin + 1)) |
|
| 1215 | - ) { |
|
| 1216 | - $nb_close++; |
|
| 1217 | - $pos_fin = $p; |
|
| 1218 | - } |
|
| 1219 | - // si on a pas trouve assez de boucles fermantes, sortir de la, on a fait de notre mieux |
|
| 1220 | - if ($nb_close < $nb_open) { |
|
| 1221 | - break; |
|
| 1222 | - } |
|
| 1223 | - while ( |
|
| 1224 | - ($p = strpos((string) $texte, $search_debut_boucle, $search_from)) |
|
| 1225 | - && $p < $pos_fin |
|
| 1226 | - ) { |
|
| 1227 | - $nb_open++; |
|
| 1228 | - $search_from = $p + 1; |
|
| 1229 | - } |
|
| 1230 | - } while ($nb_close < $nb_open && $maxiter++ < 5); |
|
| 1231 | - |
|
| 1232 | - $pos_courante = $pos_fin + strlen($fin_boucle); |
|
| 1233 | - } |
|
| 1234 | - $result->milieu = substr((string) $texte, $pos_milieu, $pos_fin - $pos_milieu); |
|
| 1235 | - } |
|
| 1236 | - |
|
| 1237 | - $ligne_suite = $ligne_apres = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_courante); |
|
| 1238 | - $boucle = public_trouver_fin_boucle($texte, $id_parent, $boucle, $pos_courante, $result); |
|
| 1239 | - |
|
| 1240 | - // |
|
| 1241 | - // 1. Partie conditionnelle apres ? |
|
| 1242 | - // |
|
| 1243 | - if ($boucle['pos_postcond']) { |
|
| 1244 | - $result->apres = substr((string) $texte, $pos_courante, $boucle['pos_postcond'] - $pos_courante); |
|
| 1245 | - $ligne_suite += public_compte_ligne($texte, $pos_courante, $boucle['pos_postcond_inside']); |
|
| 1246 | - $pos_courante = $boucle['pos_postcond_inside'] ; |
|
| 1247 | - } |
|
| 1248 | - |
|
| 1249 | - |
|
| 1250 | - // |
|
| 1251 | - // 2. Partie alternative apres ? |
|
| 1252 | - // |
|
| 1253 | - $ligne_altern = $ligne_suite; |
|
| 1254 | - if ($boucle['pos_altern']) { |
|
| 1255 | - $result->altern = substr((string) $texte, $pos_courante, $boucle['pos_altern'] - $pos_courante); |
|
| 1256 | - $ligne_suite += public_compte_ligne($texte, $pos_courante, $boucle['pos_altern_inside']); |
|
| 1257 | - $pos_courante = $boucle['pos_altern_inside']; |
|
| 1258 | - } |
|
| 1259 | - |
|
| 1260 | - // |
|
| 1261 | - // 3. Partie footer non alternative ? |
|
| 1262 | - // |
|
| 1263 | - $ligne_postaff = $ligne_suite; |
|
| 1264 | - if ($boucle['pos_postaff']) { |
|
| 1265 | - $result->postaff = substr((string) $texte, $pos_courante, $boucle['pos_postaff'] - $pos_courante); |
|
| 1266 | - $ligne_suite += public_compte_ligne($texte, $pos_courante, $boucle['pos_postaff_inside']); |
|
| 1267 | - $pos_courante = $boucle['pos_postaff_inside']; |
|
| 1268 | - } |
|
| 1269 | - |
|
| 1270 | - $result->ligne = $ligne_preaff; |
|
| 1271 | - |
|
| 1272 | - if ($p = strpos($type, ':')) { |
|
| 1273 | - $result->sql_serveur = substr($type, 0, $p); |
|
| 1274 | - $type = substr($type, $p + 1); |
|
| 1275 | - } |
|
| 1276 | - $soustype = strtolower($type); |
|
| 1277 | - |
|
| 1278 | - if (!isset($GLOBALS['table_des_tables'][$soustype])) { |
|
| 1279 | - $soustype = $type; |
|
| 1280 | - } |
|
| 1281 | - |
|
| 1282 | - $result->type_requete = $soustype; |
|
| 1283 | - // Lancer la 2e passe sur les criteres si la 1ere etait bonne |
|
| 1284 | - if (!is_array($result->param)) { |
|
| 1285 | - $err_b = true; |
|
| 1286 | - } else { |
|
| 1287 | - phraser_criteres($result->param, $result); |
|
| 1288 | - if (strncasecmp($soustype, TYPE_RECURSIF, strlen(TYPE_RECURSIF)) == 0) { |
|
| 1289 | - $result->type_requete = TYPE_RECURSIF; |
|
| 1290 | - $args = $result->param; |
|
| 1291 | - array_unshift( |
|
| 1292 | - $args, |
|
| 1293 | - substr($type, strlen(TYPE_RECURSIF)) |
|
| 1294 | - ); |
|
| 1295 | - $result->param = $args; |
|
| 1296 | - } |
|
| 1297 | - } |
|
| 1298 | - |
|
| 1299 | - $descr['id_mere_contexte'] = $id_boucle; |
|
| 1300 | - $result->milieu = public_phraser_html_dist($result->milieu, $id_boucle, $boucles, $descr, $ligne_milieu, $boucle_placeholder); |
|
| 1301 | - // reserver la place dans la pile des boucles pour compiler ensuite dans le bon ordre |
|
| 1302 | - // ie les boucles qui apparaissent dans les partie conditionnelles doivent etre compilees apres cette boucle |
|
| 1303 | - // si il y a deja une boucle de ce nom, cela declenchera une erreur ensuite |
|
| 1304 | - if (empty($boucles[$id_boucle])) { |
|
| 1305 | - $boucles[$id_boucle] = null; |
|
| 1306 | - } |
|
| 1307 | - $result->preaff = public_phraser_html_dist($result->preaff, $id_parent, $boucles, $descr, $ligne_preaff, $boucle_placeholder); |
|
| 1308 | - $result->avant = public_phraser_html_dist($result->avant, $id_parent, $boucles, $descr, $ligne_avant, $boucle_placeholder); |
|
| 1309 | - $result->apres = public_phraser_html_dist($result->apres, $id_parent, $boucles, $descr, $ligne_apres, $boucle_placeholder); |
|
| 1310 | - $result->altern = public_phraser_html_dist($result->altern, $id_parent, $boucles, $descr, $ligne_altern, $boucle_placeholder); |
|
| 1311 | - $result->postaff = public_phraser_html_dist($result->postaff, $id_parent, $boucles, $descr, $ligne_postaff, $boucle_placeholder); |
|
| 1312 | - |
|
| 1313 | - // Prevenir le generateur de code que le squelette est faux |
|
| 1314 | - if ($err_b) { |
|
| 1315 | - $result->type_requete = false; |
|
| 1316 | - } |
|
| 1317 | - |
|
| 1318 | - // Verifier qu'il n'y a pas double definition |
|
| 1319 | - // apres analyse des sous-parties (pas avant). |
|
| 1320 | - if (!empty($boucles[$id_boucle])) { |
|
| 1321 | - if ($boucles[$id_boucle]->type_requete !== false) { |
|
| 1322 | - $err_b_d = [ |
|
| 1323 | - 'zbug_erreur_boucle_double', |
|
| 1324 | - ['id' => $id_boucle] |
|
| 1325 | - ]; |
|
| 1326 | - erreur_squelette($err_b_d, $result); |
|
| 1327 | - // Prevenir le generateur de code que le squelette est faux |
|
| 1328 | - $boucles[$id_boucle]->type_requete = false; |
|
| 1329 | - } |
|
| 1330 | - } else { |
|
| 1331 | - $boucles[$id_boucle] = $result; |
|
| 1332 | - } |
|
| 1333 | - |
|
| 1334 | - // remplacer la boucle par un placeholder qui compte le meme nombre de lignes |
|
| 1335 | - $placeholder = public_generer_boucle_placeholder($id_boucle, $boucles[$id_boucle], $boucle_placeholder, $ligne_suite - $ligne_debut_texte); |
|
| 1336 | - $longueur_boucle = $pos_courante - $boucle['debut_boucle']; |
|
| 1337 | - $texte = substr_replace((string) $texte, $placeholder, $boucle['debut_boucle'], $longueur_boucle); |
|
| 1338 | - $pos_courante = $pos_courante - $longueur_boucle + strlen($placeholder); |
|
| 1339 | - |
|
| 1340 | - // phraser la partie avant le debut de la boucle |
|
| 1341 | - #$all_res = phraser_champs_etendus(substr($texte, $pos_debut_texte, $boucle['debut_boucle'] - $pos_debut_texte), $ligne_debut_texte, $all_res); |
|
| 1342 | - #$all_res[] = &$boucles[$id_boucle]; |
|
| 1343 | - |
|
| 1344 | - $ligne_debut_texte = $ligne_suite; |
|
| 1345 | - $pos_debut_texte = $pos_courante; |
|
| 1346 | - } |
|
| 1347 | - |
|
| 1348 | - return phraser_champs_etendus($texte, $ligne_debut_initial, $all_res); |
|
| 1089 | + $all_res = []; |
|
| 1090 | + // definir un placholder pour les boucles dont on est sur d'avoir aucune occurence dans le squelette |
|
| 1091 | + if (is_null($boucle_placeholder)) { |
|
| 1092 | + do { |
|
| 1093 | + $boucle_placeholder = 'BOUCLE_PLACEHOLDER_' . strtoupper(md5(uniqid())); |
|
| 1094 | + } while (str_contains((string) $texte, $boucle_placeholder)); |
|
| 1095 | + } |
|
| 1096 | + |
|
| 1097 | + $ligne_debut_initial = $ligne_debut_texte; |
|
| 1098 | + $pos_debut_texte = 0; |
|
| 1099 | + while ($boucle = public_trouver_premiere_boucle($texte, $id_parent, $descr, $pos_debut_texte)) { |
|
| 1100 | + $err_b = ''; // indiquera s'il y a eu une erreur |
|
| 1101 | + $result = new Boucle(); |
|
| 1102 | + $result->id_parent = $id_parent; |
|
| 1103 | + $result->descr = $descr; |
|
| 1104 | + |
|
| 1105 | + $pos_courante = $boucle['pos_boucle']; |
|
| 1106 | + $pos_parent = $boucle['pos_parent']; |
|
| 1107 | + $id_boucle_search = $id_boucle = $boucle['id_boucle']; |
|
| 1108 | + |
|
| 1109 | + $ligne_preaff = $ligne_avant = $ligne_milieu = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_parent); |
|
| 1110 | + |
|
| 1111 | + // boucle anonyme ? |
|
| 1112 | + if (!strlen((string) $id_boucle)) { |
|
| 1113 | + $id_boucle = '_anon_L' . $ligne_milieu . '_' . substr(md5('anonyme:' . $id_parent . ':' . json_encode($boucle, JSON_THROW_ON_ERROR)), 0, 8); |
|
| 1114 | + } |
|
| 1115 | + |
|
| 1116 | + $pos_debut_boucle = $pos_courante; |
|
| 1117 | + |
|
| 1118 | + $pos_milieu = $pos_parent; |
|
| 1119 | + |
|
| 1120 | + // Regarder si on a une partie conditionnelle avant <B_xxx> |
|
| 1121 | + if ($boucle['pos_precond'] !== false) { |
|
| 1122 | + $pos_debut_boucle = $boucle['pos_precond']; |
|
| 1123 | + |
|
| 1124 | + $pos_avant = $boucle['pos_precond_inside']; |
|
| 1125 | + $result->avant = substr((string) $texte, $pos_avant, $pos_courante - $pos_avant); |
|
| 1126 | + $ligne_avant = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_avant); |
|
| 1127 | + } |
|
| 1128 | + |
|
| 1129 | + // Regarder si on a une partie inconditionnelle avant <BB_xxx> |
|
| 1130 | + if ($boucle['pos_preaff'] !== false) { |
|
| 1131 | + $end_preaff = $pos_debut_boucle; |
|
| 1132 | + |
|
| 1133 | + $pos_preaff = $boucle['pos_preaff_inside']; |
|
| 1134 | + $result->preaff = substr((string) $texte, $pos_preaff, $end_preaff - $pos_preaff); |
|
| 1135 | + $ligne_preaff = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_preaff); |
|
| 1136 | + } |
|
| 1137 | + |
|
| 1138 | + $result->id_boucle = $id_boucle; |
|
| 1139 | + |
|
| 1140 | + if ( |
|
| 1141 | + !preg_match(SPEC_BOUCLE, (string) $texte, $match, 0, $pos_milieu) |
|
| 1142 | + || ($pos_match = strpos((string) $texte, (string) $match[0], $pos_milieu)) === false |
|
| 1143 | + || $pos_match > $pos_milieu |
|
| 1144 | + ) { |
|
| 1145 | + $err_b = ['zbug_erreur_boucle_syntaxe', ['id' => $id_boucle]]; |
|
| 1146 | + erreur_squelette($err_b, $result); |
|
| 1147 | + |
|
| 1148 | + $ligne_debut_texte += public_compte_ligne($texte, $pos_debut_texte, $pos_courante + 1); |
|
| 1149 | + $pos_debut_texte = $pos_courante + 1; |
|
| 1150 | + continue; |
|
| 1151 | + } |
|
| 1152 | + |
|
| 1153 | + $result->type_requete = $match[0]; |
|
| 1154 | + $pos_milieu += strlen($match[0]); |
|
| 1155 | + $pos_courante = $pos_milieu; // on s'en sert pour compter les lignes plus precisemment |
|
| 1156 | + |
|
| 1157 | + $type = $match[1]; |
|
| 1158 | + $jointures = trim($match[2]); |
|
| 1159 | + $table_optionnelle = ($match[3]); |
|
| 1160 | + if ($jointures) { |
|
| 1161 | + // on affecte pas ici les jointures explicites, mais dans la compilation |
|
| 1162 | + // ou elles seront completees des jointures declarees |
|
| 1163 | + $result->jointures_explicites = $jointures; |
|
| 1164 | + } |
|
| 1165 | + |
|
| 1166 | + if ($table_optionnelle) { |
|
| 1167 | + $result->table_optionnelle = true; |
|
| 1168 | + $result->type_table_optionnelle = $type; |
|
| 1169 | + } |
|
| 1170 | + |
|
| 1171 | + // 1ere passe sur les criteres, vu comme des arguments sans fct |
|
| 1172 | + // Resultat mis dans result->param |
|
| 1173 | + $pos_fin_criteres = $pos_milieu; |
|
| 1174 | + phraser_args($texte, '/>', '', $all_res, $result, $pos_fin_criteres); |
|
| 1175 | + |
|
| 1176 | + // En 2e passe result->criteres contiendra un tableau |
|
| 1177 | + // pour l'instant on met le source (chaine) : |
|
| 1178 | + // si elle reste ici au final, c'est qu'elle contient une erreur |
|
| 1179 | + $pos_courante = $pos_fin_criteres; // on s'en sert pour compter les lignes plus precisemment |
|
| 1180 | + $result->criteres = substr((string) $texte, $pos_milieu, $pos_fin_criteres - $pos_milieu); |
|
| 1181 | + $pos_milieu = $pos_fin_criteres; |
|
| 1182 | + |
|
| 1183 | + // |
|
| 1184 | + // Recuperer la fin : |
|
| 1185 | + // |
|
| 1186 | + if ($texte[$pos_milieu] === '/') { |
|
| 1187 | + // boucle autofermante : pas de partie conditionnelle apres |
|
| 1188 | + $pos_courante += 2; |
|
| 1189 | + $result->milieu = ''; |
|
| 1190 | + } else { |
|
| 1191 | + $pos_milieu += 1; |
|
| 1192 | + |
|
| 1193 | + $fin_boucle = BALISE_FIN_BOUCLE . $id_boucle_search . '>'; |
|
| 1194 | + $pos_fin = strpos((string) $texte, $fin_boucle, $pos_milieu); |
|
| 1195 | + if ($pos_fin === false) { |
|
| 1196 | + $err_b = [ |
|
| 1197 | + 'zbug_erreur_boucle_fermant', |
|
| 1198 | + ['id' => $id_boucle] |
|
| 1199 | + ]; |
|
| 1200 | + erreur_squelette($err_b, $result); |
|
| 1201 | + $pos_courante += strlen($fin_boucle); |
|
| 1202 | + } |
|
| 1203 | + else { |
|
| 1204 | + // verifier une eventuelle imbrication d'une boucle homonyme |
|
| 1205 | + // (interdite, generera une erreur plus loin, mais permet de signaler la bonne erreur) |
|
| 1206 | + $search_debut_boucle = BALISE_BOUCLE . $id_boucle_search . '('; |
|
| 1207 | + $search_from = $pos_milieu; |
|
| 1208 | + $nb_open = 1; |
|
| 1209 | + $nb_close = 1; |
|
| 1210 | + $maxiter = 0; |
|
| 1211 | + do { |
|
| 1212 | + while ( |
|
| 1213 | + $nb_close < $nb_open |
|
| 1214 | + && ($p = strpos((string) $texte, $fin_boucle, $pos_fin + 1)) |
|
| 1215 | + ) { |
|
| 1216 | + $nb_close++; |
|
| 1217 | + $pos_fin = $p; |
|
| 1218 | + } |
|
| 1219 | + // si on a pas trouve assez de boucles fermantes, sortir de la, on a fait de notre mieux |
|
| 1220 | + if ($nb_close < $nb_open) { |
|
| 1221 | + break; |
|
| 1222 | + } |
|
| 1223 | + while ( |
|
| 1224 | + ($p = strpos((string) $texte, $search_debut_boucle, $search_from)) |
|
| 1225 | + && $p < $pos_fin |
|
| 1226 | + ) { |
|
| 1227 | + $nb_open++; |
|
| 1228 | + $search_from = $p + 1; |
|
| 1229 | + } |
|
| 1230 | + } while ($nb_close < $nb_open && $maxiter++ < 5); |
|
| 1231 | + |
|
| 1232 | + $pos_courante = $pos_fin + strlen($fin_boucle); |
|
| 1233 | + } |
|
| 1234 | + $result->milieu = substr((string) $texte, $pos_milieu, $pos_fin - $pos_milieu); |
|
| 1235 | + } |
|
| 1236 | + |
|
| 1237 | + $ligne_suite = $ligne_apres = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_courante); |
|
| 1238 | + $boucle = public_trouver_fin_boucle($texte, $id_parent, $boucle, $pos_courante, $result); |
|
| 1239 | + |
|
| 1240 | + // |
|
| 1241 | + // 1. Partie conditionnelle apres ? |
|
| 1242 | + // |
|
| 1243 | + if ($boucle['pos_postcond']) { |
|
| 1244 | + $result->apres = substr((string) $texte, $pos_courante, $boucle['pos_postcond'] - $pos_courante); |
|
| 1245 | + $ligne_suite += public_compte_ligne($texte, $pos_courante, $boucle['pos_postcond_inside']); |
|
| 1246 | + $pos_courante = $boucle['pos_postcond_inside'] ; |
|
| 1247 | + } |
|
| 1248 | + |
|
| 1249 | + |
|
| 1250 | + // |
|
| 1251 | + // 2. Partie alternative apres ? |
|
| 1252 | + // |
|
| 1253 | + $ligne_altern = $ligne_suite; |
|
| 1254 | + if ($boucle['pos_altern']) { |
|
| 1255 | + $result->altern = substr((string) $texte, $pos_courante, $boucle['pos_altern'] - $pos_courante); |
|
| 1256 | + $ligne_suite += public_compte_ligne($texte, $pos_courante, $boucle['pos_altern_inside']); |
|
| 1257 | + $pos_courante = $boucle['pos_altern_inside']; |
|
| 1258 | + } |
|
| 1259 | + |
|
| 1260 | + // |
|
| 1261 | + // 3. Partie footer non alternative ? |
|
| 1262 | + // |
|
| 1263 | + $ligne_postaff = $ligne_suite; |
|
| 1264 | + if ($boucle['pos_postaff']) { |
|
| 1265 | + $result->postaff = substr((string) $texte, $pos_courante, $boucle['pos_postaff'] - $pos_courante); |
|
| 1266 | + $ligne_suite += public_compte_ligne($texte, $pos_courante, $boucle['pos_postaff_inside']); |
|
| 1267 | + $pos_courante = $boucle['pos_postaff_inside']; |
|
| 1268 | + } |
|
| 1269 | + |
|
| 1270 | + $result->ligne = $ligne_preaff; |
|
| 1271 | + |
|
| 1272 | + if ($p = strpos($type, ':')) { |
|
| 1273 | + $result->sql_serveur = substr($type, 0, $p); |
|
| 1274 | + $type = substr($type, $p + 1); |
|
| 1275 | + } |
|
| 1276 | + $soustype = strtolower($type); |
|
| 1277 | + |
|
| 1278 | + if (!isset($GLOBALS['table_des_tables'][$soustype])) { |
|
| 1279 | + $soustype = $type; |
|
| 1280 | + } |
|
| 1281 | + |
|
| 1282 | + $result->type_requete = $soustype; |
|
| 1283 | + // Lancer la 2e passe sur les criteres si la 1ere etait bonne |
|
| 1284 | + if (!is_array($result->param)) { |
|
| 1285 | + $err_b = true; |
|
| 1286 | + } else { |
|
| 1287 | + phraser_criteres($result->param, $result); |
|
| 1288 | + if (strncasecmp($soustype, TYPE_RECURSIF, strlen(TYPE_RECURSIF)) == 0) { |
|
| 1289 | + $result->type_requete = TYPE_RECURSIF; |
|
| 1290 | + $args = $result->param; |
|
| 1291 | + array_unshift( |
|
| 1292 | + $args, |
|
| 1293 | + substr($type, strlen(TYPE_RECURSIF)) |
|
| 1294 | + ); |
|
| 1295 | + $result->param = $args; |
|
| 1296 | + } |
|
| 1297 | + } |
|
| 1298 | + |
|
| 1299 | + $descr['id_mere_contexte'] = $id_boucle; |
|
| 1300 | + $result->milieu = public_phraser_html_dist($result->milieu, $id_boucle, $boucles, $descr, $ligne_milieu, $boucle_placeholder); |
|
| 1301 | + // reserver la place dans la pile des boucles pour compiler ensuite dans le bon ordre |
|
| 1302 | + // ie les boucles qui apparaissent dans les partie conditionnelles doivent etre compilees apres cette boucle |
|
| 1303 | + // si il y a deja une boucle de ce nom, cela declenchera une erreur ensuite |
|
| 1304 | + if (empty($boucles[$id_boucle])) { |
|
| 1305 | + $boucles[$id_boucle] = null; |
|
| 1306 | + } |
|
| 1307 | + $result->preaff = public_phraser_html_dist($result->preaff, $id_parent, $boucles, $descr, $ligne_preaff, $boucle_placeholder); |
|
| 1308 | + $result->avant = public_phraser_html_dist($result->avant, $id_parent, $boucles, $descr, $ligne_avant, $boucle_placeholder); |
|
| 1309 | + $result->apres = public_phraser_html_dist($result->apres, $id_parent, $boucles, $descr, $ligne_apres, $boucle_placeholder); |
|
| 1310 | + $result->altern = public_phraser_html_dist($result->altern, $id_parent, $boucles, $descr, $ligne_altern, $boucle_placeholder); |
|
| 1311 | + $result->postaff = public_phraser_html_dist($result->postaff, $id_parent, $boucles, $descr, $ligne_postaff, $boucle_placeholder); |
|
| 1312 | + |
|
| 1313 | + // Prevenir le generateur de code que le squelette est faux |
|
| 1314 | + if ($err_b) { |
|
| 1315 | + $result->type_requete = false; |
|
| 1316 | + } |
|
| 1317 | + |
|
| 1318 | + // Verifier qu'il n'y a pas double definition |
|
| 1319 | + // apres analyse des sous-parties (pas avant). |
|
| 1320 | + if (!empty($boucles[$id_boucle])) { |
|
| 1321 | + if ($boucles[$id_boucle]->type_requete !== false) { |
|
| 1322 | + $err_b_d = [ |
|
| 1323 | + 'zbug_erreur_boucle_double', |
|
| 1324 | + ['id' => $id_boucle] |
|
| 1325 | + ]; |
|
| 1326 | + erreur_squelette($err_b_d, $result); |
|
| 1327 | + // Prevenir le generateur de code que le squelette est faux |
|
| 1328 | + $boucles[$id_boucle]->type_requete = false; |
|
| 1329 | + } |
|
| 1330 | + } else { |
|
| 1331 | + $boucles[$id_boucle] = $result; |
|
| 1332 | + } |
|
| 1333 | + |
|
| 1334 | + // remplacer la boucle par un placeholder qui compte le meme nombre de lignes |
|
| 1335 | + $placeholder = public_generer_boucle_placeholder($id_boucle, $boucles[$id_boucle], $boucle_placeholder, $ligne_suite - $ligne_debut_texte); |
|
| 1336 | + $longueur_boucle = $pos_courante - $boucle['debut_boucle']; |
|
| 1337 | + $texte = substr_replace((string) $texte, $placeholder, $boucle['debut_boucle'], $longueur_boucle); |
|
| 1338 | + $pos_courante = $pos_courante - $longueur_boucle + strlen($placeholder); |
|
| 1339 | + |
|
| 1340 | + // phraser la partie avant le debut de la boucle |
|
| 1341 | + #$all_res = phraser_champs_etendus(substr($texte, $pos_debut_texte, $boucle['debut_boucle'] - $pos_debut_texte), $ligne_debut_texte, $all_res); |
|
| 1342 | + #$all_res[] = &$boucles[$id_boucle]; |
|
| 1343 | + |
|
| 1344 | + $ligne_debut_texte = $ligne_suite; |
|
| 1345 | + $pos_debut_texte = $pos_courante; |
|
| 1346 | + } |
|
| 1347 | + |
|
| 1348 | + return phraser_champs_etendus($texte, $ligne_debut_initial, $all_res); |
|
| 1349 | 1349 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -18,154 +18,154 @@ discard block |
||
| 18 | 18 | * @return string |
| 19 | 19 | */ |
| 20 | 20 | function securiser_redirect_action($redirect) { |
| 21 | - $redirect ??= ''; |
|
| 22 | - // cas d'un double urlencode : si un urldecode de l'url n'est pas secure, on retient ca comme redirect |
|
| 23 | - if (str_contains($redirect, '%')) { |
|
| 24 | - $r2 = urldecode($redirect); |
|
| 25 | - if (($r3 = securiser_redirect_action($r2)) !== $r2) { |
|
| 26 | - return $r3; |
|
| 27 | - } |
|
| 28 | - } |
|
| 29 | - if ( |
|
| 30 | - (tester_url_absolue($redirect) || preg_match(',^\w+:,', trim($redirect))) |
|
| 31 | - && !defined('_AUTORISER_ACTION_ABS_REDIRECT') |
|
| 32 | - ) { |
|
| 33 | - // si l'url est une url du site, on la laisse passer sans rien faire |
|
| 34 | - // c'est encore le plus simple |
|
| 35 | - $base = $GLOBALS['meta']['adresse_site'] . '/'; |
|
| 36 | - if (strlen($base) && str_starts_with($redirect, $base)) { |
|
| 37 | - return $redirect; |
|
| 38 | - } |
|
| 39 | - $base = url_de_base(); |
|
| 40 | - if (strlen($base) && str_starts_with($redirect, $base)) { |
|
| 41 | - return $redirect; |
|
| 42 | - } |
|
| 21 | + $redirect ??= ''; |
|
| 22 | + // cas d'un double urlencode : si un urldecode de l'url n'est pas secure, on retient ca comme redirect |
|
| 23 | + if (str_contains($redirect, '%')) { |
|
| 24 | + $r2 = urldecode($redirect); |
|
| 25 | + if (($r3 = securiser_redirect_action($r2)) !== $r2) { |
|
| 26 | + return $r3; |
|
| 27 | + } |
|
| 28 | + } |
|
| 29 | + if ( |
|
| 30 | + (tester_url_absolue($redirect) || preg_match(',^\w+:,', trim($redirect))) |
|
| 31 | + && !defined('_AUTORISER_ACTION_ABS_REDIRECT') |
|
| 32 | + ) { |
|
| 33 | + // si l'url est une url du site, on la laisse passer sans rien faire |
|
| 34 | + // c'est encore le plus simple |
|
| 35 | + $base = $GLOBALS['meta']['adresse_site'] . '/'; |
|
| 36 | + if (strlen($base) && str_starts_with($redirect, $base)) { |
|
| 37 | + return $redirect; |
|
| 38 | + } |
|
| 39 | + $base = url_de_base(); |
|
| 40 | + if (strlen($base) && str_starts_with($redirect, $base)) { |
|
| 41 | + return $redirect; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - return ''; |
|
| 45 | - } |
|
| 44 | + return ''; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return $redirect; |
|
| 47 | + return $redirect; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | function traiter_appels_actions() { |
| 51 | - // cas de l'appel qui renvoie une redirection (302) ou rien (204) |
|
| 52 | - if ($action = _request('action')) { |
|
| 53 | - include_spip('base/abstract_sql'); // chargement systematique pour les actions |
|
| 54 | - include_spip('inc/autoriser'); |
|
| 55 | - include_spip('inc/headers'); |
|
| 56 | - include_spip('inc/actions'); |
|
| 57 | - // des actions peuvent appeler _T |
|
| 58 | - if (!isset($GLOBALS['spip_lang'])) { |
|
| 59 | - include_spip('inc/lang'); |
|
| 60 | - utiliser_langue_visiteur(); |
|
| 61 | - } |
|
| 62 | - // si l'action est provoque par un hit {ajax} |
|
| 63 | - // il faut transmettre l'env ajax au redirect |
|
| 64 | - // on le met avant dans la query string au cas ou l'action fait elle meme sa redirection |
|
| 65 | - if ( |
|
| 66 | - ($v = _request('var_ajax')) |
|
| 67 | - && $v !== 'form' |
|
| 68 | - && ($args = _request('var_ajax_env')) |
|
| 69 | - && ($url = _request('redirect')) |
|
| 70 | - ) { |
|
| 71 | - $url = parametre_url($url, 'var_ajax', $v, '&'); |
|
| 72 | - $url = parametre_url($url, 'var_ajax_env', $args, '&'); |
|
| 73 | - set_request('redirect', $url); |
|
| 74 | - } else { |
|
| 75 | - if (_request('redirect')) { |
|
| 76 | - set_request('redirect', securiser_redirect_action(_request('redirect'))); |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - $var_f = charger_fonction($action, 'action'); |
|
| 80 | - $var_f(); |
|
| 81 | - if (!isset($GLOBALS['redirect'])) { |
|
| 82 | - $GLOBALS['redirect'] = _request('redirect') ?? ''; |
|
| 83 | - if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
|
| 84 | - $GLOBALS['redirect'] = urldecode($GLOBALS['redirect']); |
|
| 85 | - } |
|
| 86 | - $GLOBALS['redirect'] = securiser_redirect_action($GLOBALS['redirect']); |
|
| 87 | - } |
|
| 88 | - if ($url = $GLOBALS['redirect']) { |
|
| 89 | - // si l'action est provoque par un hit {ajax} |
|
| 90 | - // il faut transmettre l'env ajax au redirect |
|
| 91 | - // qui a pu etre defini par l'action |
|
| 92 | - if ( |
|
| 93 | - ($v = _request('var_ajax')) |
|
| 94 | - && $v !== 'form' |
|
| 95 | - && ($args = _request('var_ajax_env')) |
|
| 96 | - ) { |
|
| 97 | - $url = parametre_url($url, 'var_ajax', $v, '&'); |
|
| 98 | - $url = parametre_url($url, 'var_ajax_env', $args, '&'); |
|
| 99 | - // passer l'ancre en variable pour pouvoir la gerer cote serveur |
|
| 100 | - $url = preg_replace(',#([^#&?]+)$,', "&var_ajax_ancre=\\1", $url); |
|
| 101 | - } |
|
| 102 | - $url = str_replace('&', '&', $url); // les redirections se font en &, pas en en & |
|
| 103 | - redirige_par_entete($url); |
|
| 104 | - } |
|
| 51 | + // cas de l'appel qui renvoie une redirection (302) ou rien (204) |
|
| 52 | + if ($action = _request('action')) { |
|
| 53 | + include_spip('base/abstract_sql'); // chargement systematique pour les actions |
|
| 54 | + include_spip('inc/autoriser'); |
|
| 55 | + include_spip('inc/headers'); |
|
| 56 | + include_spip('inc/actions'); |
|
| 57 | + // des actions peuvent appeler _T |
|
| 58 | + if (!isset($GLOBALS['spip_lang'])) { |
|
| 59 | + include_spip('inc/lang'); |
|
| 60 | + utiliser_langue_visiteur(); |
|
| 61 | + } |
|
| 62 | + // si l'action est provoque par un hit {ajax} |
|
| 63 | + // il faut transmettre l'env ajax au redirect |
|
| 64 | + // on le met avant dans la query string au cas ou l'action fait elle meme sa redirection |
|
| 65 | + if ( |
|
| 66 | + ($v = _request('var_ajax')) |
|
| 67 | + && $v !== 'form' |
|
| 68 | + && ($args = _request('var_ajax_env')) |
|
| 69 | + && ($url = _request('redirect')) |
|
| 70 | + ) { |
|
| 71 | + $url = parametre_url($url, 'var_ajax', $v, '&'); |
|
| 72 | + $url = parametre_url($url, 'var_ajax_env', $args, '&'); |
|
| 73 | + set_request('redirect', $url); |
|
| 74 | + } else { |
|
| 75 | + if (_request('redirect')) { |
|
| 76 | + set_request('redirect', securiser_redirect_action(_request('redirect'))); |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + $var_f = charger_fonction($action, 'action'); |
|
| 80 | + $var_f(); |
|
| 81 | + if (!isset($GLOBALS['redirect'])) { |
|
| 82 | + $GLOBALS['redirect'] = _request('redirect') ?? ''; |
|
| 83 | + if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
|
| 84 | + $GLOBALS['redirect'] = urldecode($GLOBALS['redirect']); |
|
| 85 | + } |
|
| 86 | + $GLOBALS['redirect'] = securiser_redirect_action($GLOBALS['redirect']); |
|
| 87 | + } |
|
| 88 | + if ($url = $GLOBALS['redirect']) { |
|
| 89 | + // si l'action est provoque par un hit {ajax} |
|
| 90 | + // il faut transmettre l'env ajax au redirect |
|
| 91 | + // qui a pu etre defini par l'action |
|
| 92 | + if ( |
|
| 93 | + ($v = _request('var_ajax')) |
|
| 94 | + && $v !== 'form' |
|
| 95 | + && ($args = _request('var_ajax_env')) |
|
| 96 | + ) { |
|
| 97 | + $url = parametre_url($url, 'var_ajax', $v, '&'); |
|
| 98 | + $url = parametre_url($url, 'var_ajax_env', $args, '&'); |
|
| 99 | + // passer l'ancre en variable pour pouvoir la gerer cote serveur |
|
| 100 | + $url = preg_replace(',#([^#&?]+)$,', "&var_ajax_ancre=\\1", $url); |
|
| 101 | + } |
|
| 102 | + $url = str_replace('&', '&', $url); // les redirections se font en &, pas en en & |
|
| 103 | + redirige_par_entete($url); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - // attention : avec zlib.output_compression=1 on a vu des cas de ob_get_length() qui renvoi 0 |
|
| 107 | - // et du coup en renvoi un status 204 a tort (vu sur le menu rubriques notamment) |
|
| 108 | - if (!headers_sent() && !ob_get_length()) { |
|
| 109 | - http_response_code(204); |
|
| 110 | - } // No Content |
|
| 111 | - return true; |
|
| 112 | - } |
|
| 106 | + // attention : avec zlib.output_compression=1 on a vu des cas de ob_get_length() qui renvoi 0 |
|
| 107 | + // et du coup en renvoi un status 204 a tort (vu sur le menu rubriques notamment) |
|
| 108 | + if (!headers_sent() && !ob_get_length()) { |
|
| 109 | + http_response_code(204); |
|
| 110 | + } // No Content |
|
| 111 | + return true; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - return false; |
|
| 114 | + return false; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | function refuser_traiter_formulaire_ajax() { |
| 119 | - if ( |
|
| 120 | - ($v = _request('var_ajax')) |
|
| 121 | - && $v == 'form' |
|
| 122 | - && ($form = _request('formulaire_action')) |
|
| 123 | - && ($args = _request('formulaire_action_args')) |
|
| 124 | - && decoder_contexte_ajax($args, $form) !== false |
|
| 125 | - ) { |
|
| 126 | - // on est bien dans le contexte de traitement d'un formulaire en ajax |
|
| 127 | - // mais traiter ne veut pas |
|
| 128 | - // on le dit a la page qui va resumbit |
|
| 129 | - // sans ajax |
|
| 130 | - include_spip('inc/actions'); |
|
| 131 | - ajax_retour('noajax', false); |
|
| 132 | - exit; |
|
| 133 | - } |
|
| 119 | + if ( |
|
| 120 | + ($v = _request('var_ajax')) |
|
| 121 | + && $v == 'form' |
|
| 122 | + && ($form = _request('formulaire_action')) |
|
| 123 | + && ($args = _request('formulaire_action_args')) |
|
| 124 | + && decoder_contexte_ajax($args, $form) !== false |
|
| 125 | + ) { |
|
| 126 | + // on est bien dans le contexte de traitement d'un formulaire en ajax |
|
| 127 | + // mais traiter ne veut pas |
|
| 128 | + // on le dit a la page qui va resumbit |
|
| 129 | + // sans ajax |
|
| 130 | + include_spip('inc/actions'); |
|
| 131 | + ajax_retour('noajax', false); |
|
| 132 | + exit; |
|
| 133 | + } |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | function traiter_appels_inclusions_ajax() { |
| 137 | - // traiter les appels de bloc ajax (ex: pagination) |
|
| 138 | - if ( |
|
| 139 | - ($v = _request('var_ajax')) |
|
| 140 | - && $v !== 'form' |
|
| 141 | - && ($args = _request('var_ajax_env')) |
|
| 142 | - ) { |
|
| 143 | - include_spip('inc/filtres'); |
|
| 144 | - include_spip('inc/actions'); |
|
| 145 | - if ( |
|
| 146 | - ($args = decoder_contexte_ajax($args)) && ($fond = $args['fond']) |
|
| 147 | - ) { |
|
| 148 | - include_spip('public/assembler'); |
|
| 149 | - $contexte = calculer_contexte(); |
|
| 150 | - $contexte = array_merge($args, $contexte); |
|
| 151 | - $page = recuperer_fond($fond, $contexte, ['trim' => false]); |
|
| 152 | - $texte = $page; |
|
| 153 | - if ($ancre = _request('var_ajax_ancre')) { |
|
| 154 | - // pas n'importe quoi quand meme dans la variable ! |
|
| 155 | - $ancre = str_replace(['<', '"', "'"], ['<', '"', ''], $ancre); |
|
| 156 | - $texte = "<a href='#$ancre' name='ajax_ancre' style='display:none;'>anchor</a>" . $texte; |
|
| 157 | - } |
|
| 158 | - } else { |
|
| 159 | - include_spip('inc/headers'); |
|
| 160 | - http_response_code(400); |
|
| 161 | - $texte = _L('signature ajax bloc incorrecte'); |
|
| 162 | - } |
|
| 163 | - ajax_retour($texte, false); |
|
| 137 | + // traiter les appels de bloc ajax (ex: pagination) |
|
| 138 | + if ( |
|
| 139 | + ($v = _request('var_ajax')) |
|
| 140 | + && $v !== 'form' |
|
| 141 | + && ($args = _request('var_ajax_env')) |
|
| 142 | + ) { |
|
| 143 | + include_spip('inc/filtres'); |
|
| 144 | + include_spip('inc/actions'); |
|
| 145 | + if ( |
|
| 146 | + ($args = decoder_contexte_ajax($args)) && ($fond = $args['fond']) |
|
| 147 | + ) { |
|
| 148 | + include_spip('public/assembler'); |
|
| 149 | + $contexte = calculer_contexte(); |
|
| 150 | + $contexte = array_merge($args, $contexte); |
|
| 151 | + $page = recuperer_fond($fond, $contexte, ['trim' => false]); |
|
| 152 | + $texte = $page; |
|
| 153 | + if ($ancre = _request('var_ajax_ancre')) { |
|
| 154 | + // pas n'importe quoi quand meme dans la variable ! |
|
| 155 | + $ancre = str_replace(['<', '"', "'"], ['<', '"', ''], $ancre); |
|
| 156 | + $texte = "<a href='#$ancre' name='ajax_ancre' style='display:none;'>anchor</a>" . $texte; |
|
| 157 | + } |
|
| 158 | + } else { |
|
| 159 | + include_spip('inc/headers'); |
|
| 160 | + http_response_code(400); |
|
| 161 | + $texte = _L('signature ajax bloc incorrecte'); |
|
| 162 | + } |
|
| 163 | + ajax_retour($texte, false); |
|
| 164 | 164 | |
| 165 | - return true; // on a fini le hit |
|
| 166 | - } |
|
| 165 | + return true; // on a fini le hit |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - return false; |
|
| 168 | + return false; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | // au 1er appel, traite les formulaires dynamiques charger/verifier/traiter |
@@ -173,172 +173,172 @@ discard block |
||
| 173 | 173 | // Le 1er renvoie True si il faut faire exit a la sortie |
| 174 | 174 | |
| 175 | 175 | function traiter_formulaires_dynamiques($get = false) { |
| 176 | - static $post = []; |
|
| 177 | - static $done = false; |
|
| 176 | + static $post = []; |
|
| 177 | + static $done = false; |
|
| 178 | 178 | |
| 179 | - if ($get) { |
|
| 180 | - return $post; |
|
| 181 | - } |
|
| 182 | - if ($done) { |
|
| 183 | - return false; |
|
| 184 | - } |
|
| 185 | - $done = true; |
|
| 179 | + if ($get) { |
|
| 180 | + return $post; |
|
| 181 | + } |
|
| 182 | + if ($done) { |
|
| 183 | + return false; |
|
| 184 | + } |
|
| 185 | + $done = true; |
|
| 186 | 186 | |
| 187 | - if ( |
|
| 188 | - !(($form = _request('formulaire_action')) |
|
| 189 | - && ($args = _request('formulaire_action_args'))) |
|
| 190 | - ) { |
|
| 191 | - return false; |
|
| 192 | - } // le hit peut continuer normalement |
|
| 187 | + if ( |
|
| 188 | + !(($form = _request('formulaire_action')) |
|
| 189 | + && ($args = _request('formulaire_action_args'))) |
|
| 190 | + ) { |
|
| 191 | + return false; |
|
| 192 | + } // le hit peut continuer normalement |
|
| 193 | 193 | |
| 194 | - // verifier que le post est licite (du meme auteur ou d'une session anonyme) |
|
| 195 | - $sign = _request('formulaire_action_sign'); |
|
| 196 | - if (!empty($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 197 | - if (empty($sign)) { |
|
| 198 | - spip_log("signature ajax form incorrecte : $form (formulaire non signe mais on a une session)", 'formulaires' . _LOG_ERREUR); |
|
| 199 | - return false; |
|
| 200 | - } |
|
| 201 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 202 | - $secu = $securiser_action($form, $args, '', -1); |
|
| 203 | - if ($sign !== $secu['hash']) { |
|
| 204 | - spip_log("signature ajax form incorrecte : $form (formulaire signe mais ne correspond pas a la session)", 'formulaires' . _LOG_ERREUR); |
|
| 205 | - return false; |
|
| 206 | - } |
|
| 207 | - } |
|
| 208 | - else { |
|
| 209 | - if (!empty($sign)) { |
|
| 210 | - spip_log("signature ajax form incorrecte : $form (formulaire signe mais pas de session)", 'formulaires' . _LOG_ERREUR); |
|
| 211 | - return false; |
|
| 212 | - } |
|
| 213 | - } |
|
| 194 | + // verifier que le post est licite (du meme auteur ou d'une session anonyme) |
|
| 195 | + $sign = _request('formulaire_action_sign'); |
|
| 196 | + if (!empty($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 197 | + if (empty($sign)) { |
|
| 198 | + spip_log("signature ajax form incorrecte : $form (formulaire non signe mais on a une session)", 'formulaires' . _LOG_ERREUR); |
|
| 199 | + return false; |
|
| 200 | + } |
|
| 201 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 202 | + $secu = $securiser_action($form, $args, '', -1); |
|
| 203 | + if ($sign !== $secu['hash']) { |
|
| 204 | + spip_log("signature ajax form incorrecte : $form (formulaire signe mais ne correspond pas a la session)", 'formulaires' . _LOG_ERREUR); |
|
| 205 | + return false; |
|
| 206 | + } |
|
| 207 | + } |
|
| 208 | + else { |
|
| 209 | + if (!empty($sign)) { |
|
| 210 | + spip_log("signature ajax form incorrecte : $form (formulaire signe mais pas de session)", 'formulaires' . _LOG_ERREUR); |
|
| 211 | + return false; |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - include_spip('inc/filtres'); |
|
| 216 | - if (($args = decoder_contexte_ajax($args, $form)) === false) { |
|
| 217 | - spip_log("signature ajax form incorrecte : $form (encodage corrompu)", 'formulaires' . _LOG_ERREUR); |
|
| 215 | + include_spip('inc/filtres'); |
|
| 216 | + if (($args = decoder_contexte_ajax($args, $form)) === false) { |
|
| 217 | + spip_log("signature ajax form incorrecte : $form (encodage corrompu)", 'formulaires' . _LOG_ERREUR); |
|
| 218 | 218 | |
| 219 | - return false; // continuons le hit comme si de rien etait |
|
| 220 | - } else { |
|
| 221 | - include_spip('inc/lang'); |
|
| 222 | - // sauvegarder la lang en cours |
|
| 223 | - $old_lang = $GLOBALS['spip_lang']; |
|
| 224 | - // changer la langue avec celle qui a cours dans le formulaire |
|
| 225 | - // on la depile de $args car c'est un argument implicite masque |
|
| 226 | - changer_langue(array_shift($args)); |
|
| 219 | + return false; // continuons le hit comme si de rien etait |
|
| 220 | + } else { |
|
| 221 | + include_spip('inc/lang'); |
|
| 222 | + // sauvegarder la lang en cours |
|
| 223 | + $old_lang = $GLOBALS['spip_lang']; |
|
| 224 | + // changer la langue avec celle qui a cours dans le formulaire |
|
| 225 | + // on la depile de $args car c'est un argument implicite masque |
|
| 226 | + changer_langue(array_shift($args)); |
|
| 227 | 227 | |
| 228 | 228 | |
| 229 | - // inclure mes_fonctions et autres filtres avant verifier/traiter |
|
| 230 | - include_fichiers_fonctions(); |
|
| 231 | - // ainsi que l'API SQL bien utile dans verifier/traiter |
|
| 232 | - include_spip('base/abstract_sql'); |
|
| 229 | + // inclure mes_fonctions et autres filtres avant verifier/traiter |
|
| 230 | + include_fichiers_fonctions(); |
|
| 231 | + // ainsi que l'API SQL bien utile dans verifier/traiter |
|
| 232 | + include_spip('base/abstract_sql'); |
|
| 233 | 233 | |
| 234 | - /** |
|
| 235 | - * Pipeline exécuté lors de la soumission d'un formulaire, |
|
| 236 | - * mais avant l'appel de la fonction de vérification. |
|
| 237 | - */ |
|
| 238 | - pipeline( |
|
| 239 | - 'formulaire_receptionner', |
|
| 240 | - [ |
|
| 241 | - 'args' => ['form' => $form, 'args' => $args], |
|
| 242 | - 'data' => null, |
|
| 243 | - ] |
|
| 244 | - ); |
|
| 234 | + /** |
|
| 235 | + * Pipeline exécuté lors de la soumission d'un formulaire, |
|
| 236 | + * mais avant l'appel de la fonction de vérification. |
|
| 237 | + */ |
|
| 238 | + pipeline( |
|
| 239 | + 'formulaire_receptionner', |
|
| 240 | + [ |
|
| 241 | + 'args' => ['form' => $form, 'args' => $args], |
|
| 242 | + 'data' => null, |
|
| 243 | + ] |
|
| 244 | + ); |
|
| 245 | 245 | |
| 246 | - $verifier = charger_fonction('verifier', "formulaires/$form/", true); |
|
| 247 | - $post["erreurs_$form"] = pipeline( |
|
| 248 | - 'formulaire_verifier', |
|
| 249 | - [ |
|
| 250 | - 'args' => ['form' => $form, 'args' => $args], |
|
| 251 | - 'data' => $verifier ? $verifier(...$args) : [] |
|
| 252 | - ] |
|
| 253 | - ); |
|
| 254 | - // prise en charge CVT multi etape si besoin |
|
| 255 | - if (_request('cvtm_prev_post')) { |
|
| 256 | - include_spip('inc/cvt_multietapes'); |
|
| 257 | - $post["erreurs_$form"] = cvtmulti_formulaire_verifier_etapes( |
|
| 258 | - ['form' => $form, 'args' => $args], |
|
| 259 | - $post["erreurs_$form"] |
|
| 260 | - ); |
|
| 261 | - } |
|
| 246 | + $verifier = charger_fonction('verifier', "formulaires/$form/", true); |
|
| 247 | + $post["erreurs_$form"] = pipeline( |
|
| 248 | + 'formulaire_verifier', |
|
| 249 | + [ |
|
| 250 | + 'args' => ['form' => $form, 'args' => $args], |
|
| 251 | + 'data' => $verifier ? $verifier(...$args) : [] |
|
| 252 | + ] |
|
| 253 | + ); |
|
| 254 | + // prise en charge CVT multi etape si besoin |
|
| 255 | + if (_request('cvtm_prev_post')) { |
|
| 256 | + include_spip('inc/cvt_multietapes'); |
|
| 257 | + $post["erreurs_$form"] = cvtmulti_formulaire_verifier_etapes( |
|
| 258 | + ['form' => $form, 'args' => $args], |
|
| 259 | + $post["erreurs_$form"] |
|
| 260 | + ); |
|
| 261 | + } |
|
| 262 | 262 | |
| 263 | - // accessibilite : si des erreurs mais pas de message general l'ajouter |
|
| 264 | - if (isset($post["erreurs_$form"]) && (is_countable($post["erreurs_$form"]) ? count($post["erreurs_$form"]) : 0) && !isset($post["erreurs_$form"]['message_erreur'])) { |
|
| 265 | - $post["erreurs_$form"]['message_erreur'] = singulier_ou_pluriel( |
|
| 266 | - is_countable($post["erreurs_$form"]) ? count($post["erreurs_$form"]) : 0, |
|
| 267 | - 'avis_1_erreur_saisie', |
|
| 268 | - 'avis_nb_erreurs_saisie' |
|
| 269 | - ); |
|
| 270 | - } |
|
| 263 | + // accessibilite : si des erreurs mais pas de message general l'ajouter |
|
| 264 | + if (isset($post["erreurs_$form"]) && (is_countable($post["erreurs_$form"]) ? count($post["erreurs_$form"]) : 0) && !isset($post["erreurs_$form"]['message_erreur'])) { |
|
| 265 | + $post["erreurs_$form"]['message_erreur'] = singulier_ou_pluriel( |
|
| 266 | + is_countable($post["erreurs_$form"]) ? count($post["erreurs_$form"]) : 0, |
|
| 267 | + 'avis_1_erreur_saisie', |
|
| 268 | + 'avis_nb_erreurs_saisie' |
|
| 269 | + ); |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | - // si on ne demandait qu'une verif json |
|
| 273 | - if (_request('formulaire_action_verifier_json')) { |
|
| 274 | - include_spip('inc/json'); |
|
| 275 | - include_spip('inc/actions'); |
|
| 276 | - ajax_retour(json_encode($post["erreurs_$form"], JSON_THROW_ON_ERROR), 'text/plain'); |
|
| 272 | + // si on ne demandait qu'une verif json |
|
| 273 | + if (_request('formulaire_action_verifier_json')) { |
|
| 274 | + include_spip('inc/json'); |
|
| 275 | + include_spip('inc/actions'); |
|
| 276 | + ajax_retour(json_encode($post["erreurs_$form"], JSON_THROW_ON_ERROR), 'text/plain'); |
|
| 277 | 277 | |
| 278 | - return true; // on a fini le hit |
|
| 279 | - } |
|
| 280 | - $retour = ''; |
|
| 281 | - if (isset($post["erreurs_$form"]) && (is_countable($post["erreurs_$form"]) ? count($post["erreurs_$form"]) : 0) == 0) { |
|
| 282 | - $rev = ''; |
|
| 283 | - if ($traiter = charger_fonction('traiter', "formulaires/$form/", true)) { |
|
| 284 | - $rev = $traiter(...$args); |
|
| 285 | - } |
|
| 278 | + return true; // on a fini le hit |
|
| 279 | + } |
|
| 280 | + $retour = ''; |
|
| 281 | + if (isset($post["erreurs_$form"]) && (is_countable($post["erreurs_$form"]) ? count($post["erreurs_$form"]) : 0) == 0) { |
|
| 282 | + $rev = ''; |
|
| 283 | + if ($traiter = charger_fonction('traiter', "formulaires/$form/", true)) { |
|
| 284 | + $rev = $traiter(...$args); |
|
| 285 | + } |
|
| 286 | 286 | |
| 287 | - $rev = pipeline( |
|
| 288 | - 'formulaire_traiter', |
|
| 289 | - [ |
|
| 290 | - 'args' => ['form' => $form, 'args' => $args], |
|
| 291 | - 'data' => $rev |
|
| 292 | - ] |
|
| 293 | - ); |
|
| 294 | - // le retour de traiter est |
|
| 295 | - // un tableau explicite ('editable'=>$editable,'message_ok'=>$message,'redirect'=>$redirect,'id_xx'=>$id_xx) |
|
| 296 | - // il permet le pipelinage, en particulier |
|
| 297 | - // en y passant l'id de l'objet cree/modifie |
|
| 298 | - // si message_erreur est present, on considere que le traitement a echoue |
|
| 299 | - $post["message_ok_$form"] = ''; |
|
| 300 | - // on peut avoir message_ok et message_erreur |
|
| 301 | - if (isset($rev['message_ok'])) { |
|
| 302 | - $post["message_ok_$form"] = $rev['message_ok']; |
|
| 303 | - } |
|
| 287 | + $rev = pipeline( |
|
| 288 | + 'formulaire_traiter', |
|
| 289 | + [ |
|
| 290 | + 'args' => ['form' => $form, 'args' => $args], |
|
| 291 | + 'data' => $rev |
|
| 292 | + ] |
|
| 293 | + ); |
|
| 294 | + // le retour de traiter est |
|
| 295 | + // un tableau explicite ('editable'=>$editable,'message_ok'=>$message,'redirect'=>$redirect,'id_xx'=>$id_xx) |
|
| 296 | + // il permet le pipelinage, en particulier |
|
| 297 | + // en y passant l'id de l'objet cree/modifie |
|
| 298 | + // si message_erreur est present, on considere que le traitement a echoue |
|
| 299 | + $post["message_ok_$form"] = ''; |
|
| 300 | + // on peut avoir message_ok et message_erreur |
|
| 301 | + if (isset($rev['message_ok'])) { |
|
| 302 | + $post["message_ok_$form"] = $rev['message_ok']; |
|
| 303 | + } |
|
| 304 | 304 | |
| 305 | - // verifier si traiter n'a pas echoue avec une erreur : |
|
| 306 | - if (isset($rev['message_erreur'])) { |
|
| 307 | - $post["erreurs_$form"]['message_erreur'] = $rev['message_erreur']; |
|
| 308 | - // si il y a une erreur on ne redirige pas |
|
| 309 | - } else { |
|
| 310 | - // sinon faire ce qu'il faut : |
|
| 311 | - if (isset($rev['editable'])) { |
|
| 312 | - $post["editable_$form"] = $rev['editable']; |
|
| 313 | - } |
|
| 314 | - // si une redirection est demandee, appeler redirigae_formulaire qui choisira |
|
| 315 | - // le bon mode de redirection (302 et on ne revient pas ici, ou javascript et on continue) |
|
| 316 | - if (isset($rev['redirect']) && $rev['redirect']) { |
|
| 317 | - include_spip('inc/headers'); |
|
| 318 | - [$masque, $message] = redirige_formulaire($rev['redirect'], '', 'ajaxform'); |
|
| 319 | - $post["message_ok_$form"] .= $message; |
|
| 320 | - $retour .= $masque; |
|
| 321 | - } |
|
| 322 | - } |
|
| 323 | - } |
|
| 324 | - // si le formulaire a ete soumis en ajax, on le renvoie direct ! |
|
| 325 | - if (_request('var_ajax')) { |
|
| 326 | - if (find_in_path('formulaire_.php', 'balise/', true)) { |
|
| 327 | - include_spip('inc/actions'); |
|
| 328 | - include_spip('public/assembler'); |
|
| 329 | - $retour .= inclure_balise_dynamique(balise_formulaire__dyn($form, ...$args), false); |
|
| 330 | - // on ajoute un br en display none en tete du retour ajax pour regler un bug dans IE6/7 |
|
| 331 | - // sans cela le formulaire n'est pas actif apres le hit ajax |
|
| 332 | - // la classe ajax-form-is-ok sert a s'assurer que le retour ajax s'est bien passe |
|
| 333 | - $retour = "<br class='bugajaxie ajax-form-is-ok' style='display:none;'/>" . $retour; |
|
| 334 | - ajax_retour($retour, false); |
|
| 305 | + // verifier si traiter n'a pas echoue avec une erreur : |
|
| 306 | + if (isset($rev['message_erreur'])) { |
|
| 307 | + $post["erreurs_$form"]['message_erreur'] = $rev['message_erreur']; |
|
| 308 | + // si il y a une erreur on ne redirige pas |
|
| 309 | + } else { |
|
| 310 | + // sinon faire ce qu'il faut : |
|
| 311 | + if (isset($rev['editable'])) { |
|
| 312 | + $post["editable_$form"] = $rev['editable']; |
|
| 313 | + } |
|
| 314 | + // si une redirection est demandee, appeler redirigae_formulaire qui choisira |
|
| 315 | + // le bon mode de redirection (302 et on ne revient pas ici, ou javascript et on continue) |
|
| 316 | + if (isset($rev['redirect']) && $rev['redirect']) { |
|
| 317 | + include_spip('inc/headers'); |
|
| 318 | + [$masque, $message] = redirige_formulaire($rev['redirect'], '', 'ajaxform'); |
|
| 319 | + $post["message_ok_$form"] .= $message; |
|
| 320 | + $retour .= $masque; |
|
| 321 | + } |
|
| 322 | + } |
|
| 323 | + } |
|
| 324 | + // si le formulaire a ete soumis en ajax, on le renvoie direct ! |
|
| 325 | + if (_request('var_ajax')) { |
|
| 326 | + if (find_in_path('formulaire_.php', 'balise/', true)) { |
|
| 327 | + include_spip('inc/actions'); |
|
| 328 | + include_spip('public/assembler'); |
|
| 329 | + $retour .= inclure_balise_dynamique(balise_formulaire__dyn($form, ...$args), false); |
|
| 330 | + // on ajoute un br en display none en tete du retour ajax pour regler un bug dans IE6/7 |
|
| 331 | + // sans cela le formulaire n'est pas actif apres le hit ajax |
|
| 332 | + // la classe ajax-form-is-ok sert a s'assurer que le retour ajax s'est bien passe |
|
| 333 | + $retour = "<br class='bugajaxie ajax-form-is-ok' style='display:none;'/>" . $retour; |
|
| 334 | + ajax_retour($retour, false); |
|
| 335 | 335 | |
| 336 | - return true; // on a fini le hit |
|
| 337 | - } |
|
| 338 | - } |
|
| 339 | - // restaurer la lang en cours |
|
| 340 | - changer_langue($old_lang); |
|
| 341 | - } |
|
| 336 | + return true; // on a fini le hit |
|
| 337 | + } |
|
| 338 | + } |
|
| 339 | + // restaurer la lang en cours |
|
| 340 | + changer_langue($old_lang); |
|
| 341 | + } |
|
| 342 | 342 | |
| 343 | - return false; // le hit peut continuer normalement |
|
| 343 | + return false; // le hit peut continuer normalement |
|
| 344 | 344 | } |
@@ -5,226 +5,226 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | return [ |
| 7 | 7 | |
| 8 | - // A |
|
| 9 | - 'access_interface_graphique' => 'Powrót do pełnego interfejsu graficznego', |
|
| 10 | - 'access_mode_texte' => 'Uproszczony interfejs - tryb tekstowy', |
|
| 11 | - 'admin_debug' => 'debug', |
|
| 12 | - 'admin_modifier_article' => 'Modyfikuj artykuł', |
|
| 13 | - 'admin_modifier_auteur' => 'Modyfikuj autora', |
|
| 14 | - 'admin_modifier_breve' => 'Modyfikuj news', |
|
| 15 | - 'admin_modifier_mot' => 'Modyfikuj słowo kluczowe', |
|
| 16 | - 'admin_modifier_rubrique' => 'Modyfikuj dział', |
|
| 17 | - 'admin_recalculer' => 'Odśwież ', |
|
| 18 | - 'afficher_calendrier' => 'Wyświetl kalendarz', |
|
| 19 | - 'afficher_trad' => 'pokaż przekłady', |
|
| 20 | - 'alerte_maj_impossible' => '<b>Uwaga!</b> Uaktualnienie bazy danych SQL do wersji @version@ jest nie możliwe. Powodem jest prawdopodobnie brak uprawnień do modyfikacji bazy danych. Skontaktuj się z administratorem lub firmą hostingową.', |
|
| 21 | - 'alerte_modif_info_concourante' => 'UWAGA: Ta informacja była zmieniana w innym miejscu. Obecna wartość to:Cette information a été modifiée par ailleurs. La valeur actuelle est :', |
|
| 22 | - 'analyse_xml' => 'Analiza XML', |
|
| 23 | - 'annuler' => 'Anuluj', |
|
| 24 | - 'antispam_champ_vide' => 'Pozostaw puste:', |
|
| 25 | - 'articles_recents' => 'Najnowsze artykuły', |
|
| 26 | - 'avis_archive_incorrect' => 'ten plik archiwalny nie należy do SPIP', |
|
| 27 | - 'avis_archive_invalide' => 'plik archiwalny jest nieprawidłowy', |
|
| 28 | - 'avis_attention' => 'UWAGA !', |
|
| 29 | - 'avis_champ_incorrect_type_objet' => 'Nieprawiłowa nazwa pola @name@ dla obiektu typu @type@', |
|
| 30 | - 'avis_colonne_inexistante' => 'Kolumna @col@ nie istnieje', |
|
| 31 | - 'avis_erreur' => 'Błąd: zobacz poniżej’;', |
|
| 32 | - 'avis_erreur_connexion' => 'Błąd połączenia', |
|
| 33 | - 'avis_erreur_cookie' => 'problem z cookie', |
|
| 34 | - 'avis_erreur_fonction_contexte' => 'Błąd programistyczny. Ta funkcja nie powinna być wywoływana w tym kontekście.', |
|
| 35 | - 'avis_erreur_mysql' => 'Błąd SQL', |
|
| 36 | - 'avis_erreur_sauvegarde' => 'Błąd archiwizacji (@type@ @id_objet@)!', |
|
| 37 | - 'avis_erreur_visiteur' => 'Problem z dostępem do stron administracyjnych', |
|
| 8 | + // A |
|
| 9 | + 'access_interface_graphique' => 'Powrót do pełnego interfejsu graficznego', |
|
| 10 | + 'access_mode_texte' => 'Uproszczony interfejs - tryb tekstowy', |
|
| 11 | + 'admin_debug' => 'debug', |
|
| 12 | + 'admin_modifier_article' => 'Modyfikuj artykuł', |
|
| 13 | + 'admin_modifier_auteur' => 'Modyfikuj autora', |
|
| 14 | + 'admin_modifier_breve' => 'Modyfikuj news', |
|
| 15 | + 'admin_modifier_mot' => 'Modyfikuj słowo kluczowe', |
|
| 16 | + 'admin_modifier_rubrique' => 'Modyfikuj dział', |
|
| 17 | + 'admin_recalculer' => 'Odśwież ', |
|
| 18 | + 'afficher_calendrier' => 'Wyświetl kalendarz', |
|
| 19 | + 'afficher_trad' => 'pokaż przekłady', |
|
| 20 | + 'alerte_maj_impossible' => '<b>Uwaga!</b> Uaktualnienie bazy danych SQL do wersji @version@ jest nie możliwe. Powodem jest prawdopodobnie brak uprawnień do modyfikacji bazy danych. Skontaktuj się z administratorem lub firmą hostingową.', |
|
| 21 | + 'alerte_modif_info_concourante' => 'UWAGA: Ta informacja była zmieniana w innym miejscu. Obecna wartość to:Cette information a été modifiée par ailleurs. La valeur actuelle est :', |
|
| 22 | + 'analyse_xml' => 'Analiza XML', |
|
| 23 | + 'annuler' => 'Anuluj', |
|
| 24 | + 'antispam_champ_vide' => 'Pozostaw puste:', |
|
| 25 | + 'articles_recents' => 'Najnowsze artykuły', |
|
| 26 | + 'avis_archive_incorrect' => 'ten plik archiwalny nie należy do SPIP', |
|
| 27 | + 'avis_archive_invalide' => 'plik archiwalny jest nieprawidłowy', |
|
| 28 | + 'avis_attention' => 'UWAGA !', |
|
| 29 | + 'avis_champ_incorrect_type_objet' => 'Nieprawiłowa nazwa pola @name@ dla obiektu typu @type@', |
|
| 30 | + 'avis_colonne_inexistante' => 'Kolumna @col@ nie istnieje', |
|
| 31 | + 'avis_erreur' => 'Błąd: zobacz poniżej’;', |
|
| 32 | + 'avis_erreur_connexion' => 'Błąd połączenia', |
|
| 33 | + 'avis_erreur_cookie' => 'problem z cookie', |
|
| 34 | + 'avis_erreur_fonction_contexte' => 'Błąd programistyczny. Ta funkcja nie powinna być wywoływana w tym kontekście.', |
|
| 35 | + 'avis_erreur_mysql' => 'Błąd SQL', |
|
| 36 | + 'avis_erreur_sauvegarde' => 'Błąd archiwizacji (@type@ @id_objet@)!', |
|
| 37 | + 'avis_erreur_visiteur' => 'Problem z dostępem do stron administracyjnych', |
|
| 38 | 38 | |
| 39 | - // B |
|
| 40 | - 'barre_a_accent_grave' => 'Wstaw dużą literę A z akcentem grave', |
|
| 41 | - 'barre_aide' => 'Użyj skrótów typograficznych do ulepszenia layoutu', |
|
| 42 | - 'barre_e_accent_aigu' => 'Wstaw dużą literę E z akcentem acute', |
|
| 43 | - 'barre_eo' => 'Wstaw ligaturę oe', |
|
| 44 | - 'barre_eo_maj' => 'Wstaw dużą ligaturę EO', |
|
| 45 | - 'barre_euro' => 'Umieść symbol €€', |
|
| 46 | - 'barre_gras' => 'Wstaw w {{boldzie}}', |
|
| 47 | - 'barre_guillemets' => 'Umieść w "cudzysłowie"', |
|
| 48 | - 'barre_guillemets_simples' => 'Umieść w innym “cudzysłowie”', |
|
| 49 | - 'barre_intertitre' => 'Przekształć w {{{śródtytuł}}}', |
|
| 50 | - 'barre_italic' => 'Wstaw w {italiku}', |
|
| 51 | - 'barre_lien' => 'Zmień w [hiperłącze->http://...]', |
|
| 52 | - 'barre_lien_input' => 'Proszę wpisać cel hiperłącza (może to być URL internetowy w formie http://www.mysite.com lub po prostu numer artykułu na tej stronie).', |
|
| 53 | - 'barre_note' => 'Zmień w [[Przypis]]', |
|
| 54 | - 'barre_paragraphe' => 'Utwórz paragraf', |
|
| 55 | - 'barre_quote' => '<quote>Zacytuj wiadomość</quote>', |
|
| 56 | - 'bouton_changer' => 'Zatwierdź', |
|
| 57 | - 'bouton_chercher' => 'Szukaj', |
|
| 58 | - 'bouton_choisir' => 'Wybierz', |
|
| 59 | - 'bouton_deplacer' => 'Przenieś', |
|
| 60 | - 'bouton_download' => 'Ściągnij', |
|
| 61 | - 'bouton_enregistrer' => 'Zapisz', |
|
| 62 | - 'bouton_radio_desactiver_messagerie_interne' => 'Dezaktywuj pocztę wewnętrzną', |
|
| 63 | - 'bouton_radio_envoi_annonces' => 'Wyślij ogłoszenia redakcyjne', |
|
| 64 | - 'bouton_radio_non_envoi_annonces' => 'Nie wysyłaj żadnych zawiadomień', |
|
| 65 | - 'bouton_radio_non_envoi_liste_nouveautes' => 'Nie wysyłaj najnowszej listy newsów', |
|
| 66 | - 'bouton_recharger_page' => 'ponownie załaduj tę stronę', |
|
| 67 | - 'bouton_telecharger' => 'Załaduj', |
|
| 68 | - 'bouton_upload' => 'Załaduj', |
|
| 69 | - 'bouton_valider' => 'Zatwierdź', |
|
| 39 | + // B |
|
| 40 | + 'barre_a_accent_grave' => 'Wstaw dużą literę A z akcentem grave', |
|
| 41 | + 'barre_aide' => 'Użyj skrótów typograficznych do ulepszenia layoutu', |
|
| 42 | + 'barre_e_accent_aigu' => 'Wstaw dużą literę E z akcentem acute', |
|
| 43 | + 'barre_eo' => 'Wstaw ligaturę oe', |
|
| 44 | + 'barre_eo_maj' => 'Wstaw dużą ligaturę EO', |
|
| 45 | + 'barre_euro' => 'Umieść symbol €€', |
|
| 46 | + 'barre_gras' => 'Wstaw w {{boldzie}}', |
|
| 47 | + 'barre_guillemets' => 'Umieść w "cudzysłowie"', |
|
| 48 | + 'barre_guillemets_simples' => 'Umieść w innym “cudzysłowie”', |
|
| 49 | + 'barre_intertitre' => 'Przekształć w {{{śródtytuł}}}', |
|
| 50 | + 'barre_italic' => 'Wstaw w {italiku}', |
|
| 51 | + 'barre_lien' => 'Zmień w [hiperłącze->http://...]', |
|
| 52 | + 'barre_lien_input' => 'Proszę wpisać cel hiperłącza (może to być URL internetowy w formie http://www.mysite.com lub po prostu numer artykułu na tej stronie).', |
|
| 53 | + 'barre_note' => 'Zmień w [[Przypis]]', |
|
| 54 | + 'barre_paragraphe' => 'Utwórz paragraf', |
|
| 55 | + 'barre_quote' => '<quote>Zacytuj wiadomość</quote>', |
|
| 56 | + 'bouton_changer' => 'Zatwierdź', |
|
| 57 | + 'bouton_chercher' => 'Szukaj', |
|
| 58 | + 'bouton_choisir' => 'Wybierz', |
|
| 59 | + 'bouton_deplacer' => 'Przenieś', |
|
| 60 | + 'bouton_download' => 'Ściągnij', |
|
| 61 | + 'bouton_enregistrer' => 'Zapisz', |
|
| 62 | + 'bouton_radio_desactiver_messagerie_interne' => 'Dezaktywuj pocztę wewnętrzną', |
|
| 63 | + 'bouton_radio_envoi_annonces' => 'Wyślij ogłoszenia redakcyjne', |
|
| 64 | + 'bouton_radio_non_envoi_annonces' => 'Nie wysyłaj żadnych zawiadomień', |
|
| 65 | + 'bouton_radio_non_envoi_liste_nouveautes' => 'Nie wysyłaj najnowszej listy newsów', |
|
| 66 | + 'bouton_recharger_page' => 'ponownie załaduj tę stronę', |
|
| 67 | + 'bouton_telecharger' => 'Załaduj', |
|
| 68 | + 'bouton_upload' => 'Załaduj', |
|
| 69 | + 'bouton_valider' => 'Zatwierdź', |
|
| 70 | 70 | |
| 71 | - // C |
|
| 72 | - 'cal_apresmidi' => 'popołudniu', |
|
| 73 | - 'cal_jour_entier' => 'cały dzień', |
|
| 74 | - 'cal_matin' => 'rano', |
|
| 75 | - 'cal_par_jour' => 'wg dni', |
|
| 76 | - 'cal_par_mois' => 'wg miesięcy', |
|
| 77 | - 'cal_par_semaine' => 'wg tygodni', |
|
| 78 | - 'choix_couleur_interface' => 'kolor', |
|
| 79 | - 'choix_interface' => 'wybór interfejsu', |
|
| 80 | - 'colonne' => 'Kolumna', |
|
| 81 | - 'confirm_changer_statut' => 'Uwaga, czy na pewno chcesz zmienić status tego elementu ? Kontynuować ?', |
|
| 82 | - 'correcte' => 'poprawna', |
|
| 71 | + // C |
|
| 72 | + 'cal_apresmidi' => 'popołudniu', |
|
| 73 | + 'cal_jour_entier' => 'cały dzień', |
|
| 74 | + 'cal_matin' => 'rano', |
|
| 75 | + 'cal_par_jour' => 'wg dni', |
|
| 76 | + 'cal_par_mois' => 'wg miesięcy', |
|
| 77 | + 'cal_par_semaine' => 'wg tygodni', |
|
| 78 | + 'choix_couleur_interface' => 'kolor', |
|
| 79 | + 'choix_interface' => 'wybór interfejsu', |
|
| 80 | + 'colonne' => 'Kolumna', |
|
| 81 | + 'confirm_changer_statut' => 'Uwaga, czy na pewno chcesz zmienić status tego elementu ? Kontynuować ?', |
|
| 82 | + 'correcte' => 'poprawna', |
|
| 83 | 83 | |
| 84 | - // D |
|
| 85 | - 'date_aujourdhui' => 'dziś', |
|
| 86 | - 'date_avant_jc' => 'P.N.E.', |
|
| 87 | - 'date_dans' => 'w @delai@', |
|
| 88 | - 'date_de_mois_1' => '@j@ stycznia', |
|
| 89 | - 'date_de_mois_10' => '@j@ października', |
|
| 90 | - 'date_de_mois_11' => '@j@ listopada', |
|
| 91 | - 'date_de_mois_12' => '@j@ grudnia', |
|
| 92 | - 'date_de_mois_2' => '@j@ lutego', |
|
| 93 | - 'date_de_mois_3' => '@j@ marca', |
|
| 94 | - 'date_de_mois_4' => '@j@ kwietnia', |
|
| 95 | - 'date_de_mois_5' => '@j@ maja', |
|
| 96 | - 'date_de_mois_6' => '@j@ czerwca', |
|
| 97 | - 'date_de_mois_7' => '@j@ lipca', |
|
| 98 | - 'date_de_mois_8' => '@j@ sierpnia', |
|
| 99 | - 'date_de_mois_9' => '@j@ września', |
|
| 100 | - 'date_demain' => 'jutro', |
|
| 101 | - 'date_fmt_heures_minutes' => '@h@h@m@min', |
|
| 102 | - 'date_fmt_jour_heure' => '@jour@ o @heure@', |
|
| 103 | - 'date_fmt_jour_mois' => '@jourmois@', |
|
| 104 | - 'date_fmt_jour_mois_annee' => '@jourmois@ @annee@', |
|
| 105 | - 'date_fmt_mois_annee' => '@nommois@ @annee@', |
|
| 106 | - 'date_fmt_nomjour_date' => '@date@ @nomjour@ ', |
|
| 107 | - 'date_heures' => 'godziny', |
|
| 108 | - 'date_hier' => 'wczoraj', |
|
| 109 | - 'date_il_y_a' => 'jest @delai@', |
|
| 110 | - 'date_jnum1' => '1', |
|
| 111 | - 'date_jnum10' => '10', |
|
| 112 | - 'date_jnum11' => '11', |
|
| 113 | - 'date_jnum12' => '12', |
|
| 114 | - 'date_jnum13' => '13', |
|
| 115 | - 'date_jnum14' => '14', |
|
| 116 | - 'date_jnum15' => '15', |
|
| 117 | - 'date_jnum16' => '16', |
|
| 118 | - 'date_jnum17' => '17', |
|
| 119 | - 'date_jnum18' => '18', |
|
| 120 | - 'date_jnum19' => '19', |
|
| 121 | - 'date_jnum2' => '2', |
|
| 122 | - 'date_jnum20' => '20', |
|
| 123 | - 'date_jnum21' => '21', |
|
| 124 | - 'date_jnum22' => '22', |
|
| 125 | - 'date_jnum23' => '23', |
|
| 126 | - 'date_jnum24' => '24', |
|
| 127 | - 'date_jnum25' => '25', |
|
| 128 | - 'date_jnum26' => '26', |
|
| 129 | - 'date_jnum27' => '27', |
|
| 130 | - 'date_jnum28' => '28', |
|
| 131 | - 'date_jnum29' => '29', |
|
| 132 | - 'date_jnum3' => '3', |
|
| 133 | - 'date_jnum30' => '30', |
|
| 134 | - 'date_jnum31' => '31', |
|
| 135 | - 'date_jnum4' => '4', |
|
| 136 | - 'date_jnum5' => '5', |
|
| 137 | - 'date_jnum6' => '6', |
|
| 138 | - 'date_jnum7' => '7', |
|
| 139 | - 'date_jnum8' => '8', |
|
| 140 | - 'date_jnum9' => '9', |
|
| 141 | - 'date_jour_1' => 'Niedziela', |
|
| 142 | - 'date_jour_1_abbr' => 'nie.', |
|
| 143 | - 'date_jour_1_initiale' => 'n.', |
|
| 144 | - 'date_jour_2' => 'Poniedziałek', |
|
| 145 | - 'date_jour_2_abbr' => 'pon.', |
|
| 146 | - 'date_jour_2_initiale' => 'p.', |
|
| 147 | - 'date_jour_3' => 'Wtorek', |
|
| 148 | - 'date_jour_3_abbr' => 'wto.', |
|
| 149 | - 'date_jour_3_initiale' => 'w.', |
|
| 150 | - 'date_jour_4' => 'Środa', |
|
| 151 | - 'date_jour_4_abbr' => 'śro.', |
|
| 152 | - 'date_jour_4_initiale' => 'ś.', |
|
| 153 | - 'date_jour_5' => 'Czwartek', |
|
| 154 | - 'date_jour_5_abbr' => 'czw.', |
|
| 155 | - 'date_jour_5_initiale' => 'c.', |
|
| 156 | - 'date_jour_6' => 'Piątek', |
|
| 157 | - 'date_jour_6_abbr' => 'pią.', |
|
| 158 | - 'date_jour_6_initiale' => 'p.', |
|
| 159 | - 'date_jour_7' => 'Sobota', |
|
| 160 | - 'date_jour_7_abbr' => 'sob.', |
|
| 161 | - 'date_jour_7_initiale' => 's.', |
|
| 162 | - 'date_jours' => 'dni', |
|
| 163 | - 'date_minutes' => 'minuty', |
|
| 164 | - 'date_mois' => 'miesiąc', |
|
| 165 | - 'date_mois_1' => 'Styczeń', |
|
| 166 | - 'date_mois_10' => 'Październik', |
|
| 167 | - 'date_mois_10_abbr' => 'paźdź.', |
|
| 168 | - 'date_mois_11' => 'Listopad', |
|
| 169 | - 'date_mois_11_abbr' => 'list.', |
|
| 170 | - 'date_mois_12' => 'Grudzień', |
|
| 171 | - 'date_mois_12_abbr' => 'gru.', |
|
| 172 | - 'date_mois_1_abbr' => 'sty.', |
|
| 173 | - 'date_mois_2' => 'Luty', |
|
| 174 | - 'date_mois_2_abbr' => 'lut.', |
|
| 175 | - 'date_mois_3' => 'Marzec', |
|
| 176 | - 'date_mois_3_abbr' => 'mar.', |
|
| 177 | - 'date_mois_4' => 'Kwiecień', |
|
| 178 | - 'date_mois_4_abbr' => 'kw.', |
|
| 179 | - 'date_mois_5' => 'Maj', |
|
| 180 | - 'date_mois_5_abbr' => 'maj', |
|
| 181 | - 'date_mois_6' => 'Czerwiec', |
|
| 182 | - 'date_mois_6_abbr' => 'czer.', |
|
| 183 | - 'date_mois_7' => 'Lipiec', |
|
| 184 | - 'date_mois_7_abbr' => 'lip.', |
|
| 185 | - 'date_mois_8' => 'Sierpień', |
|
| 186 | - 'date_mois_8_abbr' => 'sie.', |
|
| 187 | - 'date_mois_9' => 'Wrzesień', |
|
| 188 | - 'date_mois_9_abbr' => 'wrz.', |
|
| 189 | - 'date_saison_1' => 'zima', |
|
| 190 | - 'date_saison_2' => 'wiosna', |
|
| 191 | - 'date_saison_3' => 'lato', |
|
| 192 | - 'date_saison_4' => 'jesień', |
|
| 193 | - 'date_secondes' => 'sekundy', |
|
| 194 | - 'date_semaines' => 'tygodnie', |
|
| 195 | - 'date_un_mois' => 'miesiące', |
|
| 196 | - 'date_une_heure' => 'godzina', |
|
| 197 | - 'date_une_minute' => 'minuta', |
|
| 198 | - 'date_une_seconde' => 'sekunda', |
|
| 199 | - 'date_une_semaine' => 'tydzień', |
|
| 200 | - 'dirs_commencer' => ' w celu rzeczywistego rozpoczęcia instalacji', |
|
| 201 | - 'dirs_preliminaire' => 'Wstęp: <b>Ustawienia pozwoleń dostępu</b>', |
|
| 202 | - 'dirs_probleme_droits' => 'Problem z prawami dostępu', |
|
| 203 | - 'dirs_repertoires_absents' => '<p><b>Następujące katalogi nie zostały odnalezione :</b></p> <ul>@bad_dirs@.</ul> |
|
| 84 | + // D |
|
| 85 | + 'date_aujourdhui' => 'dziś', |
|
| 86 | + 'date_avant_jc' => 'P.N.E.', |
|
| 87 | + 'date_dans' => 'w @delai@', |
|
| 88 | + 'date_de_mois_1' => '@j@ stycznia', |
|
| 89 | + 'date_de_mois_10' => '@j@ października', |
|
| 90 | + 'date_de_mois_11' => '@j@ listopada', |
|
| 91 | + 'date_de_mois_12' => '@j@ grudnia', |
|
| 92 | + 'date_de_mois_2' => '@j@ lutego', |
|
| 93 | + 'date_de_mois_3' => '@j@ marca', |
|
| 94 | + 'date_de_mois_4' => '@j@ kwietnia', |
|
| 95 | + 'date_de_mois_5' => '@j@ maja', |
|
| 96 | + 'date_de_mois_6' => '@j@ czerwca', |
|
| 97 | + 'date_de_mois_7' => '@j@ lipca', |
|
| 98 | + 'date_de_mois_8' => '@j@ sierpnia', |
|
| 99 | + 'date_de_mois_9' => '@j@ września', |
|
| 100 | + 'date_demain' => 'jutro', |
|
| 101 | + 'date_fmt_heures_minutes' => '@h@h@m@min', |
|
| 102 | + 'date_fmt_jour_heure' => '@jour@ o @heure@', |
|
| 103 | + 'date_fmt_jour_mois' => '@jourmois@', |
|
| 104 | + 'date_fmt_jour_mois_annee' => '@jourmois@ @annee@', |
|
| 105 | + 'date_fmt_mois_annee' => '@nommois@ @annee@', |
|
| 106 | + 'date_fmt_nomjour_date' => '@date@ @nomjour@ ', |
|
| 107 | + 'date_heures' => 'godziny', |
|
| 108 | + 'date_hier' => 'wczoraj', |
|
| 109 | + 'date_il_y_a' => 'jest @delai@', |
|
| 110 | + 'date_jnum1' => '1', |
|
| 111 | + 'date_jnum10' => '10', |
|
| 112 | + 'date_jnum11' => '11', |
|
| 113 | + 'date_jnum12' => '12', |
|
| 114 | + 'date_jnum13' => '13', |
|
| 115 | + 'date_jnum14' => '14', |
|
| 116 | + 'date_jnum15' => '15', |
|
| 117 | + 'date_jnum16' => '16', |
|
| 118 | + 'date_jnum17' => '17', |
|
| 119 | + 'date_jnum18' => '18', |
|
| 120 | + 'date_jnum19' => '19', |
|
| 121 | + 'date_jnum2' => '2', |
|
| 122 | + 'date_jnum20' => '20', |
|
| 123 | + 'date_jnum21' => '21', |
|
| 124 | + 'date_jnum22' => '22', |
|
| 125 | + 'date_jnum23' => '23', |
|
| 126 | + 'date_jnum24' => '24', |
|
| 127 | + 'date_jnum25' => '25', |
|
| 128 | + 'date_jnum26' => '26', |
|
| 129 | + 'date_jnum27' => '27', |
|
| 130 | + 'date_jnum28' => '28', |
|
| 131 | + 'date_jnum29' => '29', |
|
| 132 | + 'date_jnum3' => '3', |
|
| 133 | + 'date_jnum30' => '30', |
|
| 134 | + 'date_jnum31' => '31', |
|
| 135 | + 'date_jnum4' => '4', |
|
| 136 | + 'date_jnum5' => '5', |
|
| 137 | + 'date_jnum6' => '6', |
|
| 138 | + 'date_jnum7' => '7', |
|
| 139 | + 'date_jnum8' => '8', |
|
| 140 | + 'date_jnum9' => '9', |
|
| 141 | + 'date_jour_1' => 'Niedziela', |
|
| 142 | + 'date_jour_1_abbr' => 'nie.', |
|
| 143 | + 'date_jour_1_initiale' => 'n.', |
|
| 144 | + 'date_jour_2' => 'Poniedziałek', |
|
| 145 | + 'date_jour_2_abbr' => 'pon.', |
|
| 146 | + 'date_jour_2_initiale' => 'p.', |
|
| 147 | + 'date_jour_3' => 'Wtorek', |
|
| 148 | + 'date_jour_3_abbr' => 'wto.', |
|
| 149 | + 'date_jour_3_initiale' => 'w.', |
|
| 150 | + 'date_jour_4' => 'Środa', |
|
| 151 | + 'date_jour_4_abbr' => 'śro.', |
|
| 152 | + 'date_jour_4_initiale' => 'ś.', |
|
| 153 | + 'date_jour_5' => 'Czwartek', |
|
| 154 | + 'date_jour_5_abbr' => 'czw.', |
|
| 155 | + 'date_jour_5_initiale' => 'c.', |
|
| 156 | + 'date_jour_6' => 'Piątek', |
|
| 157 | + 'date_jour_6_abbr' => 'pią.', |
|
| 158 | + 'date_jour_6_initiale' => 'p.', |
|
| 159 | + 'date_jour_7' => 'Sobota', |
|
| 160 | + 'date_jour_7_abbr' => 'sob.', |
|
| 161 | + 'date_jour_7_initiale' => 's.', |
|
| 162 | + 'date_jours' => 'dni', |
|
| 163 | + 'date_minutes' => 'minuty', |
|
| 164 | + 'date_mois' => 'miesiąc', |
|
| 165 | + 'date_mois_1' => 'Styczeń', |
|
| 166 | + 'date_mois_10' => 'Październik', |
|
| 167 | + 'date_mois_10_abbr' => 'paźdź.', |
|
| 168 | + 'date_mois_11' => 'Listopad', |
|
| 169 | + 'date_mois_11_abbr' => 'list.', |
|
| 170 | + 'date_mois_12' => 'Grudzień', |
|
| 171 | + 'date_mois_12_abbr' => 'gru.', |
|
| 172 | + 'date_mois_1_abbr' => 'sty.', |
|
| 173 | + 'date_mois_2' => 'Luty', |
|
| 174 | + 'date_mois_2_abbr' => 'lut.', |
|
| 175 | + 'date_mois_3' => 'Marzec', |
|
| 176 | + 'date_mois_3_abbr' => 'mar.', |
|
| 177 | + 'date_mois_4' => 'Kwiecień', |
|
| 178 | + 'date_mois_4_abbr' => 'kw.', |
|
| 179 | + 'date_mois_5' => 'Maj', |
|
| 180 | + 'date_mois_5_abbr' => 'maj', |
|
| 181 | + 'date_mois_6' => 'Czerwiec', |
|
| 182 | + 'date_mois_6_abbr' => 'czer.', |
|
| 183 | + 'date_mois_7' => 'Lipiec', |
|
| 184 | + 'date_mois_7_abbr' => 'lip.', |
|
| 185 | + 'date_mois_8' => 'Sierpień', |
|
| 186 | + 'date_mois_8_abbr' => 'sie.', |
|
| 187 | + 'date_mois_9' => 'Wrzesień', |
|
| 188 | + 'date_mois_9_abbr' => 'wrz.', |
|
| 189 | + 'date_saison_1' => 'zima', |
|
| 190 | + 'date_saison_2' => 'wiosna', |
|
| 191 | + 'date_saison_3' => 'lato', |
|
| 192 | + 'date_saison_4' => 'jesień', |
|
| 193 | + 'date_secondes' => 'sekundy', |
|
| 194 | + 'date_semaines' => 'tygodnie', |
|
| 195 | + 'date_un_mois' => 'miesiące', |
|
| 196 | + 'date_une_heure' => 'godzina', |
|
| 197 | + 'date_une_minute' => 'minuta', |
|
| 198 | + 'date_une_seconde' => 'sekunda', |
|
| 199 | + 'date_une_semaine' => 'tydzień', |
|
| 200 | + 'dirs_commencer' => ' w celu rzeczywistego rozpoczęcia instalacji', |
|
| 201 | + 'dirs_preliminaire' => 'Wstęp: <b>Ustawienia pozwoleń dostępu</b>', |
|
| 202 | + 'dirs_probleme_droits' => 'Problem z prawami dostępu', |
|
| 203 | + 'dirs_repertoires_absents' => '<p><b>Następujące katalogi nie zostały odnalezione :</b></p> <ul>@bad_dirs@.</ul> |
|
| 204 | 204 | <p>Możliwe, że powodem tego jest nazwa, w której pomylone zostały duże i małe litery. |
| 205 | 205 | Sprawdź nazwy pod względem małych i dużych liter. |
| 206 | 206 | Jeśli rzeczywiście wielkość liter jest różna, zmień nazwy katalogów za pomocą dowolnego programu FTP |
| 207 | 207 | <p>Po wykonaniu tej operacji będziesz mógł', |
| 208 | - 'dirs_repertoires_suivants' => '<p><b>Następujące katalogi nie są skonfigurowane do zapisu :</b></p> <ul>@bad_dirs@.</ul> |
|
| 208 | + 'dirs_repertoires_suivants' => '<p><b>Następujące katalogi nie są skonfigurowane do zapisu :</b></p> <ul>@bad_dirs@.</ul> |
|
| 209 | 209 | <p>Aby temu zapobiec, skorzystaj z klienta FTP i ureguluj konieczne prawa dostępu |
| 210 | 210 | do tych katalogów. Procedura jest wytłumaczona od A-Z w przewodniku instalacji. |
| 211 | 211 | <p>Kiedy dokonasz koniecznych zmian, będziesz mógł', |
| 212 | - 'double_occurrence' => 'Podwójne wystąpienie @balise@', |
|
| 212 | + 'double_occurrence' => 'Podwójne wystąpienie @balise@', |
|
| 213 | 213 | |
| 214 | - // E |
|
| 215 | - 'en_cours' => 'w trakcie', |
|
| 216 | - 'envoi_via_le_site' => 'Wyślij ze strony', |
|
| 217 | - 'erreur' => 'Błąd', |
|
| 218 | - 'erreur_balise_non_fermee' => 'ostatni znacznik nie jest zamknięty :', |
|
| 219 | - 'erreur_texte' => 'błąd/błędy', |
|
| 220 | - 'etape' => 'Etap', |
|
| 214 | + // E |
|
| 215 | + 'en_cours' => 'w trakcie', |
|
| 216 | + 'envoi_via_le_site' => 'Wyślij ze strony', |
|
| 217 | + 'erreur' => 'Błąd', |
|
| 218 | + 'erreur_balise_non_fermee' => 'ostatni znacznik nie jest zamknięty :', |
|
| 219 | + 'erreur_texte' => 'błąd/błędy', |
|
| 220 | + 'etape' => 'Etap', |
|
| 221 | 221 | |
| 222 | - // F |
|
| 223 | - 'fichier_introuvable' => 'Plik @fichier@ nie odnaleziony', # MODIF |
|
| 224 | - 'form_auteur_confirmation' => 'Potwierdź swój e-mail', |
|
| 225 | - 'form_auteur_email_modifie' => 'Twój adres e-mail został zmieniony.', |
|
| 226 | - 'form_auteur_envoi_mail_confirmation' => 'Mail z potwierdzeniem został wysłany na adres @email@. Prosimy o kliknięcie w link, przesłany w e-mailu aby zatwierdzić adres e-mail.', |
|
| 227 | - 'form_auteur_mail_confirmation' => 'Dzień dobry, |
|
| 222 | + // F |
|
| 223 | + 'fichier_introuvable' => 'Plik @fichier@ nie odnaleziony', # MODIF |
|
| 224 | + 'form_auteur_confirmation' => 'Potwierdź swój e-mail', |
|
| 225 | + 'form_auteur_email_modifie' => 'Twój adres e-mail został zmieniony.', |
|
| 226 | + 'form_auteur_envoi_mail_confirmation' => 'Mail z potwierdzeniem został wysłany na adres @email@. Prosimy o kliknięcie w link, przesłany w e-mailu aby zatwierdzić adres e-mail.', |
|
| 227 | + 'form_auteur_mail_confirmation' => 'Dzień dobry, |
|
| 228 | 228 | |
| 229 | 229 | Uruchomiłeś procedurę zmiany adresu e-mail. |
| 230 | 230 | Aby zatwierdzić nowy adres, wystarczy wejść pod podany niżej link, |
@@ -232,315 +232,315 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | @url@ |
| 234 | 234 | ', |
| 235 | - 'form_deja_inscrit' => 'Jesteś już zarejestrowany.', |
|
| 236 | - 'form_email_non_valide' => 'Twój adres e-mail nie jest prawidłowy.', |
|
| 237 | - 'form_forum_access_refuse' => 'Nie masz już dostępu do tej strony.', |
|
| 238 | - 'form_forum_bonjour' => 'Witaj @nom@,', |
|
| 239 | - 'form_forum_confirmer_email' => 'Aby zatwierdzić Twój adres e-mail, kliknij w ten link: @url_confirm@', |
|
| 240 | - 'form_forum_email_deja_enregistre' => 'Ten adres e-mail jest już zarejestrowany, wskutek czego nie możesz używać swojego zwykłego hasła.', |
|
| 241 | - 'form_forum_identifiant_mail' => 'Twój nowy identyfikator został właśnie wysłany do Ciebie e-mailem.', |
|
| 242 | - 'form_forum_identifiants' => 'Osobista identyfikacja', |
|
| 243 | - 'form_forum_indiquer_nom_email' => 'Wpisz tutaj swoje nazwisko i adres e-mail. Wkrótce otrzymasz e-mailem swój osobisty identyfikator.', |
|
| 244 | - 'form_forum_login' => 'login:', |
|
| 245 | - 'form_forum_message_auto' => '(to jest wiadomość automatyczna)', |
|
| 246 | - 'form_forum_pass' => 'hasło:', |
|
| 247 | - 'form_forum_probleme_mail' => 'Problem z pocztą: Twój identyfikator nie może zostać wysłany.', |
|
| 248 | - 'form_forum_voici1' => 'Oto Twóje dane, które pozwolą Ci wziąć udział w rozwoju serwisu |
|
| 235 | + 'form_deja_inscrit' => 'Jesteś już zarejestrowany.', |
|
| 236 | + 'form_email_non_valide' => 'Twój adres e-mail nie jest prawidłowy.', |
|
| 237 | + 'form_forum_access_refuse' => 'Nie masz już dostępu do tej strony.', |
|
| 238 | + 'form_forum_bonjour' => 'Witaj @nom@,', |
|
| 239 | + 'form_forum_confirmer_email' => 'Aby zatwierdzić Twój adres e-mail, kliknij w ten link: @url_confirm@', |
|
| 240 | + 'form_forum_email_deja_enregistre' => 'Ten adres e-mail jest już zarejestrowany, wskutek czego nie możesz używać swojego zwykłego hasła.', |
|
| 241 | + 'form_forum_identifiant_mail' => 'Twój nowy identyfikator został właśnie wysłany do Ciebie e-mailem.', |
|
| 242 | + 'form_forum_identifiants' => 'Osobista identyfikacja', |
|
| 243 | + 'form_forum_indiquer_nom_email' => 'Wpisz tutaj swoje nazwisko i adres e-mail. Wkrótce otrzymasz e-mailem swój osobisty identyfikator.', |
|
| 244 | + 'form_forum_login' => 'login:', |
|
| 245 | + 'form_forum_message_auto' => '(to jest wiadomość automatyczna)', |
|
| 246 | + 'form_forum_pass' => 'hasło:', |
|
| 247 | + 'form_forum_probleme_mail' => 'Problem z pocztą: Twój identyfikator nie może zostać wysłany.', |
|
| 248 | + 'form_forum_voici1' => 'Oto Twóje dane, które pozwolą Ci wziąć udział w rozwoju serwisu |
|
| 249 | 249 | "@nom_site_spip@" (@adresse_site@):', |
| 250 | - 'form_forum_voici2' => 'Oto Twój identyfikator do proponowania artykułów w |
|
| 250 | + 'form_forum_voici2' => 'Oto Twój identyfikator do proponowania artykułów w |
|
| 251 | 251 | serwisie "@nom_site_spip@" (@adresse_login@):', |
| 252 | - 'form_indiquer_email' => 'Proszę wpisać swój adres e-mail.', |
|
| 253 | - 'form_indiquer_nom' => 'Proszę wpisać swoje nazwisko.', |
|
| 254 | - 'form_indiquer_nom_site' => 'Proszę wpisać nazwę swoich stron\\y.', |
|
| 255 | - 'form_pet_deja_enregistre' => 'Ta strona jest już zarejestrowana', |
|
| 256 | - 'form_pet_signature_pasprise' => 'Twój podpis został zlekceważony.', |
|
| 257 | - 'form_prop_confirmer_envoi' => 'Potwierdź wysłanie', |
|
| 258 | - 'form_prop_description' => 'Opis/komentarz', |
|
| 259 | - 'form_prop_enregistre' => 'Twoja propozycja została zapisana, pojawi się online po jej zatwierdzeniu przez administratora tej strony.', |
|
| 260 | - 'form_prop_envoyer' => 'Wyślij wiadomość', |
|
| 261 | - 'form_prop_indiquer_email' => 'Proszę wpisać prawidłowy adres e-mail', |
|
| 262 | - 'form_prop_indiquer_nom_site' => 'Proszę wpisać nazwę strony.', |
|
| 263 | - 'form_prop_indiquer_sujet' => 'Proszę wpisać temat', |
|
| 264 | - 'form_prop_message_envoye' => 'Wiadomość wysłana', |
|
| 265 | - 'form_prop_non_enregistre' => 'Twoja propozycja nie została zapisana.', |
|
| 266 | - 'form_prop_sujet' => 'Temat', |
|
| 267 | - 'form_prop_url_site' => 'URL stron\\y', # MODIF |
|
| 268 | - 'forum_non_inscrit' => 'Nie jesteś zarejestrowany, lub adres bądź hasło są nieprawidłowe.', |
|
| 269 | - 'forum_par_auteur' => 'wg @auteur@', |
|
| 270 | - 'forum_titre_erreur' => 'Błąd...', |
|
| 252 | + 'form_indiquer_email' => 'Proszę wpisać swój adres e-mail.', |
|
| 253 | + 'form_indiquer_nom' => 'Proszę wpisać swoje nazwisko.', |
|
| 254 | + 'form_indiquer_nom_site' => 'Proszę wpisać nazwę swoich stron\\y.', |
|
| 255 | + 'form_pet_deja_enregistre' => 'Ta strona jest już zarejestrowana', |
|
| 256 | + 'form_pet_signature_pasprise' => 'Twój podpis został zlekceważony.', |
|
| 257 | + 'form_prop_confirmer_envoi' => 'Potwierdź wysłanie', |
|
| 258 | + 'form_prop_description' => 'Opis/komentarz', |
|
| 259 | + 'form_prop_enregistre' => 'Twoja propozycja została zapisana, pojawi się online po jej zatwierdzeniu przez administratora tej strony.', |
|
| 260 | + 'form_prop_envoyer' => 'Wyślij wiadomość', |
|
| 261 | + 'form_prop_indiquer_email' => 'Proszę wpisać prawidłowy adres e-mail', |
|
| 262 | + 'form_prop_indiquer_nom_site' => 'Proszę wpisać nazwę strony.', |
|
| 263 | + 'form_prop_indiquer_sujet' => 'Proszę wpisać temat', |
|
| 264 | + 'form_prop_message_envoye' => 'Wiadomość wysłana', |
|
| 265 | + 'form_prop_non_enregistre' => 'Twoja propozycja nie została zapisana.', |
|
| 266 | + 'form_prop_sujet' => 'Temat', |
|
| 267 | + 'form_prop_url_site' => 'URL stron\\y', # MODIF |
|
| 268 | + 'forum_non_inscrit' => 'Nie jesteś zarejestrowany, lub adres bądź hasło są nieprawidłowe.', |
|
| 269 | + 'forum_par_auteur' => 'wg @auteur@', |
|
| 270 | + 'forum_titre_erreur' => 'Błąd...', |
|
| 271 | 271 | |
| 272 | - // I |
|
| 273 | - 'ical_texte_rss_articles' => 'Plik "backend" artykułów tej strony znajduje się pod adresem:', |
|
| 274 | - 'ical_texte_rss_articles2' => 'Możesz również otrzymać pliki "backend" dla artykułów dla każdego z działów strony:', |
|
| 275 | - 'ical_texte_rss_breves' => 'Istnieje także plik zawierający wszystkie newsy opublikowane na stronie. Precyzując numer działu, otrzymasz newsy opublikowane w tym dziale.', |
|
| 276 | - 'icone_a_suivre' => 'Aktualności', |
|
| 277 | - 'icone_admin_site' => 'Administracja strony', |
|
| 278 | - 'icone_agenda' => 'Kalendarz', |
|
| 279 | - 'icone_aide_ligne' => 'Pomoc', |
|
| 280 | - 'icone_articles' => 'Artykuły', |
|
| 281 | - 'icone_auteurs' => 'Autorzy', |
|
| 282 | - 'icone_brouteur' => 'Menu podręczne', |
|
| 283 | - 'icone_configuration_site' => 'Konfiguracja', |
|
| 284 | - 'icone_configurer_site' => 'Konfiguruj swoją stronę', |
|
| 285 | - 'icone_creer_nouvel_auteur' => 'Utwórz nowego autora', |
|
| 286 | - 'icone_creer_rubrique' => 'Utwórz dział', |
|
| 287 | - 'icone_creer_sous_rubrique' => 'Utwórz poddział', |
|
| 288 | - 'icone_deconnecter' => 'Rozłącz', |
|
| 289 | - 'icone_discussions' => 'Dyskusje', |
|
| 290 | - 'icone_doc_rubrique' => 'Załączniki', |
|
| 291 | - 'icone_ecrire_article' => 'Napisz nowy artykuł', |
|
| 292 | - 'icone_edition_site' => 'Edycja', |
|
| 293 | - 'icone_gestion_langues' => 'Zarządzanie językami', |
|
| 294 | - 'icone_informations_personnelles' => 'Informacje osobiste', |
|
| 295 | - 'icone_interface_complet' => 'cały interfejs', |
|
| 296 | - 'icone_interface_simple' => 'Uproszczony interfejs', |
|
| 297 | - 'icone_maintenance_site' => 'Administracja stroną', |
|
| 298 | - 'icone_messagerie_personnelle' => 'Wiadomości prywatne', |
|
| 299 | - 'icone_repartition_debut' => 'Pokaż dystrybucję od początku', |
|
| 300 | - 'icone_rubriques' => 'Działy', |
|
| 301 | - 'icone_sauver_site' => 'Backup strony', |
|
| 302 | - 'icone_site_entier' => 'Cała strona', |
|
| 303 | - 'icone_sites_references' => 'Zlinkowane strony', |
|
| 304 | - 'icone_statistiques' => 'Statystyki strony', |
|
| 305 | - 'icone_suivi_activite' => 'Prace redakcyjne', |
|
| 306 | - 'icone_suivi_actualite' => 'Rozwój strony', |
|
| 307 | - 'icone_suivi_pettions' => 'Śledź/zarządzaj ogłoszeniami', |
|
| 308 | - 'icone_suivi_revisions' => 'Zmiany artykułów', |
|
| 309 | - 'icone_supprimer_document' => 'Usuń ten dokument', |
|
| 310 | - 'icone_supprimer_image' => 'Usuń ten obrazek', |
|
| 311 | - 'icone_tous_articles' => 'Wszystkie Twoje artykuły', |
|
| 312 | - 'icone_tous_auteur' => 'Wszyscy autorzy', |
|
| 313 | - 'icone_tous_visiteur' => 'Wszyscy odwiedzający', |
|
| 314 | - 'icone_visiter_site' => 'Przejdź do Twojego serwisu', |
|
| 315 | - 'icone_voir_en_ligne' => 'Obejrzyj online', |
|
| 316 | - 'img_indisponible' => 'obrazek niedostępny', |
|
| 317 | - 'impossible' => 'niemożliwe', |
|
| 318 | - 'info_a_suivre' => 'KONTYNUUJ »', |
|
| 319 | - 'info_acces_interdit' => 'Dostęp zabroniony', |
|
| 320 | - 'info_acces_refuse' => 'Brak dostępu', |
|
| 321 | - 'info_action' => 'Akcja: @action@', |
|
| 322 | - 'info_administrer_rubriques' => 'Możesz zarządzać tą działami i jej poddziałami', |
|
| 323 | - 'info_adresse_non_indiquee' => 'Nie podałeś adresu testowego!', |
|
| 324 | - 'info_aide' => 'POMOC:', |
|
| 325 | - 'info_ajouter_mot' => 'Dodaj to słowo kluczowe', |
|
| 326 | - 'info_annonce' => 'ZAWIADOMIENIE', |
|
| 327 | - 'info_annonces_generales' => 'Ogólne ogłoszenia:', |
|
| 328 | - 'info_article_propose' => 'Zaproponowany artykuł', |
|
| 329 | - 'info_article_publie' => 'Artykuł opublikowany', |
|
| 330 | - 'info_article_redaction' => 'Artykuł w trakcie tworzenia', |
|
| 331 | - 'info_article_refuse' => 'Artykuł odrzucony', |
|
| 332 | - 'info_article_supprime' => 'Artykuł usunięty', |
|
| 333 | - 'info_articles' => 'Artykuły', |
|
| 334 | - 'info_articles_a_valider' => 'Artykuły do zatwierdzenia', |
|
| 335 | - 'info_articles_nb' => '@nb@ artykułów', |
|
| 336 | - 'info_articles_proposes' => 'Zaproponowane artykuły', |
|
| 337 | - 'info_articles_un' => '1 artykuł', |
|
| 338 | - 'info_auteurs_nombre' => 'autor(zy):', |
|
| 339 | - 'info_authentification_ftp' => 'Uwierzytelnienie (poprzez FTP).', |
|
| 340 | - 'info_breves_2' => 'newsy', |
|
| 341 | - 'info_breves_nb' => '@nb@ newsów', |
|
| 342 | - 'info_connexion_refusee' => 'Brak połączenia', |
|
| 343 | - 'info_contact_developpeur' => 'Proszę skontaktować się z deweloperem.', |
|
| 344 | - 'info_contenance' => 'Ta strona zawiera:', |
|
| 345 | - 'info_contribution' => 'wpisy na forum', # MODIF |
|
| 346 | - 'info_copyright' => '@spip@ - darmowe oprogramowanie dystrybuowane w oparciu o licencję @lien_gpl@.', |
|
| 347 | - 'info_copyright_doc' => 'Więcej informacji na stronie <a href="@spipnet@">http://www.spip.net</a>.', # MODIF |
|
| 348 | - 'info_copyright_gpl' => 'na licencji GPL', |
|
| 349 | - 'info_cours_edition' => 'Twoje artykuły w trakcie redagowania', # MODIF |
|
| 350 | - 'info_creer_repertoire' => 'Utwórz plik lub katalog o nazwie:', |
|
| 351 | - 'info_creer_repertoire_2' => 'w podkatalogu <b>@repertoire@</b>, a następnie:', |
|
| 352 | - 'info_creer_vignette' => 'generowanie miniaturki', |
|
| 353 | - 'info_deplier' => 'Rozwiń', |
|
| 354 | - 'info_descriptif_nombre' => 'opis(y):', |
|
| 355 | - 'info_description' => 'Opis:', |
|
| 356 | - 'info_description_2' => 'Opis:', |
|
| 357 | - 'info_dimension' => 'Rozmiar:', |
|
| 358 | - 'info_ecire_message_prive' => 'Napisz prywatną wiadomość', |
|
| 359 | - 'info_email_invalide' => 'Nieprawidłowy adres e-mail.', |
|
| 360 | - 'info_en_cours_validation' => 'Twoje artykuły są w trakcie redagowania', |
|
| 361 | - 'info_en_ligne' => 'Teraz online:', |
|
| 362 | - 'info_envoyer_message_prive' => 'Wyślij prywatną wiadomość do tego autora', |
|
| 363 | - 'info_erreur_requete' => 'Błąd zapytania :', |
|
| 364 | - 'info_erreur_squelette2' => 'Żaden szkielet <b>@fichier@</b> nie jest dostępny ...', |
|
| 365 | - 'info_erreur_systeme' => 'Błąd systemu (errno @errsys@)', |
|
| 366 | - 'info_erreur_systeme2' => 'Albo dysk twardy jest pełny albo uszkodzona jest baza danych.<br /> |
|
| 272 | + // I |
|
| 273 | + 'ical_texte_rss_articles' => 'Plik "backend" artykułów tej strony znajduje się pod adresem:', |
|
| 274 | + 'ical_texte_rss_articles2' => 'Możesz również otrzymać pliki "backend" dla artykułów dla każdego z działów strony:', |
|
| 275 | + 'ical_texte_rss_breves' => 'Istnieje także plik zawierający wszystkie newsy opublikowane na stronie. Precyzując numer działu, otrzymasz newsy opublikowane w tym dziale.', |
|
| 276 | + 'icone_a_suivre' => 'Aktualności', |
|
| 277 | + 'icone_admin_site' => 'Administracja strony', |
|
| 278 | + 'icone_agenda' => 'Kalendarz', |
|
| 279 | + 'icone_aide_ligne' => 'Pomoc', |
|
| 280 | + 'icone_articles' => 'Artykuły', |
|
| 281 | + 'icone_auteurs' => 'Autorzy', |
|
| 282 | + 'icone_brouteur' => 'Menu podręczne', |
|
| 283 | + 'icone_configuration_site' => 'Konfiguracja', |
|
| 284 | + 'icone_configurer_site' => 'Konfiguruj swoją stronę', |
|
| 285 | + 'icone_creer_nouvel_auteur' => 'Utwórz nowego autora', |
|
| 286 | + 'icone_creer_rubrique' => 'Utwórz dział', |
|
| 287 | + 'icone_creer_sous_rubrique' => 'Utwórz poddział', |
|
| 288 | + 'icone_deconnecter' => 'Rozłącz', |
|
| 289 | + 'icone_discussions' => 'Dyskusje', |
|
| 290 | + 'icone_doc_rubrique' => 'Załączniki', |
|
| 291 | + 'icone_ecrire_article' => 'Napisz nowy artykuł', |
|
| 292 | + 'icone_edition_site' => 'Edycja', |
|
| 293 | + 'icone_gestion_langues' => 'Zarządzanie językami', |
|
| 294 | + 'icone_informations_personnelles' => 'Informacje osobiste', |
|
| 295 | + 'icone_interface_complet' => 'cały interfejs', |
|
| 296 | + 'icone_interface_simple' => 'Uproszczony interfejs', |
|
| 297 | + 'icone_maintenance_site' => 'Administracja stroną', |
|
| 298 | + 'icone_messagerie_personnelle' => 'Wiadomości prywatne', |
|
| 299 | + 'icone_repartition_debut' => 'Pokaż dystrybucję od początku', |
|
| 300 | + 'icone_rubriques' => 'Działy', |
|
| 301 | + 'icone_sauver_site' => 'Backup strony', |
|
| 302 | + 'icone_site_entier' => 'Cała strona', |
|
| 303 | + 'icone_sites_references' => 'Zlinkowane strony', |
|
| 304 | + 'icone_statistiques' => 'Statystyki strony', |
|
| 305 | + 'icone_suivi_activite' => 'Prace redakcyjne', |
|
| 306 | + 'icone_suivi_actualite' => 'Rozwój strony', |
|
| 307 | + 'icone_suivi_pettions' => 'Śledź/zarządzaj ogłoszeniami', |
|
| 308 | + 'icone_suivi_revisions' => 'Zmiany artykułów', |
|
| 309 | + 'icone_supprimer_document' => 'Usuń ten dokument', |
|
| 310 | + 'icone_supprimer_image' => 'Usuń ten obrazek', |
|
| 311 | + 'icone_tous_articles' => 'Wszystkie Twoje artykuły', |
|
| 312 | + 'icone_tous_auteur' => 'Wszyscy autorzy', |
|
| 313 | + 'icone_tous_visiteur' => 'Wszyscy odwiedzający', |
|
| 314 | + 'icone_visiter_site' => 'Przejdź do Twojego serwisu', |
|
| 315 | + 'icone_voir_en_ligne' => 'Obejrzyj online', |
|
| 316 | + 'img_indisponible' => 'obrazek niedostępny', |
|
| 317 | + 'impossible' => 'niemożliwe', |
|
| 318 | + 'info_a_suivre' => 'KONTYNUUJ »', |
|
| 319 | + 'info_acces_interdit' => 'Dostęp zabroniony', |
|
| 320 | + 'info_acces_refuse' => 'Brak dostępu', |
|
| 321 | + 'info_action' => 'Akcja: @action@', |
|
| 322 | + 'info_administrer_rubriques' => 'Możesz zarządzać tą działami i jej poddziałami', |
|
| 323 | + 'info_adresse_non_indiquee' => 'Nie podałeś adresu testowego!', |
|
| 324 | + 'info_aide' => 'POMOC:', |
|
| 325 | + 'info_ajouter_mot' => 'Dodaj to słowo kluczowe', |
|
| 326 | + 'info_annonce' => 'ZAWIADOMIENIE', |
|
| 327 | + 'info_annonces_generales' => 'Ogólne ogłoszenia:', |
|
| 328 | + 'info_article_propose' => 'Zaproponowany artykuł', |
|
| 329 | + 'info_article_publie' => 'Artykuł opublikowany', |
|
| 330 | + 'info_article_redaction' => 'Artykuł w trakcie tworzenia', |
|
| 331 | + 'info_article_refuse' => 'Artykuł odrzucony', |
|
| 332 | + 'info_article_supprime' => 'Artykuł usunięty', |
|
| 333 | + 'info_articles' => 'Artykuły', |
|
| 334 | + 'info_articles_a_valider' => 'Artykuły do zatwierdzenia', |
|
| 335 | + 'info_articles_nb' => '@nb@ artykułów', |
|
| 336 | + 'info_articles_proposes' => 'Zaproponowane artykuły', |
|
| 337 | + 'info_articles_un' => '1 artykuł', |
|
| 338 | + 'info_auteurs_nombre' => 'autor(zy):', |
|
| 339 | + 'info_authentification_ftp' => 'Uwierzytelnienie (poprzez FTP).', |
|
| 340 | + 'info_breves_2' => 'newsy', |
|
| 341 | + 'info_breves_nb' => '@nb@ newsów', |
|
| 342 | + 'info_connexion_refusee' => 'Brak połączenia', |
|
| 343 | + 'info_contact_developpeur' => 'Proszę skontaktować się z deweloperem.', |
|
| 344 | + 'info_contenance' => 'Ta strona zawiera:', |
|
| 345 | + 'info_contribution' => 'wpisy na forum', # MODIF |
|
| 346 | + 'info_copyright' => '@spip@ - darmowe oprogramowanie dystrybuowane w oparciu o licencję @lien_gpl@.', |
|
| 347 | + 'info_copyright_doc' => 'Więcej informacji na stronie <a href="@spipnet@">http://www.spip.net</a>.', # MODIF |
|
| 348 | + 'info_copyright_gpl' => 'na licencji GPL', |
|
| 349 | + 'info_cours_edition' => 'Twoje artykuły w trakcie redagowania', # MODIF |
|
| 350 | + 'info_creer_repertoire' => 'Utwórz plik lub katalog o nazwie:', |
|
| 351 | + 'info_creer_repertoire_2' => 'w podkatalogu <b>@repertoire@</b>, a następnie:', |
|
| 352 | + 'info_creer_vignette' => 'generowanie miniaturki', |
|
| 353 | + 'info_deplier' => 'Rozwiń', |
|
| 354 | + 'info_descriptif_nombre' => 'opis(y):', |
|
| 355 | + 'info_description' => 'Opis:', |
|
| 356 | + 'info_description_2' => 'Opis:', |
|
| 357 | + 'info_dimension' => 'Rozmiar:', |
|
| 358 | + 'info_ecire_message_prive' => 'Napisz prywatną wiadomość', |
|
| 359 | + 'info_email_invalide' => 'Nieprawidłowy adres e-mail.', |
|
| 360 | + 'info_en_cours_validation' => 'Twoje artykuły są w trakcie redagowania', |
|
| 361 | + 'info_en_ligne' => 'Teraz online:', |
|
| 362 | + 'info_envoyer_message_prive' => 'Wyślij prywatną wiadomość do tego autora', |
|
| 363 | + 'info_erreur_requete' => 'Błąd zapytania :', |
|
| 364 | + 'info_erreur_squelette2' => 'Żaden szkielet <b>@fichier@</b> nie jest dostępny ...', |
|
| 365 | + 'info_erreur_systeme' => 'Błąd systemu (errno @errsys@)', |
|
| 366 | + 'info_erreur_systeme2' => 'Albo dysk twardy jest pełny albo uszkodzona jest baza danych.<br /> |
|
| 367 | 367 | <span style="color:red;">Spróbuj <a href=\'@script@\'>naprawić bazę danych</a>, lub skontaktuj się z administratorem serwera.</span>', |
| 368 | - 'info_fini' => 'Zakończono!', |
|
| 369 | - 'info_format_image' => 'Formaty plików obrazków, które mogą być używane do tworzenia minitaturek : @gd_formats@.', |
|
| 370 | - 'info_format_non_defini' => 'format niezdefiniowany', |
|
| 371 | - 'info_grand_ecran' => 'Cały ekran', |
|
| 372 | - 'info_image_aide' => 'POMOC', |
|
| 373 | - 'info_image_process_titre' => 'Sposób generowania miniaturek', |
|
| 374 | - 'info_impossible_lire_page' => '<b>Błąd !</b> Nie można odczytać strony<tt><html>@test_proxy@</html></tt> za pośrednictwem proxy<tt>', |
|
| 375 | - 'info_installation_systeme_publication' => 'Instalacja systemu publikacji...', |
|
| 376 | - 'info_installer_documents' => 'Możesz automatycznie dodawać wszystkie dokumenty znajdujące się w folderze @upload@.', |
|
| 377 | - 'info_installer_ftp' => 'Jako administrator możesz umieszczać (przez FTP) pliki w folderze @upload@, aby później wybierać je bezpośrednio stąd.', |
|
| 378 | - 'info_installer_images' => 'Możesz umieszczać obrazki w formatach JPEG, GIF i PNG.', |
|
| 379 | - 'info_installer_images_dossier' => 'Umieść obrazki w folderze @upload@ aby móc je stąd wybierać.', |
|
| 380 | - 'info_interface_complete' => 'cały interfejs', |
|
| 381 | - 'info_interface_simple' => 'Uproszczony interfejs', |
|
| 382 | - 'info_joindre_document_article' => 'Do tego artykułu możesz załączać dokumenty typu', |
|
| 383 | - 'info_joindre_document_rubrique' => 'Do tego działu możesz dodawać dokumenty typu', |
|
| 384 | - 'info_joindre_documents_article' => 'Do swojego atykułu możesz załączać dokumenty typu:', |
|
| 385 | - 'info_l_article' => 'artykuł', |
|
| 386 | - 'info_la_breve' => 'news', |
|
| 387 | - 'info_la_rubrique' => 'dział', |
|
| 388 | - 'info_langue_principale' => 'Język głównej strony', |
|
| 389 | - 'info_largeur_vignette' => '@largeur_vignette@ x @hauteur_vignette@ pikseli', |
|
| 390 | - 'info_les_auteurs_1' => 'wg @les_auteurs@', |
|
| 391 | - 'info_logo_format_interdit' => 'Dla logo dozwolone są następujące formaty: @formats@.', |
|
| 392 | - 'info_logo_max_poids' => 'Logo może mieć maksymalnie @maxi@ (teraz ma @actuel@).', |
|
| 393 | - 'info_mail_fournisseur' => '[email protected]', |
|
| 394 | - 'info_message_2' => 'WIADOMOŚĆ', |
|
| 395 | - 'info_message_supprime' => 'WIADOMOŚĆ USUNIĘTA', |
|
| 396 | - 'info_mise_en_ligne' => 'Data publikacji online:', |
|
| 397 | - 'info_modification_parametres_securite' => 'modyfikacja parametrów bezpieczeństwa', |
|
| 398 | - 'info_mois_courant' => 'Bieżący miesiąc:', |
|
| 399 | - 'info_mot_cle_ajoute' => 'Następujące słowo kluczowe dodane zostało do', |
|
| 400 | - 'info_multi_herit' => 'Język domyślny', |
|
| 401 | - 'info_multi_langues_soulignees' => '<u>Podkreślonie języka</u> świadczy o kompletnym przekładzie wszystkich tekstów interfejsu. Jeśli wybierzesz jeden z tych języków, elementy serwisu (daty, formularze) zostaną automatycznie przetłumaczone. W przypadku języków nie-podkreślonych, elementy te ukażą się w głównym języku serwisu.', # MODIF |
|
| 402 | - 'info_multilinguisme' => 'Wielojęzyczny', |
|
| 403 | - 'info_nom_non_utilisateurs_connectes' => 'Twoja nazwa nie pojawia się na liście podłączonych użytkowników.', |
|
| 404 | - 'info_nom_utilisateurs_connectes' => 'Twoje imię występuje na liście podłączonych użytkowników.', |
|
| 405 | - 'info_nombre_en_ligne' => 'Teraz online:', |
|
| 406 | - 'info_non_resultat' => 'Żadnych wyników dla "@cherche_mot@"', |
|
| 407 | - 'info_non_utilisation_messagerie' => 'Nie korzystasz z wewnętrznej komunikacji tego serwisu.', |
|
| 408 | - 'info_nouveau_message' => 'MASZ NOWĄ WIADOMOŚĆ', |
|
| 409 | - 'info_nouveaux_messages' => 'MASZ @total_messages@ NOWYCH WIADOMOŚCI', |
|
| 410 | - 'info_numero_abbreviation' => 'N° ', |
|
| 411 | - 'info_pense_bete' => 'NOTATKA', |
|
| 412 | - 'info_petit_ecran' => 'Małe okno', |
|
| 413 | - 'info_pixels' => 'piksele', |
|
| 414 | - 'info_plusieurs_mots_trouves' => 'Kilkanaście słów kluczowych zostało znalezionych dla "@cherche_mot@":', |
|
| 415 | - 'info_portfolio_automatique' => 'Automatyczne portfolio:', |
|
| 416 | - 'info_premier_resultat' => '[@debut_limit@ pierwsze wyniki z @total@]', |
|
| 417 | - 'info_premier_resultat_sur' => '[@debut_limit@ pierwsze wyniki z @total@]', |
|
| 418 | - 'info_propose_1' => '[@nom_site_spip@] Zatwierdza: @titre@', |
|
| 419 | - 'info_propose_2' => 'Artykuły zatwierdzone |
|
| 368 | + 'info_fini' => 'Zakończono!', |
|
| 369 | + 'info_format_image' => 'Formaty plików obrazków, które mogą być używane do tworzenia minitaturek : @gd_formats@.', |
|
| 370 | + 'info_format_non_defini' => 'format niezdefiniowany', |
|
| 371 | + 'info_grand_ecran' => 'Cały ekran', |
|
| 372 | + 'info_image_aide' => 'POMOC', |
|
| 373 | + 'info_image_process_titre' => 'Sposób generowania miniaturek', |
|
| 374 | + 'info_impossible_lire_page' => '<b>Błąd !</b> Nie można odczytać strony<tt><html>@test_proxy@</html></tt> za pośrednictwem proxy<tt>', |
|
| 375 | + 'info_installation_systeme_publication' => 'Instalacja systemu publikacji...', |
|
| 376 | + 'info_installer_documents' => 'Możesz automatycznie dodawać wszystkie dokumenty znajdujące się w folderze @upload@.', |
|
| 377 | + 'info_installer_ftp' => 'Jako administrator możesz umieszczać (przez FTP) pliki w folderze @upload@, aby później wybierać je bezpośrednio stąd.', |
|
| 378 | + 'info_installer_images' => 'Możesz umieszczać obrazki w formatach JPEG, GIF i PNG.', |
|
| 379 | + 'info_installer_images_dossier' => 'Umieść obrazki w folderze @upload@ aby móc je stąd wybierać.', |
|
| 380 | + 'info_interface_complete' => 'cały interfejs', |
|
| 381 | + 'info_interface_simple' => 'Uproszczony interfejs', |
|
| 382 | + 'info_joindre_document_article' => 'Do tego artykułu możesz załączać dokumenty typu', |
|
| 383 | + 'info_joindre_document_rubrique' => 'Do tego działu możesz dodawać dokumenty typu', |
|
| 384 | + 'info_joindre_documents_article' => 'Do swojego atykułu możesz załączać dokumenty typu:', |
|
| 385 | + 'info_l_article' => 'artykuł', |
|
| 386 | + 'info_la_breve' => 'news', |
|
| 387 | + 'info_la_rubrique' => 'dział', |
|
| 388 | + 'info_langue_principale' => 'Język głównej strony', |
|
| 389 | + 'info_largeur_vignette' => '@largeur_vignette@ x @hauteur_vignette@ pikseli', |
|
| 390 | + 'info_les_auteurs_1' => 'wg @les_auteurs@', |
|
| 391 | + 'info_logo_format_interdit' => 'Dla logo dozwolone są następujące formaty: @formats@.', |
|
| 392 | + 'info_logo_max_poids' => 'Logo może mieć maksymalnie @maxi@ (teraz ma @actuel@).', |
|
| 393 | + 'info_mail_fournisseur' => '[email protected]', |
|
| 394 | + 'info_message_2' => 'WIADOMOŚĆ', |
|
| 395 | + 'info_message_supprime' => 'WIADOMOŚĆ USUNIĘTA', |
|
| 396 | + 'info_mise_en_ligne' => 'Data publikacji online:', |
|
| 397 | + 'info_modification_parametres_securite' => 'modyfikacja parametrów bezpieczeństwa', |
|
| 398 | + 'info_mois_courant' => 'Bieżący miesiąc:', |
|
| 399 | + 'info_mot_cle_ajoute' => 'Następujące słowo kluczowe dodane zostało do', |
|
| 400 | + 'info_multi_herit' => 'Język domyślny', |
|
| 401 | + 'info_multi_langues_soulignees' => '<u>Podkreślonie języka</u> świadczy o kompletnym przekładzie wszystkich tekstów interfejsu. Jeśli wybierzesz jeden z tych języków, elementy serwisu (daty, formularze) zostaną automatycznie przetłumaczone. W przypadku języków nie-podkreślonych, elementy te ukażą się w głównym języku serwisu.', # MODIF |
|
| 402 | + 'info_multilinguisme' => 'Wielojęzyczny', |
|
| 403 | + 'info_nom_non_utilisateurs_connectes' => 'Twoja nazwa nie pojawia się na liście podłączonych użytkowników.', |
|
| 404 | + 'info_nom_utilisateurs_connectes' => 'Twoje imię występuje na liście podłączonych użytkowników.', |
|
| 405 | + 'info_nombre_en_ligne' => 'Teraz online:', |
|
| 406 | + 'info_non_resultat' => 'Żadnych wyników dla "@cherche_mot@"', |
|
| 407 | + 'info_non_utilisation_messagerie' => 'Nie korzystasz z wewnętrznej komunikacji tego serwisu.', |
|
| 408 | + 'info_nouveau_message' => 'MASZ NOWĄ WIADOMOŚĆ', |
|
| 409 | + 'info_nouveaux_messages' => 'MASZ @total_messages@ NOWYCH WIADOMOŚCI', |
|
| 410 | + 'info_numero_abbreviation' => 'N° ', |
|
| 411 | + 'info_pense_bete' => 'NOTATKA', |
|
| 412 | + 'info_petit_ecran' => 'Małe okno', |
|
| 413 | + 'info_pixels' => 'piksele', |
|
| 414 | + 'info_plusieurs_mots_trouves' => 'Kilkanaście słów kluczowych zostało znalezionych dla "@cherche_mot@":', |
|
| 415 | + 'info_portfolio_automatique' => 'Automatyczne portfolio:', |
|
| 416 | + 'info_premier_resultat' => '[@debut_limit@ pierwsze wyniki z @total@]', |
|
| 417 | + 'info_premier_resultat_sur' => '[@debut_limit@ pierwsze wyniki z @total@]', |
|
| 418 | + 'info_propose_1' => '[@nom_site_spip@] Zatwierdza: @titre@', |
|
| 419 | + 'info_propose_2' => 'Artykuły zatwierdzone |
|
| 420 | 420 | -----------------', |
| 421 | - 'info_propose_3' => 'Artykuł "@titre@" został zatwierdzony do publikacji.', |
|
| 422 | - 'info_propose_4' => 'Zostałeś zaproszony do przeglądu i wyrażenia swojej opinii', |
|
| 423 | - 'info_propose_5' => 'w forum, które jest przyporządkowane. Jest ono dostępne pod adresem :', |
|
| 424 | - 'info_publie_01' => 'Artykuł "@titre@" został zatwierdzony przez @connect_nom@.', |
|
| 425 | - 'info_publie_1' => '[@nom_site_spip@] PUBLIKUJE: @titre@', |
|
| 426 | - 'info_publie_2' => 'Artykuł opublikowany |
|
| 421 | + 'info_propose_3' => 'Artykuł "@titre@" został zatwierdzony do publikacji.', |
|
| 422 | + 'info_propose_4' => 'Zostałeś zaproszony do przeglądu i wyrażenia swojej opinii', |
|
| 423 | + 'info_propose_5' => 'w forum, które jest przyporządkowane. Jest ono dostępne pod adresem :', |
|
| 424 | + 'info_publie_01' => 'Artykuł "@titre@" został zatwierdzony przez @connect_nom@.', |
|
| 425 | + 'info_publie_1' => '[@nom_site_spip@] PUBLIKUJE: @titre@', |
|
| 426 | + 'info_publie_2' => 'Artykuł opublikowany |
|
| 427 | 427 | -----------------', |
| 428 | - 'info_rechercher' => 'Szukaj', |
|
| 429 | - 'info_rechercher_02' => 'Szukaj:', |
|
| 430 | - 'info_remplacer_vignette' => 'Zamień domyślną miniaturkę na wybrane przez ciebie logo :', |
|
| 431 | - 'info_sans_titre_2' => 'bez tytułu', |
|
| 432 | - 'info_selectionner_fichier' => 'Możesz wybrać plik z folderu @upload@', |
|
| 433 | - 'info_selectionner_fichier_2' => 'Wybierz plik:', |
|
| 434 | - 'info_supprimer_vignette' => 'usuń winietę', |
|
| 435 | - 'info_symbole_bleu' => 'Symbol <b>niebieski</b> oznacza <b>notatkę</b>: n.p. wiadomość do prywatnego użytku.', |
|
| 436 | - 'info_symbole_jaune' => 'Symbol <b>żółty</b> oznacza <b>zawiadomienie dla wszystkich redaktorów</b>: może być opublikowana przez wszystkich administratorów, i jest widoczna dla wszystkich redaktorów.', |
|
| 437 | - 'info_symbole_vert' => 'Symbol <b>zielony</b> oznacza <b>wiadomości wymieniane z innymi użytkownikami</b> strony.', |
|
| 438 | - 'info_telecharger_nouveau_logo' => 'Załaduj nowe logo:', |
|
| 439 | - 'info_telecharger_ordinateur' => 'Załaduj ze swojego komputera:', |
|
| 440 | - 'info_tous_resultats_enregistres' => '[wszystkie wyniki są zapisane]', |
|
| 441 | - 'info_tout_afficher' => 'Pokaż wszystko', |
|
| 442 | - 'info_travaux_texte' => 'Ten serwis nie jest jeszcze skonfigurowany. Zapraszamy później...', |
|
| 443 | - 'info_travaux_titre' => 'Strona w trakcie budowy', |
|
| 444 | - 'info_trop_resultat' => 'Zbyt dużo rezultatów "@cherche_mot@" ; spróbuj sprecyzować kryteria wyszukiwania.', |
|
| 445 | - 'info_utilisation_messagerie_interne' => 'Używasz wewnętrznej poczty w tym serwisie.', |
|
| 446 | - 'info_valider_lien' => 'zatwierdź ten link', |
|
| 447 | - 'info_verifier_image' => ', proszę się upewnić, czy obrazki zostały przesłane prawidłowo.', |
|
| 448 | - 'info_vignette_defaut' => 'Domyślna winieta', |
|
| 449 | - 'info_vignette_personnalisee' => 'Miniaturka spersonalizowana', |
|
| 450 | - 'info_visite' => 'odwiedziny:', |
|
| 451 | - 'info_vos_rendez_vous' => 'Twoje przyszłe spotkania', |
|
| 452 | - 'infos_vos_pense_bete' => 'Twoje notatki', # MODIF |
|
| 428 | + 'info_rechercher' => 'Szukaj', |
|
| 429 | + 'info_rechercher_02' => 'Szukaj:', |
|
| 430 | + 'info_remplacer_vignette' => 'Zamień domyślną miniaturkę na wybrane przez ciebie logo :', |
|
| 431 | + 'info_sans_titre_2' => 'bez tytułu', |
|
| 432 | + 'info_selectionner_fichier' => 'Możesz wybrać plik z folderu @upload@', |
|
| 433 | + 'info_selectionner_fichier_2' => 'Wybierz plik:', |
|
| 434 | + 'info_supprimer_vignette' => 'usuń winietę', |
|
| 435 | + 'info_symbole_bleu' => 'Symbol <b>niebieski</b> oznacza <b>notatkę</b>: n.p. wiadomość do prywatnego użytku.', |
|
| 436 | + 'info_symbole_jaune' => 'Symbol <b>żółty</b> oznacza <b>zawiadomienie dla wszystkich redaktorów</b>: może być opublikowana przez wszystkich administratorów, i jest widoczna dla wszystkich redaktorów.', |
|
| 437 | + 'info_symbole_vert' => 'Symbol <b>zielony</b> oznacza <b>wiadomości wymieniane z innymi użytkownikami</b> strony.', |
|
| 438 | + 'info_telecharger_nouveau_logo' => 'Załaduj nowe logo:', |
|
| 439 | + 'info_telecharger_ordinateur' => 'Załaduj ze swojego komputera:', |
|
| 440 | + 'info_tous_resultats_enregistres' => '[wszystkie wyniki są zapisane]', |
|
| 441 | + 'info_tout_afficher' => 'Pokaż wszystko', |
|
| 442 | + 'info_travaux_texte' => 'Ten serwis nie jest jeszcze skonfigurowany. Zapraszamy później...', |
|
| 443 | + 'info_travaux_titre' => 'Strona w trakcie budowy', |
|
| 444 | + 'info_trop_resultat' => 'Zbyt dużo rezultatów "@cherche_mot@" ; spróbuj sprecyzować kryteria wyszukiwania.', |
|
| 445 | + 'info_utilisation_messagerie_interne' => 'Używasz wewnętrznej poczty w tym serwisie.', |
|
| 446 | + 'info_valider_lien' => 'zatwierdź ten link', |
|
| 447 | + 'info_verifier_image' => ', proszę się upewnić, czy obrazki zostały przesłane prawidłowo.', |
|
| 448 | + 'info_vignette_defaut' => 'Domyślna winieta', |
|
| 449 | + 'info_vignette_personnalisee' => 'Miniaturka spersonalizowana', |
|
| 450 | + 'info_visite' => 'odwiedziny:', |
|
| 451 | + 'info_vos_rendez_vous' => 'Twoje przyszłe spotkania', |
|
| 452 | + 'infos_vos_pense_bete' => 'Twoje notatki', # MODIF |
|
| 453 | 453 | |
| 454 | - // L |
|
| 455 | - 'lien_afficher_icones_seuls' => 'Pokazuj tylko ikonki', |
|
| 456 | - 'lien_afficher_texte_icones' => 'POkazuj ikonki i tekst', |
|
| 457 | - 'lien_afficher_texte_seul' => 'Pokazuj tylko tekst', |
|
| 458 | - 'lien_liberer' => 'uwolnij', |
|
| 459 | - 'lien_liberer_tous' => 'uwolnij artykuły', # MODIF |
|
| 460 | - 'lien_nouvea_pense_bete' => 'NOWA NOTATKA', |
|
| 461 | - 'lien_nouveau_message' => 'NOWA WIADOMOŚĆ', |
|
| 462 | - 'lien_nouvelle_annonce' => 'NOWE ZAWIADOMIENIE', |
|
| 463 | - 'lien_petitions' => 'OGŁOSZENIE', |
|
| 464 | - 'lien_popularite' => 'popularność: @popularite@%', |
|
| 465 | - 'lien_racine_site' => 'RDZEŃ STRONY', |
|
| 466 | - 'lien_reessayer' => 'spróbuj ponownie', |
|
| 467 | - 'lien_repondre_message' => 'Odpowiedz na tę wiadomość', |
|
| 468 | - 'lien_supprimer' => 'usuń', |
|
| 469 | - 'lien_tout_afficher' => 'Pokaż wszystko', |
|
| 470 | - 'lien_visite_site' => 'odwiedź stronę', |
|
| 471 | - 'lien_visites' => '@visites@ odwiedzin', |
|
| 472 | - 'lien_voir_auteur' => 'Sprawdź autora', |
|
| 473 | - 'ligne' => 'Linia', |
|
| 474 | - 'login' => 'Połączenie', |
|
| 475 | - 'login_acces_prive' => 'dostęp do obszaru prywatnego', |
|
| 476 | - 'login_autre_identifiant' => 'zaloguj używając innego loginu', |
|
| 477 | - 'login_cookie_accepte' => 'Zmień ustawienia Twojej przeglądarki, aby je akceptowała (przynajmniej dla tej strony).', |
|
| 478 | - 'login_cookie_oblige' => 'Aby móc zalogować się bezpiecznie do tej strony, musicie zaakceptować cookies.', |
|
| 479 | - 'login_deconnexion_ok' => 'Rozłączanie zakończono.', |
|
| 480 | - 'login_erreur_pass' => 'Błąd hasła.', |
|
| 481 | - 'login_espace_prive' => 'obszar prywatny', |
|
| 482 | - 'login_identifiant_inconnu' => 'Login « @login@ » nieznany.', |
|
| 483 | - 'login_login' => 'Login:', |
|
| 484 | - 'login_login2' => 'Login (identyfikator) :', # MODIF |
|
| 485 | - 'login_login_pass_incorrect' => '(Zły login lub hasło).', |
|
| 486 | - 'login_motpasseoublie' => 'zapomniałeś hasła?', |
|
| 487 | - 'login_non_securise' => 'Uwaga ten formularz nie jest bezpieczny. |
|
| 454 | + // L |
|
| 455 | + 'lien_afficher_icones_seuls' => 'Pokazuj tylko ikonki', |
|
| 456 | + 'lien_afficher_texte_icones' => 'POkazuj ikonki i tekst', |
|
| 457 | + 'lien_afficher_texte_seul' => 'Pokazuj tylko tekst', |
|
| 458 | + 'lien_liberer' => 'uwolnij', |
|
| 459 | + 'lien_liberer_tous' => 'uwolnij artykuły', # MODIF |
|
| 460 | + 'lien_nouvea_pense_bete' => 'NOWA NOTATKA', |
|
| 461 | + 'lien_nouveau_message' => 'NOWA WIADOMOŚĆ', |
|
| 462 | + 'lien_nouvelle_annonce' => 'NOWE ZAWIADOMIENIE', |
|
| 463 | + 'lien_petitions' => 'OGŁOSZENIE', |
|
| 464 | + 'lien_popularite' => 'popularność: @popularite@%', |
|
| 465 | + 'lien_racine_site' => 'RDZEŃ STRONY', |
|
| 466 | + 'lien_reessayer' => 'spróbuj ponownie', |
|
| 467 | + 'lien_repondre_message' => 'Odpowiedz na tę wiadomość', |
|
| 468 | + 'lien_supprimer' => 'usuń', |
|
| 469 | + 'lien_tout_afficher' => 'Pokaż wszystko', |
|
| 470 | + 'lien_visite_site' => 'odwiedź stronę', |
|
| 471 | + 'lien_visites' => '@visites@ odwiedzin', |
|
| 472 | + 'lien_voir_auteur' => 'Sprawdź autora', |
|
| 473 | + 'ligne' => 'Linia', |
|
| 474 | + 'login' => 'Połączenie', |
|
| 475 | + 'login_acces_prive' => 'dostęp do obszaru prywatnego', |
|
| 476 | + 'login_autre_identifiant' => 'zaloguj używając innego loginu', |
|
| 477 | + 'login_cookie_accepte' => 'Zmień ustawienia Twojej przeglądarki, aby je akceptowała (przynajmniej dla tej strony).', |
|
| 478 | + 'login_cookie_oblige' => 'Aby móc zalogować się bezpiecznie do tej strony, musicie zaakceptować cookies.', |
|
| 479 | + 'login_deconnexion_ok' => 'Rozłączanie zakończono.', |
|
| 480 | + 'login_erreur_pass' => 'Błąd hasła.', |
|
| 481 | + 'login_espace_prive' => 'obszar prywatny', |
|
| 482 | + 'login_identifiant_inconnu' => 'Login « @login@ » nieznany.', |
|
| 483 | + 'login_login' => 'Login:', |
|
| 484 | + 'login_login2' => 'Login (identyfikator) :', # MODIF |
|
| 485 | + 'login_login_pass_incorrect' => '(Zły login lub hasło).', |
|
| 486 | + 'login_motpasseoublie' => 'zapomniałeś hasła?', |
|
| 487 | + 'login_non_securise' => 'Uwaga ten formularz nie jest bezpieczny. |
|
| 488 | 488 | Jeśli nie chcesz aby Twoje hasło zostało przechwycone w sieci |
| 489 | 489 | , włącz JavaScript w Twojej przeglądarce i', |
| 490 | - 'login_nouvelle_tentative' => 'Nowa próba', |
|
| 491 | - 'login_par_ici' => 'Jesteś zarejestrowany... tędy...', |
|
| 492 | - 'login_pass2' => 'Hasło:', |
|
| 493 | - 'login_preferez_refuser' => '<b>Jeśli wolisz nie korzystać z cookies</b>, jest inna (mniej bezpieczna) metoda do dyspozycji :', |
|
| 494 | - 'login_recharger' => 'przeładuj stronę', |
|
| 495 | - 'login_rester_identifie' => 'Pozostań zalogowany kilka dni', # MODIF |
|
| 496 | - 'login_retour_public' => 'Powrót do strony publicznej', |
|
| 497 | - 'login_retour_site' => 'Powrót do strony publicznej', |
|
| 498 | - 'login_retoursitepublic' => 'Powrót do strony publicznej', |
|
| 499 | - 'login_sinscrire' => 'rejestracja', # MODIF |
|
| 500 | - 'login_test_navigateur' => 'test przeglądarki/łącz ponownie', |
|
| 501 | - 'login_verifiez_navigateur' => '(Sprawdź czy Twoja przeglądarka nie zapamiętała hasła...)', |
|
| 490 | + 'login_nouvelle_tentative' => 'Nowa próba', |
|
| 491 | + 'login_par_ici' => 'Jesteś zarejestrowany... tędy...', |
|
| 492 | + 'login_pass2' => 'Hasło:', |
|
| 493 | + 'login_preferez_refuser' => '<b>Jeśli wolisz nie korzystać z cookies</b>, jest inna (mniej bezpieczna) metoda do dyspozycji :', |
|
| 494 | + 'login_recharger' => 'przeładuj stronę', |
|
| 495 | + 'login_rester_identifie' => 'Pozostań zalogowany kilka dni', # MODIF |
|
| 496 | + 'login_retour_public' => 'Powrót do strony publicznej', |
|
| 497 | + 'login_retour_site' => 'Powrót do strony publicznej', |
|
| 498 | + 'login_retoursitepublic' => 'Powrót do strony publicznej', |
|
| 499 | + 'login_sinscrire' => 'rejestracja', # MODIF |
|
| 500 | + 'login_test_navigateur' => 'test przeglądarki/łącz ponownie', |
|
| 501 | + 'login_verifiez_navigateur' => '(Sprawdź czy Twoja przeglądarka nie zapamiętała hasła...)', |
|
| 502 | 502 | |
| 503 | - // M |
|
| 504 | - 'masquer_trad' => 'ukryj tlumaczenia', |
|
| 505 | - 'module_fichiers_langues' => 'Pliki językowe', |
|
| 503 | + // M |
|
| 504 | + 'masquer_trad' => 'ukryj tlumaczenia', |
|
| 505 | + 'module_fichiers_langues' => 'Pliki językowe', |
|
| 506 | 506 | |
| 507 | - // N |
|
| 508 | - 'navigateur_pas_redirige' => 'Jeśli twoja przeglądarka cię nie przekierowała, kliknij tutaj, żeby kontynuować.', |
|
| 509 | - 'numero' => 'Numer', |
|
| 507 | + // N |
|
| 508 | + 'navigateur_pas_redirige' => 'Jeśli twoja przeglądarka cię nie przekierowała, kliknij tutaj, żeby kontynuować.', |
|
| 509 | + 'numero' => 'Numer', |
|
| 510 | 510 | |
| 511 | - // O |
|
| 512 | - 'occurence' => 'Wystąpienie', |
|
| 513 | - 'onglet_affacer_base' => 'Usuń bazę danych', |
|
| 514 | - 'onglet_auteur' => 'Autor', |
|
| 515 | - 'onglet_contenu_site' => 'Zawartość strony', |
|
| 516 | - 'onglet_evolution_visite_mod' => 'Ewolucja', |
|
| 517 | - 'onglet_fonctions_avances' => 'Funkcje zaawansowane', |
|
| 518 | - 'onglet_informations_personnelles' => 'Informacje osobiste', |
|
| 519 | - 'onglet_interactivite' => 'Interaktywność', |
|
| 520 | - 'onglet_messagerie' => 'Wiadomości', |
|
| 521 | - 'onglet_repartition_rubrique' => 'Rozłożenie działów', |
|
| 522 | - 'onglet_save_restaur_base' => 'Backup/zapisywanie bazy danych', |
|
| 523 | - 'onglet_vider_cache' => 'Opróżnij cache', |
|
| 511 | + // O |
|
| 512 | + 'occurence' => 'Wystąpienie', |
|
| 513 | + 'onglet_affacer_base' => 'Usuń bazę danych', |
|
| 514 | + 'onglet_auteur' => 'Autor', |
|
| 515 | + 'onglet_contenu_site' => 'Zawartość strony', |
|
| 516 | + 'onglet_evolution_visite_mod' => 'Ewolucja', |
|
| 517 | + 'onglet_fonctions_avances' => 'Funkcje zaawansowane', |
|
| 518 | + 'onglet_informations_personnelles' => 'Informacje osobiste', |
|
| 519 | + 'onglet_interactivite' => 'Interaktywność', |
|
| 520 | + 'onglet_messagerie' => 'Wiadomości', |
|
| 521 | + 'onglet_repartition_rubrique' => 'Rozłożenie działów', |
|
| 522 | + 'onglet_save_restaur_base' => 'Backup/zapisywanie bazy danych', |
|
| 523 | + 'onglet_vider_cache' => 'Opróżnij cache', |
|
| 524 | 524 | |
| 525 | - // P |
|
| 526 | - 'pass_choix_pass' => 'Proszę wybrać swoje nowe hasło:', |
|
| 527 | - 'pass_erreur' => 'Błąd', |
|
| 528 | - 'pass_erreur_acces_refuse' => '<b>Błąd:</b> nie masz już dostępu do tej strony.', |
|
| 529 | - 'pass_erreur_code_inconnu' => '<b>Błąd :</b> ten kod nie odpowiada, żadnemu z użytkowników, którzy mają dostęp do tej strony.', |
|
| 530 | - 'pass_erreur_non_enregistre' => '<b>Błąd :</b> adres <tt>@email_oubli@</tt> nie jest zarejestrowany na tej stronie.', |
|
| 531 | - 'pass_erreur_non_valide' => '<b>Błąd :</b> e-mail <tt>@email_oubli@</tt> nie jest prawidłowy!', |
|
| 532 | - 'pass_erreur_probleme_technique' => '<b>Bład :</b> e-mail nie mógł być wysłany z powodu problemów technicznych.', |
|
| 533 | - 'pass_espace_prive_bla' => 'Strefa prywatna tego serwisu jest dostęna |
|
| 525 | + // P |
|
| 526 | + 'pass_choix_pass' => 'Proszę wybrać swoje nowe hasło:', |
|
| 527 | + 'pass_erreur' => 'Błąd', |
|
| 528 | + 'pass_erreur_acces_refuse' => '<b>Błąd:</b> nie masz już dostępu do tej strony.', |
|
| 529 | + 'pass_erreur_code_inconnu' => '<b>Błąd :</b> ten kod nie odpowiada, żadnemu z użytkowników, którzy mają dostęp do tej strony.', |
|
| 530 | + 'pass_erreur_non_enregistre' => '<b>Błąd :</b> adres <tt>@email_oubli@</tt> nie jest zarejestrowany na tej stronie.', |
|
| 531 | + 'pass_erreur_non_valide' => '<b>Błąd :</b> e-mail <tt>@email_oubli@</tt> nie jest prawidłowy!', |
|
| 532 | + 'pass_erreur_probleme_technique' => '<b>Bład :</b> e-mail nie mógł być wysłany z powodu problemów technicznych.', |
|
| 533 | + 'pass_espace_prive_bla' => 'Strefa prywatna tego serwisu jest dostęna |
|
| 534 | 534 | dla zapisanych użytkowników. Jako zarejestrowany użytkownik, |
| 535 | 535 | będziesz mógł czytać artykuły, które są w trakcie redagowania, |
| 536 | 536 | proponować artykuły i brać udział w dyskusjach na forum.', |
| 537 | - 'pass_forum_bla' => 'Chcesz wziąć udział w forum |
|
| 537 | + 'pass_forum_bla' => 'Chcesz wziąć udział w forum |
|
| 538 | 538 | zarezerwowanym dla zarejestrowanych użytkowników.', |
| 539 | - 'pass_indiquez_cidessous' => 'Wpisz poniżej adres e-mail pod jakim |
|
| 539 | + 'pass_indiquez_cidessous' => 'Wpisz poniżej adres e-mail pod jakim |
|
| 540 | 540 | byłeś zarejestrowany poprzednio. |
| 541 | 541 | Otrzymasz e-maila wyjaśniającego jak |
| 542 | 542 | możesz odzyskać swój dostęp.', |
| 543 | - 'pass_mail_passcookie' => '(to jest automatyczna wiadomość) |
|
| 543 | + 'pass_mail_passcookie' => '(to jest automatyczna wiadomość) |
|
| 544 | 544 | |
| 545 | 545 | Aby odzyskać dostęp do strony |
| 546 | 546 | @nom_site_spip@ (@adresse_site@) |
@@ -552,128 +552,128 @@ discard block |
||
| 552 | 552 | Po wpisaniu nowego hasła |
| 553 | 553 | można ponownie połączyć się ze stroną. |
| 554 | 554 | ', |
| 555 | - 'pass_mot_oublie' => 'Zapomniane hasło', |
|
| 556 | - 'pass_nouveau_enregistre' => 'Twoje nowe hasło zostało zapisane.', |
|
| 557 | - 'pass_nouveau_pass' => 'Nowe hasło', |
|
| 558 | - 'pass_ok' => 'OK', |
|
| 559 | - 'pass_oubli_mot' => 'Zapomnienie hasła', |
|
| 560 | - 'pass_quitter_fenetre' => 'Zamknij okno', |
|
| 561 | - 'pass_rappel_login' => 'Przypomnienie : twój identyfikator (login) to « @login@ ».', |
|
| 562 | - 'pass_recevoir_mail' => 'Otrzymasz e-mail wyjaśniający jak możesz odzyskać dostęp do strony.', # MODIF |
|
| 563 | - 'pass_retour_public' => 'Powrót do strony publicznej', |
|
| 564 | - 'pass_rien_a_faire_ici' => 'Nie ma tu nic do zrobienia.', |
|
| 565 | - 'pass_vousinscrire' => 'Zapisaś się w tym serwisie', |
|
| 566 | - 'precedent' => 'poprzedni', |
|
| 567 | - 'previsualisation' => 'Podgląd', |
|
| 568 | - 'previsualiser' => 'Włącz podgląd', |
|
| 555 | + 'pass_mot_oublie' => 'Zapomniane hasło', |
|
| 556 | + 'pass_nouveau_enregistre' => 'Twoje nowe hasło zostało zapisane.', |
|
| 557 | + 'pass_nouveau_pass' => 'Nowe hasło', |
|
| 558 | + 'pass_ok' => 'OK', |
|
| 559 | + 'pass_oubli_mot' => 'Zapomnienie hasła', |
|
| 560 | + 'pass_quitter_fenetre' => 'Zamknij okno', |
|
| 561 | + 'pass_rappel_login' => 'Przypomnienie : twój identyfikator (login) to « @login@ ».', |
|
| 562 | + 'pass_recevoir_mail' => 'Otrzymasz e-mail wyjaśniający jak możesz odzyskać dostęp do strony.', # MODIF |
|
| 563 | + 'pass_retour_public' => 'Powrót do strony publicznej', |
|
| 564 | + 'pass_rien_a_faire_ici' => 'Nie ma tu nic do zrobienia.', |
|
| 565 | + 'pass_vousinscrire' => 'Zapisaś się w tym serwisie', |
|
| 566 | + 'precedent' => 'poprzedni', |
|
| 567 | + 'previsualisation' => 'Podgląd', |
|
| 568 | + 'previsualiser' => 'Włącz podgląd', |
|
| 569 | 569 | |
| 570 | - // R |
|
| 571 | - 'retour' => 'Powrót', |
|
| 570 | + // R |
|
| 571 | + 'retour' => 'Powrót', |
|
| 572 | 572 | |
| 573 | - // S |
|
| 574 | - 'spip_conforme_dtd' => 'SPIP uznaje ten dokument za zgodny z jego DOCTYPE :', |
|
| 575 | - 'squelette' => 'szkielet', |
|
| 576 | - 'squelette_inclus_ligne' => 'szkielet zainkludowany, linia', |
|
| 577 | - 'squelette_ligne' => 'szkielet, linia', |
|
| 578 | - 'stats_visites_et_popularite' => '@visites@ odwiedzin; popularność: @popularite@', |
|
| 579 | - 'suivant' => 'następny', |
|
| 573 | + // S |
|
| 574 | + 'spip_conforme_dtd' => 'SPIP uznaje ten dokument za zgodny z jego DOCTYPE :', |
|
| 575 | + 'squelette' => 'szkielet', |
|
| 576 | + 'squelette_inclus_ligne' => 'szkielet zainkludowany, linia', |
|
| 577 | + 'squelette_ligne' => 'szkielet, linia', |
|
| 578 | + 'stats_visites_et_popularite' => '@visites@ odwiedzin; popularność: @popularite@', |
|
| 579 | + 'suivant' => 'następny', |
|
| 580 | 580 | |
| 581 | - // T |
|
| 582 | - 'taille_ko' => '@taille@ kb', |
|
| 583 | - 'taille_mo' => '@taille@ Mb', |
|
| 584 | - 'taille_octets' => '@taille@ bytes', |
|
| 585 | - 'taille_octets_bi' => '@taille@ bytes', |
|
| 586 | - 'texte_actualite_site_1' => 'Kiedy poznasz interfejs, kliknij na «', |
|
| 587 | - 'texte_actualite_site_2' => 'kompletny interfejs', |
|
| 588 | - 'texte_actualite_site_3' => '» aby uruchomić więcej możliwości.', |
|
| 589 | - 'texte_creation_automatique_vignette' => 'W tym serwisie, uruchomione jest generowanie minitaurek.Jeśli instalujecie za pośrednictwem tego formularza pliki graficzne w formatach @gd_formats@, zostaną one uzupełnione o minitaurkę, o miniaturkę w wielkości maksymalnej: @taille_preview@ pixels.', |
|
| 590 | - 'texte_documents_associes' => 'Następujące dokumenty są związane z artykułem, |
|
| 581 | + // T |
|
| 582 | + 'taille_ko' => '@taille@ kb', |
|
| 583 | + 'taille_mo' => '@taille@ Mb', |
|
| 584 | + 'taille_octets' => '@taille@ bytes', |
|
| 585 | + 'taille_octets_bi' => '@taille@ bytes', |
|
| 586 | + 'texte_actualite_site_1' => 'Kiedy poznasz interfejs, kliknij na «', |
|
| 587 | + 'texte_actualite_site_2' => 'kompletny interfejs', |
|
| 588 | + 'texte_actualite_site_3' => '» aby uruchomić więcej możliwości.', |
|
| 589 | + 'texte_creation_automatique_vignette' => 'W tym serwisie, uruchomione jest generowanie minitaurek.Jeśli instalujecie za pośrednictwem tego formularza pliki graficzne w formatach @gd_formats@, zostaną one uzupełnione o minitaurkę, o miniaturkę w wielkości maksymalnej: @taille_preview@ pixels.', |
|
| 590 | + 'texte_documents_associes' => 'Następujące dokumenty są związane z artykułem, |
|
| 591 | 591 | ale nie zostały bezpośrednio do niego |
| 592 | 592 | dołączone. Zależnie od układu stron publicznych, |
| 593 | 593 | będę mogły pojawić się na nich jako załączniki.', |
| 594 | - 'texte_erreur_mise_niveau_base' => 'Błąd bazy danych zaistniały w trakcie uaktualniania. |
|
| 594 | + 'texte_erreur_mise_niveau_base' => 'Błąd bazy danych zaistniały w trakcie uaktualniania. |
|
| 595 | 595 | Obrazek <b>@fichier@</b> nie przeszedł (artykuł @id_article@). |
| 596 | 596 | Zapisz te dane, i spróbuj ponownego uaktualnienia, |
| 597 | 597 | a następnie sprawdź czy obrazki pojawiają się zawsze w artykułach.', |
| 598 | - 'texte_erreur_visiteur' => 'Próbujesz dostać się do panelu administracyjnego za pomocą loginu, który na to nie pozwala.', |
|
| 599 | - 'texte_inc_auth_1' => 'Jesteś zalogowany za pomocą |
|
| 598 | + 'texte_erreur_visiteur' => 'Próbujesz dostać się do panelu administracyjnego za pomocą loginu, który na to nie pozwala.', |
|
| 599 | + 'texte_inc_auth_1' => 'Jesteś zalogowany za pomocą |
|
| 600 | 600 | loginu <b>@auth_login@</b>, ale nie istnieje on (już) w bazie danych. |
| 601 | 601 | Spróbuj się', # MODIF |
| 602 | - 'texte_inc_auth_2' => 'połączyć', |
|
| 603 | - 'texte_inc_auth_3' => ', opuszczjąc ewentualnie przeglądarkę |
|
| 602 | + 'texte_inc_auth_2' => 'połączyć', |
|
| 603 | + 'texte_inc_auth_3' => ', opuszczjąc ewentualnie przeglądarkę |
|
| 604 | 604 | i włączając ją na powrót.', |
| 605 | - 'texte_inc_config' => 'Zmiany dokonane na tych stronach znacząco wpłyną na |
|
| 605 | + 'texte_inc_config' => 'Zmiany dokonane na tych stronach znacząco wpłyną na |
|
| 606 | 606 | funkcjonowanie Twojego serwisu. Radzimy nie zatwierdzać tych zmian do momentu, w którym nie będziecie |
| 607 | 607 | dobrze obeznani z funkcjonowaniem systemu SPIP. <br /><br /><b>Najbardziej |
| 608 | 608 | zalecamy, poproszenie o dokonanie zmian głównego adminsitratora serwisu.</b>', |
| 609 | - 'texte_inc_meta_1' => 'System nie może zapisać plików <code>@fichier@</code>. Jako administrator strony,', |
|
| 610 | - 'texte_inc_meta_2' => 'sprawdź pozwolenia zapisu', |
|
| 611 | - 'texte_inc_meta_3' => 'dla katalogu <code>@repertoire@</code>.', |
|
| 612 | - 'texte_statut_en_cours_redaction' => 'redakcja w toku', |
|
| 613 | - 'texte_statut_poubelle' => 'do kosza', |
|
| 614 | - 'texte_statut_propose_evaluation' => 'zaproponowany do oceny', |
|
| 615 | - 'texte_statut_publie' => 'opublikowany online', |
|
| 616 | - 'texte_statut_refuse' => 'odrzucony', |
|
| 617 | - 'titre_ajouter_mot_cle' => 'DODAJ SŁOWO KLUCZOWE:', |
|
| 618 | - 'titre_cadre_raccourcis' => 'SKRÓTY :', |
|
| 619 | - 'titre_changer_couleur_interface' => 'Zmiana koloru interfejsu', |
|
| 620 | - 'titre_image_admin_article' => 'Możesz edytować ten artykuł', |
|
| 621 | - 'titre_image_administrateur' => 'Administrator', |
|
| 622 | - 'titre_image_aide' => 'Pomoc do tego elementu', |
|
| 623 | - 'titre_image_auteur_supprime' => 'Autor usunięty', |
|
| 624 | - 'titre_image_redacteur' => 'Redaktor bez dostępu', |
|
| 625 | - 'titre_image_redacteur_02' => 'Redaktor', |
|
| 626 | - 'titre_image_visiteur' => 'Odwiedzający', |
|
| 627 | - 'titre_joindre_document' => 'ZAŁĄCZ DOKUMENT', |
|
| 628 | - 'titre_mots_cles' => 'SŁOWA KLUCZOWE', |
|
| 629 | - 'titre_probleme_technique' => 'Uwaga: problem techniczny (serwer SQL) blokuje dostęp do tej części strony. Dziękujemy za zrozumienie.', |
|
| 630 | - 'titre_publier_document' => 'PUBLIKUJ DOKUMENT W TYM DZIALE', |
|
| 631 | - 'titre_statistiques' => 'Statystyki strony', |
|
| 632 | - 'titre_titre_document' => 'Tytuł dokumentu:', |
|
| 633 | - 'trad_reference' => '(artykuł wzorcowy)', # MODIF |
|
| 609 | + 'texte_inc_meta_1' => 'System nie może zapisać plików <code>@fichier@</code>. Jako administrator strony,', |
|
| 610 | + 'texte_inc_meta_2' => 'sprawdź pozwolenia zapisu', |
|
| 611 | + 'texte_inc_meta_3' => 'dla katalogu <code>@repertoire@</code>.', |
|
| 612 | + 'texte_statut_en_cours_redaction' => 'redakcja w toku', |
|
| 613 | + 'texte_statut_poubelle' => 'do kosza', |
|
| 614 | + 'texte_statut_propose_evaluation' => 'zaproponowany do oceny', |
|
| 615 | + 'texte_statut_publie' => 'opublikowany online', |
|
| 616 | + 'texte_statut_refuse' => 'odrzucony', |
|
| 617 | + 'titre_ajouter_mot_cle' => 'DODAJ SŁOWO KLUCZOWE:', |
|
| 618 | + 'titre_cadre_raccourcis' => 'SKRÓTY :', |
|
| 619 | + 'titre_changer_couleur_interface' => 'Zmiana koloru interfejsu', |
|
| 620 | + 'titre_image_admin_article' => 'Możesz edytować ten artykuł', |
|
| 621 | + 'titre_image_administrateur' => 'Administrator', |
|
| 622 | + 'titre_image_aide' => 'Pomoc do tego elementu', |
|
| 623 | + 'titre_image_auteur_supprime' => 'Autor usunięty', |
|
| 624 | + 'titre_image_redacteur' => 'Redaktor bez dostępu', |
|
| 625 | + 'titre_image_redacteur_02' => 'Redaktor', |
|
| 626 | + 'titre_image_visiteur' => 'Odwiedzający', |
|
| 627 | + 'titre_joindre_document' => 'ZAŁĄCZ DOKUMENT', |
|
| 628 | + 'titre_mots_cles' => 'SŁOWA KLUCZOWE', |
|
| 629 | + 'titre_probleme_technique' => 'Uwaga: problem techniczny (serwer SQL) blokuje dostęp do tej części strony. Dziękujemy za zrozumienie.', |
|
| 630 | + 'titre_publier_document' => 'PUBLIKUJ DOKUMENT W TYM DZIALE', |
|
| 631 | + 'titre_statistiques' => 'Statystyki strony', |
|
| 632 | + 'titre_titre_document' => 'Tytuł dokumentu:', |
|
| 633 | + 'trad_reference' => '(artykuł wzorcowy)', # MODIF |
|
| 634 | 634 | |
| 635 | - // Z |
|
| 636 | - 'zbug_balise_b_aval' => ' : balise B en aval', |
|
| 637 | - 'zbug_balise_inexistante' => 'erreur @from@: la balise #@balise@ n’existe pas', # MODIF |
|
| 638 | - 'zbug_boucle' => 'pętla', |
|
| 639 | - 'zbug_boucle_recursive_undef' => 'pętla rekursywna nie została zdefiniowana', # MODIF |
|
| 640 | - 'zbug_champ_hors_boucle' => 'Pole @champ@ jest bez pętli', |
|
| 641 | - 'zbug_champ_hors_motif' => 'Pole @champ@ jest poza pętlą @motif@', # MODIF |
|
| 642 | - 'zbug_code' => 'kod', |
|
| 643 | - 'zbug_critere_inconnu' => 'nieznane kryterium @critere@', # MODIF |
|
| 644 | - 'zbug_distant_interdit' => 'operacja niedozwolona w zewnętrznej bazie', # MODIF |
|
| 645 | - 'zbug_doublon_table_sans_cle_primaire' => 'doublons sur une table sans clef primaire atomique', # MODIF |
|
| 646 | - 'zbug_doublon_table_sans_index' => 'podwójny wpis w tablicy bez indeksu', # MODIF |
|
| 647 | - 'zbug_erreur_boucle_double' => 'BOUCLE@id@: podwójna definicja', # MODIF |
|
| 648 | - 'zbug_erreur_boucle_fermant' => 'BOUCLE@id@: brakuje znacznika zamykającego', # MODIF |
|
| 649 | - 'zbug_erreur_boucle_syntaxe' => 'Składnia pętli (boucle) nieprawidłowa', # MODIF |
|
| 650 | - 'zbug_erreur_compilation' => 'Błąd kompilacji', |
|
| 651 | - 'zbug_erreur_execution_page' => 'błąd w wykonaniu strony', # MODIF |
|
| 652 | - 'zbug_erreur_filtre' => 'Błąd : filtr <b>« @filtre@ »</b> nie zdefiniowany', # MODIF |
|
| 653 | - 'zbug_erreur_meme_parent' => '{meme_parent} stosuje się wyłącznie do pętli (FORUMS) i (RUBRIQUES)', # MODIF |
|
| 654 | - 'zbug_erreur_squelette' => 'Błąd (błędy) w szkielecie', |
|
| 655 | - 'zbug_info_erreur_squelette' => 'Błąd na stronie', |
|
| 656 | - 'zbug_inversion_ordre_inexistant' => 'odwrócenie nieistniejącego uporządkowania', # MODIF |
|
| 657 | - 'zbug_pagination_sans_critere' => '#PAGINATION bez kryterium {pagination} lub użyta w pętli rekursywnej', # MODIF |
|
| 658 | - 'zbug_parametres_inclus_incorrects' => 'Złe parametry załączenia (include)', # MODIF |
|
| 659 | - 'zbug_profile' => 'Czas przeliczania: @time@', |
|
| 660 | - 'zbug_resultat' => 'wynik', |
|
| 661 | - 'zbug_serveur_indefini' => 'serwer SQL niezdefiniowany', # MODIF |
|
| 662 | - 'zbug_table_inconnue' => 'Tabela SQL « @table@ » nieznana', |
|
| 663 | - 'zxml_connus_attributs' => 'znane atrybuty', |
|
| 664 | - 'zxml_de' => 'z', |
|
| 665 | - 'zxml_inconnu_attribut' => 'atrybut nieznany', |
|
| 666 | - 'zxml_inconnu_balise' => 'znacznik nieznany', |
|
| 667 | - 'zxml_inconnu_entite' => 'nieznana wartość', |
|
| 668 | - 'zxml_inconnu_id' => 'ID nieznany', |
|
| 669 | - 'zxml_mais_de' => 'ale z', |
|
| 670 | - 'zxml_non_conforme' => 'nie jest zgodny', |
|
| 671 | - 'zxml_non_fils' => 'nie jest z', |
|
| 672 | - 'zxml_nonvide_balise' => 'znacznik nie jest pusty', |
|
| 673 | - 'zxml_obligatoire_attribut' => 'nieobecny atrybut obowiązkowy', |
|
| 674 | - 'zxml_succession_fils_incorrecte' => 'niepoprawne dziedziczenie', |
|
| 675 | - 'zxml_survoler' => 'najedź wskaźnikiem aby zobaczyć poprawne', |
|
| 676 | - 'zxml_valeur_attribut' => 'wartość artybutu', |
|
| 677 | - 'zxml_vide_balise' => 'pusty znacznik', |
|
| 678 | - 'zxml_vu' => 'widziany wcześniej', |
|
| 635 | + // Z |
|
| 636 | + 'zbug_balise_b_aval' => ' : balise B en aval', |
|
| 637 | + 'zbug_balise_inexistante' => 'erreur @from@: la balise #@balise@ n’existe pas', # MODIF |
|
| 638 | + 'zbug_boucle' => 'pętla', |
|
| 639 | + 'zbug_boucle_recursive_undef' => 'pętla rekursywna nie została zdefiniowana', # MODIF |
|
| 640 | + 'zbug_champ_hors_boucle' => 'Pole @champ@ jest bez pętli', |
|
| 641 | + 'zbug_champ_hors_motif' => 'Pole @champ@ jest poza pętlą @motif@', # MODIF |
|
| 642 | + 'zbug_code' => 'kod', |
|
| 643 | + 'zbug_critere_inconnu' => 'nieznane kryterium @critere@', # MODIF |
|
| 644 | + 'zbug_distant_interdit' => 'operacja niedozwolona w zewnętrznej bazie', # MODIF |
|
| 645 | + 'zbug_doublon_table_sans_cle_primaire' => 'doublons sur une table sans clef primaire atomique', # MODIF |
|
| 646 | + 'zbug_doublon_table_sans_index' => 'podwójny wpis w tablicy bez indeksu', # MODIF |
|
| 647 | + 'zbug_erreur_boucle_double' => 'BOUCLE@id@: podwójna definicja', # MODIF |
|
| 648 | + 'zbug_erreur_boucle_fermant' => 'BOUCLE@id@: brakuje znacznika zamykającego', # MODIF |
|
| 649 | + 'zbug_erreur_boucle_syntaxe' => 'Składnia pętli (boucle) nieprawidłowa', # MODIF |
|
| 650 | + 'zbug_erreur_compilation' => 'Błąd kompilacji', |
|
| 651 | + 'zbug_erreur_execution_page' => 'błąd w wykonaniu strony', # MODIF |
|
| 652 | + 'zbug_erreur_filtre' => 'Błąd : filtr <b>« @filtre@ »</b> nie zdefiniowany', # MODIF |
|
| 653 | + 'zbug_erreur_meme_parent' => '{meme_parent} stosuje się wyłącznie do pętli (FORUMS) i (RUBRIQUES)', # MODIF |
|
| 654 | + 'zbug_erreur_squelette' => 'Błąd (błędy) w szkielecie', |
|
| 655 | + 'zbug_info_erreur_squelette' => 'Błąd na stronie', |
|
| 656 | + 'zbug_inversion_ordre_inexistant' => 'odwrócenie nieistniejącego uporządkowania', # MODIF |
|
| 657 | + 'zbug_pagination_sans_critere' => '#PAGINATION bez kryterium {pagination} lub użyta w pętli rekursywnej', # MODIF |
|
| 658 | + 'zbug_parametres_inclus_incorrects' => 'Złe parametry załączenia (include)', # MODIF |
|
| 659 | + 'zbug_profile' => 'Czas przeliczania: @time@', |
|
| 660 | + 'zbug_resultat' => 'wynik', |
|
| 661 | + 'zbug_serveur_indefini' => 'serwer SQL niezdefiniowany', # MODIF |
|
| 662 | + 'zbug_table_inconnue' => 'Tabela SQL « @table@ » nieznana', |
|
| 663 | + 'zxml_connus_attributs' => 'znane atrybuty', |
|
| 664 | + 'zxml_de' => 'z', |
|
| 665 | + 'zxml_inconnu_attribut' => 'atrybut nieznany', |
|
| 666 | + 'zxml_inconnu_balise' => 'znacznik nieznany', |
|
| 667 | + 'zxml_inconnu_entite' => 'nieznana wartość', |
|
| 668 | + 'zxml_inconnu_id' => 'ID nieznany', |
|
| 669 | + 'zxml_mais_de' => 'ale z', |
|
| 670 | + 'zxml_non_conforme' => 'nie jest zgodny', |
|
| 671 | + 'zxml_non_fils' => 'nie jest z', |
|
| 672 | + 'zxml_nonvide_balise' => 'znacznik nie jest pusty', |
|
| 673 | + 'zxml_obligatoire_attribut' => 'nieobecny atrybut obowiązkowy', |
|
| 674 | + 'zxml_succession_fils_incorrecte' => 'niepoprawne dziedziczenie', |
|
| 675 | + 'zxml_survoler' => 'najedź wskaźnikiem aby zobaczyć poprawne', |
|
| 676 | + 'zxml_valeur_attribut' => 'wartość artybutu', |
|
| 677 | + 'zxml_vide_balise' => 'pusty znacznik', |
|
| 678 | + 'zxml_vu' => 'widziany wcześniej', |
|
| 679 | 679 | ]; |
@@ -5,100 +5,100 @@ |
||
| 5 | 5 | |
| 6 | 6 | return [ |
| 7 | 7 | |
| 8 | - // A |
|
| 9 | - 'accueil_site' => 'Halaman Depan', # MODIF |
|
| 10 | - 'articles' => 'Artikel-artikel', |
|
| 11 | - 'articles_auteur' => 'Artikel-artikel penulis ini', |
|
| 12 | - 'articles_populaires' => 'Artikel-artikel yang paling banyak dibaca', |
|
| 13 | - 'articles_rubrique' => 'Artikel-artikel bagian ini', |
|
| 14 | - 'aucun_article' => 'Tidak ada artikel di alamat ini', |
|
| 15 | - 'aucun_auteur' => 'Tidak ada penulis di alamat ini', |
|
| 16 | - 'aucun_site' => 'Tidak ada situs di alamat ini', |
|
| 17 | - 'aucune_breve' => 'Tidak ada berita di alamat ini', |
|
| 18 | - 'aucune_rubrique' => 'Tidak ada bagian di alamat ini', |
|
| 19 | - 'autres_breves' => 'Berita lainnya', |
|
| 20 | - 'autres_groupes_mots_clefs' => 'Kelompok-kelompok kata kunci lainnya', |
|
| 21 | - 'autres_sites' => 'Situs-situs lainnya', |
|
| 8 | + // A |
|
| 9 | + 'accueil_site' => 'Halaman Depan', # MODIF |
|
| 10 | + 'articles' => 'Artikel-artikel', |
|
| 11 | + 'articles_auteur' => 'Artikel-artikel penulis ini', |
|
| 12 | + 'articles_populaires' => 'Artikel-artikel yang paling banyak dibaca', |
|
| 13 | + 'articles_rubrique' => 'Artikel-artikel bagian ini', |
|
| 14 | + 'aucun_article' => 'Tidak ada artikel di alamat ini', |
|
| 15 | + 'aucun_auteur' => 'Tidak ada penulis di alamat ini', |
|
| 16 | + 'aucun_site' => 'Tidak ada situs di alamat ini', |
|
| 17 | + 'aucune_breve' => 'Tidak ada berita di alamat ini', |
|
| 18 | + 'aucune_rubrique' => 'Tidak ada bagian di alamat ini', |
|
| 19 | + 'autres_breves' => 'Berita lainnya', |
|
| 20 | + 'autres_groupes_mots_clefs' => 'Kelompok-kelompok kata kunci lainnya', |
|
| 21 | + 'autres_sites' => 'Situs-situs lainnya', |
|
| 22 | 22 | |
| 23 | - // B |
|
| 24 | - 'bonjour' => 'Halo', |
|
| 23 | + // B |
|
| 24 | + 'bonjour' => 'Halo', |
|
| 25 | 25 | |
| 26 | - // C |
|
| 27 | - 'commenter_site' => 'Komentar di situs ini', |
|
| 26 | + // C |
|
| 27 | + 'commenter_site' => 'Komentar di situs ini', |
|
| 28 | 28 | |
| 29 | - // D |
|
| 30 | - 'date' => 'Tanggal', |
|
| 31 | - 'dernier_ajout' => 'Penambahan terbaru', |
|
| 32 | - 'dernieres_breves' => 'Berita terbaru', |
|
| 33 | - 'derniers_articles' => 'Artikel-artikel terbaru', |
|
| 34 | - 'derniers_commentaires' => 'Komentar-komentar terbaru', |
|
| 35 | - 'derniers_messages_forum' => 'Pesan-pesan terbaru yang dipublikasikan di forum ini', |
|
| 29 | + // D |
|
| 30 | + 'date' => 'Tanggal', |
|
| 31 | + 'dernier_ajout' => 'Penambahan terbaru', |
|
| 32 | + 'dernieres_breves' => 'Berita terbaru', |
|
| 33 | + 'derniers_articles' => 'Artikel-artikel terbaru', |
|
| 34 | + 'derniers_commentaires' => 'Komentar-komentar terbaru', |
|
| 35 | + 'derniers_messages_forum' => 'Pesan-pesan terbaru yang dipublikasikan di forum ini', |
|
| 36 | 36 | |
| 37 | - // E |
|
| 38 | - 'edition_mode_texte' => 'Tampilan teks saja', |
|
| 39 | - 'en_reponse' => 'Membalas kepada:', |
|
| 40 | - 'en_resume' => 'Ringkasan', |
|
| 41 | - 'envoyer_message' => 'Untuk mengirimkan sebuah pesan', |
|
| 42 | - 'espace_prive' => 'Area pribadi', |
|
| 37 | + // E |
|
| 38 | + 'edition_mode_texte' => 'Tampilan teks saja', |
|
| 39 | + 'en_reponse' => 'Membalas kepada:', |
|
| 40 | + 'en_resume' => 'Ringkasan', |
|
| 41 | + 'envoyer_message' => 'Untuk mengirimkan sebuah pesan', |
|
| 42 | + 'espace_prive' => 'Area pribadi', |
|
| 43 | 43 | |
| 44 | - // H |
|
| 45 | - 'hierarchie_site' => 'Hirarki situs', |
|
| 44 | + // H |
|
| 45 | + 'hierarchie_site' => 'Hirarki situs', |
|
| 46 | 46 | |
| 47 | - // J |
|
| 48 | - 'jours' => 'hari', |
|
| 47 | + // J |
|
| 48 | + 'jours' => 'hari', |
|
| 49 | 49 | |
| 50 | - // M |
|
| 51 | - 'meme_auteur' => 'Oleh penulis yang sama', |
|
| 52 | - 'meme_rubrique' => 'Dalam bagian yang sama', |
|
| 53 | - 'memes_auteurs' => 'Oleh penulis-penulis yang sama', |
|
| 54 | - 'message' => 'Pesan', |
|
| 55 | - 'messages_forum' => 'Pesan-pesan forum', # MODIF |
|
| 56 | - 'messages_recents' => 'Pesan-pesan forum terbaru', |
|
| 57 | - 'mots_clefs' => 'Kata-kata kunci', |
|
| 58 | - 'mots_clefs_meme_groupe' => 'Kata-kata kunci dalam kelompok yang sama', |
|
| 50 | + // M |
|
| 51 | + 'meme_auteur' => 'Oleh penulis yang sama', |
|
| 52 | + 'meme_rubrique' => 'Dalam bagian yang sama', |
|
| 53 | + 'memes_auteurs' => 'Oleh penulis-penulis yang sama', |
|
| 54 | + 'message' => 'Pesan', |
|
| 55 | + 'messages_forum' => 'Pesan-pesan forum', # MODIF |
|
| 56 | + 'messages_recents' => 'Pesan-pesan forum terbaru', |
|
| 57 | + 'mots_clefs' => 'Kata-kata kunci', |
|
| 58 | + 'mots_clefs_meme_groupe' => 'Kata-kata kunci dalam kelompok yang sama', |
|
| 59 | 59 | |
| 60 | - // N |
|
| 61 | - 'navigation' => 'Navigasi', |
|
| 62 | - 'nom' => 'Nama', |
|
| 63 | - 'nouveautes' => 'Yang terbaru', |
|
| 64 | - 'nouveautes_web' => 'Yang terbaru di dunia Web', |
|
| 65 | - 'nouveaux_articles' => 'Artikel-artikel baru', |
|
| 66 | - 'nouvelles_breves' => 'Berita-berita baru', |
|
| 60 | + // N |
|
| 61 | + 'navigation' => 'Navigasi', |
|
| 62 | + 'nom' => 'Nama', |
|
| 63 | + 'nouveautes' => 'Yang terbaru', |
|
| 64 | + 'nouveautes_web' => 'Yang terbaru di dunia Web', |
|
| 65 | + 'nouveaux_articles' => 'Artikel-artikel baru', |
|
| 66 | + 'nouvelles_breves' => 'Berita-berita baru', |
|
| 67 | 67 | |
| 68 | - // P |
|
| 69 | - 'page_precedente' => 'halaman sebelumnya', |
|
| 70 | - 'page_suivante' => 'halaman selanjutnya', |
|
| 71 | - 'par_auteur' => 'oleh ', |
|
| 72 | - 'participer_site' => 'Anda dapat berpartisipasi secara aktif di situs web ini dan menulis artikel anda sendiri dengan sebelumnya mendaftarkan diri di bawah ini. Anda akan menerima segera sebuah e-mail yang berisikan kode akses ke area pribadi situs ini.', |
|
| 73 | - 'plan_site' => 'Peta Situs', |
|
| 74 | - 'popularite' => 'Popularitas', |
|
| 75 | - 'poster_message' => 'Untuk mengirimkan sebuah pesan', |
|
| 76 | - 'proposer_site' => 'Anda dapat merekomendasikan sebuah situs untuk ditambahkan ke dalam bagian ini:', |
|
| 68 | + // P |
|
| 69 | + 'page_precedente' => 'halaman sebelumnya', |
|
| 70 | + 'page_suivante' => 'halaman selanjutnya', |
|
| 71 | + 'par_auteur' => 'oleh ', |
|
| 72 | + 'participer_site' => 'Anda dapat berpartisipasi secara aktif di situs web ini dan menulis artikel anda sendiri dengan sebelumnya mendaftarkan diri di bawah ini. Anda akan menerima segera sebuah e-mail yang berisikan kode akses ke area pribadi situs ini.', |
|
| 73 | + 'plan_site' => 'Peta Situs', |
|
| 74 | + 'popularite' => 'Popularitas', |
|
| 75 | + 'poster_message' => 'Untuk mengirimkan sebuah pesan', |
|
| 76 | + 'proposer_site' => 'Anda dapat merekomendasikan sebuah situs untuk ditambahkan ke dalam bagian ini:', |
|
| 77 | 77 | |
| 78 | - // R |
|
| 79 | - 'repondre_article' => 'Balasan pada artikel ini', |
|
| 80 | - 'repondre_breve' => 'Balasan pada artikel berita ini', |
|
| 81 | - 'resultats_recherche' => 'Hasil pencarian', |
|
| 82 | - 'retour_debut_forums' => 'Kembali ke awal forum', |
|
| 83 | - 'rubrique' => 'Bagian', |
|
| 84 | - 'rubriques' => 'Bagian', |
|
| 78 | + // R |
|
| 79 | + 'repondre_article' => 'Balasan pada artikel ini', |
|
| 80 | + 'repondre_breve' => 'Balasan pada artikel berita ini', |
|
| 81 | + 'resultats_recherche' => 'Hasil pencarian', |
|
| 82 | + 'retour_debut_forums' => 'Kembali ke awal forum', |
|
| 83 | + 'rubrique' => 'Bagian', |
|
| 84 | + 'rubriques' => 'Bagian', |
|
| 85 | 85 | |
| 86 | - // S |
|
| 87 | - 'signatures_petition' => 'Tanda tangan', |
|
| 88 | - 'site_realise_avec_spip' => 'Situs dibuat dengan SPIP', |
|
| 89 | - 'sites_web' => 'Situs-situs web', |
|
| 90 | - 'sous_rubriques' => 'Sub-sub bagian', |
|
| 91 | - 'suite' => 'lanjut', |
|
| 92 | - 'sur_web' => 'Di Web', |
|
| 93 | - 'syndiquer_rubrique' => 'Sindikasi bagian ini', |
|
| 94 | - 'syndiquer_site' => 'Sindikasi seluruh isi situs', |
|
| 86 | + // S |
|
| 87 | + 'signatures_petition' => 'Tanda tangan', |
|
| 88 | + 'site_realise_avec_spip' => 'Situs dibuat dengan SPIP', |
|
| 89 | + 'sites_web' => 'Situs-situs web', |
|
| 90 | + 'sous_rubriques' => 'Sub-sub bagian', |
|
| 91 | + 'suite' => 'lanjut', |
|
| 92 | + 'sur_web' => 'Di Web', |
|
| 93 | + 'syndiquer_rubrique' => 'Sindikasi bagian ini', |
|
| 94 | + 'syndiquer_site' => 'Sindikasi seluruh isi situs', |
|
| 95 | 95 | |
| 96 | - // T |
|
| 97 | - 'texte_lettre_information' => 'Berikut adalah laporan berkala situs', |
|
| 98 | - 'texte_lettre_information_2' => 'Laporan ini memberikan ringkasan artikel-artikel dan berita-berita yang dipublikasikan sejak', # MODIF |
|
| 96 | + // T |
|
| 97 | + 'texte_lettre_information' => 'Berikut adalah laporan berkala situs', |
|
| 98 | + 'texte_lettre_information_2' => 'Laporan ini memberikan ringkasan artikel-artikel dan berita-berita yang dipublikasikan sejak', # MODIF |
|
| 99 | 99 | |
| 100 | - // V |
|
| 101 | - 'ver_imprimer' => 'Versi cetak', |
|
| 102 | - 'voir_en_ligne' => 'Lihat secara online', |
|
| 103 | - 'voir_squelette' => 'ٍTampilkan templat halaman ini', |
|
| 100 | + // V |
|
| 101 | + 'ver_imprimer' => 'Versi cetak', |
|
| 102 | + 'voir_en_ligne' => 'Lihat secara online', |
|
| 103 | + 'voir_squelette' => 'ٍTampilkan templat halaman ini', |
|
| 104 | 104 | ]; |