@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/presentation'); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @uses exec_puce_statut_args() |
| 32 | 32 | **/ |
| 33 | 33 | function exec_puce_statut_dist(): void { |
| 34 | - exec_puce_statut_args(_request('id'), _request('type')); |
|
| 34 | + exec_puce_statut_args(_request('id'), _request('type')); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -50,26 +50,26 @@ discard block |
||
| 50 | 50 | * Type d'objet |
| 51 | 51 | **/ |
| 52 | 52 | function exec_puce_statut_args($id, $type): void { |
| 53 | - $id = intval($id); |
|
| 54 | - if ( |
|
| 55 | - $table_objet_sql = table_objet_sql($type) |
|
| 56 | - and $d = lister_tables_objets_sql($table_objet_sql) |
|
| 57 | - and isset($d['statut_textes_instituer']) |
|
| 58 | - and $d['statut_textes_instituer'] |
|
| 59 | - ) { |
|
| 60 | - $prim = id_table_objet($type); |
|
| 61 | - if (isset($d['field']['id_rubrique'])) { |
|
| 62 | - $select = 'id_rubrique,statut'; |
|
| 63 | - } else { |
|
| 64 | - $select = '0 as id_rubrique,statut'; |
|
| 65 | - } |
|
| 66 | - $r = sql_fetsel($select, $table_objet_sql, "$prim=$id"); |
|
| 67 | - $statut = $r['statut']; |
|
| 68 | - $id_rubrique = $r['id_rubrique']; |
|
| 69 | - } else { |
|
| 70 | - $id_rubrique = $id; |
|
| 71 | - $statut = 'prop'; // arbitraire |
|
| 72 | - } |
|
| 73 | - $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 74 | - ajax_retour($puce_statut($id, $statut, $id_rubrique, $type, true)); |
|
| 53 | + $id = intval($id); |
|
| 54 | + if ( |
|
| 55 | + $table_objet_sql = table_objet_sql($type) |
|
| 56 | + and $d = lister_tables_objets_sql($table_objet_sql) |
|
| 57 | + and isset($d['statut_textes_instituer']) |
|
| 58 | + and $d['statut_textes_instituer'] |
|
| 59 | + ) { |
|
| 60 | + $prim = id_table_objet($type); |
|
| 61 | + if (isset($d['field']['id_rubrique'])) { |
|
| 62 | + $select = 'id_rubrique,statut'; |
|
| 63 | + } else { |
|
| 64 | + $select = '0 as id_rubrique,statut'; |
|
| 65 | + } |
|
| 66 | + $r = sql_fetsel($select, $table_objet_sql, "$prim=$id"); |
|
| 67 | + $statut = $r['statut']; |
|
| 68 | + $id_rubrique = $r['id_rubrique']; |
|
| 69 | + } else { |
|
| 70 | + $id_rubrique = $id; |
|
| 71 | + $statut = 'prop'; // arbitraire |
|
| 72 | + } |
|
| 73 | + $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 74 | + ajax_retour($puce_statut($id, $statut, $id_rubrique, $type, true)); |
|
| 75 | 75 | } |
@@ -9,384 +9,384 @@ |
||
| 9 | 9 | |
| 10 | 10 | $GLOBALS['CHARSET']['translit'] = [ |
| 11 | 11 | // latin [fausse plage] |
| 12 | - 128 => 'EUR', |
|
| 13 | - 131 => 'f', |
|
| 14 | - 140 => 'OE', |
|
| 15 | - 147 => '\'\'', |
|
| 16 | - 148 => '\'\'', |
|
| 17 | - 153 => '(TM)', |
|
| 18 | - 156 => 'oe', |
|
| 19 | - 159 => 'Y', |
|
| 12 | + 128 => 'EUR', |
|
| 13 | + 131 => 'f', |
|
| 14 | + 140 => 'OE', |
|
| 15 | + 147 => '\'\'', |
|
| 16 | + 148 => '\'\'', |
|
| 17 | + 153 => '(TM)', |
|
| 18 | + 156 => 'oe', |
|
| 19 | + 159 => 'Y', |
|
| 20 | 20 | |
| 21 | 21 | // latin [legal] |
| 22 | - 160 => ' ', |
|
| 23 | - 161 => '!', |
|
| 24 | - 162 => 'c', |
|
| 25 | - 163 => 'L', |
|
| 26 | - 164 => 'O', |
|
| 27 | - 165 => 'yen', |
|
| 28 | - 166 => '|', |
|
| 29 | - 167 => 'p', |
|
| 30 | - 169 => '(c)', |
|
| 31 | - 171 => '<<', |
|
| 32 | - 172 => '-', |
|
| 33 | - 173 => '-', |
|
| 34 | - 174 => '(R)', |
|
| 35 | - 176 => 'o', |
|
| 36 | - 177 => '+-', |
|
| 37 | - 181 => 'mu', |
|
| 38 | - 182 => 'p', |
|
| 39 | - 183 => '.', |
|
| 40 | - 186 => 'o ', |
|
| 41 | - 187 => '>>', |
|
| 42 | - 191 => '?', |
|
| 43 | - 192 => 'A', |
|
| 44 | - 193 => 'A', |
|
| 45 | - 194 => 'A', |
|
| 46 | - 195 => 'A', |
|
| 47 | - 196 => 'A', |
|
| 48 | - 197 => 'A', |
|
| 49 | - 198 => 'AE', |
|
| 50 | - 199 => 'C', |
|
| 51 | - 200 => 'E', |
|
| 52 | - 201 => 'E', |
|
| 53 | - 202 => 'E', |
|
| 54 | - 203 => 'E', |
|
| 55 | - 204 => 'I', |
|
| 56 | - 205 => 'I', |
|
| 57 | - 206 => 'I', |
|
| 58 | - 207 => 'I', |
|
| 59 | - 209 => 'N', |
|
| 60 | - 210 => 'O', |
|
| 61 | - 211 => 'O', |
|
| 62 | - 212 => 'O', |
|
| 63 | - 213 => 'O', |
|
| 64 | - 214 => 'O', |
|
| 65 | - 216 => 'O', |
|
| 66 | - 217 => 'U', |
|
| 67 | - 218 => 'U', |
|
| 68 | - 219 => 'U', |
|
| 69 | - 220 => 'U', |
|
| 70 | - 223 => 'ss', |
|
| 71 | - 224 => 'a', |
|
| 72 | - 225 => 'a', |
|
| 73 | - 226 => 'a', |
|
| 74 | - 227 => 'a', |
|
| 75 | - 228 => 'a', |
|
| 76 | - 229 => 'a', |
|
| 77 | - 230 => 'ae', |
|
| 78 | - 231 => 'c', |
|
| 79 | - 232 => 'e', |
|
| 80 | - 233 => 'e', |
|
| 81 | - 234 => 'e', |
|
| 82 | - 235 => 'e', |
|
| 83 | - 236 => 'i', |
|
| 84 | - 237 => 'i', |
|
| 85 | - 238 => 'i', |
|
| 86 | - 239 => 'i', |
|
| 87 | - 241 => 'n', |
|
| 88 | - 242 => 'o', |
|
| 89 | - 243 => 'o', |
|
| 90 | - 244 => 'o', |
|
| 91 | - 245 => 'o', |
|
| 92 | - 246 => 'o', |
|
| 93 | - 248 => 'o', |
|
| 94 | - 249 => 'u', |
|
| 95 | - 250 => 'u', |
|
| 96 | - 251 => 'u', |
|
| 97 | - 252 => 'u', |
|
| 98 | - 255 => 'y', |
|
| 22 | + 160 => ' ', |
|
| 23 | + 161 => '!', |
|
| 24 | + 162 => 'c', |
|
| 25 | + 163 => 'L', |
|
| 26 | + 164 => 'O', |
|
| 27 | + 165 => 'yen', |
|
| 28 | + 166 => '|', |
|
| 29 | + 167 => 'p', |
|
| 30 | + 169 => '(c)', |
|
| 31 | + 171 => '<<', |
|
| 32 | + 172 => '-', |
|
| 33 | + 173 => '-', |
|
| 34 | + 174 => '(R)', |
|
| 35 | + 176 => 'o', |
|
| 36 | + 177 => '+-', |
|
| 37 | + 181 => 'mu', |
|
| 38 | + 182 => 'p', |
|
| 39 | + 183 => '.', |
|
| 40 | + 186 => 'o ', |
|
| 41 | + 187 => '>>', |
|
| 42 | + 191 => '?', |
|
| 43 | + 192 => 'A', |
|
| 44 | + 193 => 'A', |
|
| 45 | + 194 => 'A', |
|
| 46 | + 195 => 'A', |
|
| 47 | + 196 => 'A', |
|
| 48 | + 197 => 'A', |
|
| 49 | + 198 => 'AE', |
|
| 50 | + 199 => 'C', |
|
| 51 | + 200 => 'E', |
|
| 52 | + 201 => 'E', |
|
| 53 | + 202 => 'E', |
|
| 54 | + 203 => 'E', |
|
| 55 | + 204 => 'I', |
|
| 56 | + 205 => 'I', |
|
| 57 | + 206 => 'I', |
|
| 58 | + 207 => 'I', |
|
| 59 | + 209 => 'N', |
|
| 60 | + 210 => 'O', |
|
| 61 | + 211 => 'O', |
|
| 62 | + 212 => 'O', |
|
| 63 | + 213 => 'O', |
|
| 64 | + 214 => 'O', |
|
| 65 | + 216 => 'O', |
|
| 66 | + 217 => 'U', |
|
| 67 | + 218 => 'U', |
|
| 68 | + 219 => 'U', |
|
| 69 | + 220 => 'U', |
|
| 70 | + 223 => 'ss', |
|
| 71 | + 224 => 'a', |
|
| 72 | + 225 => 'a', |
|
| 73 | + 226 => 'a', |
|
| 74 | + 227 => 'a', |
|
| 75 | + 228 => 'a', |
|
| 76 | + 229 => 'a', |
|
| 77 | + 230 => 'ae', |
|
| 78 | + 231 => 'c', |
|
| 79 | + 232 => 'e', |
|
| 80 | + 233 => 'e', |
|
| 81 | + 234 => 'e', |
|
| 82 | + 235 => 'e', |
|
| 83 | + 236 => 'i', |
|
| 84 | + 237 => 'i', |
|
| 85 | + 238 => 'i', |
|
| 86 | + 239 => 'i', |
|
| 87 | + 241 => 'n', |
|
| 88 | + 242 => 'o', |
|
| 89 | + 243 => 'o', |
|
| 90 | + 244 => 'o', |
|
| 91 | + 245 => 'o', |
|
| 92 | + 246 => 'o', |
|
| 93 | + 248 => 'o', |
|
| 94 | + 249 => 'u', |
|
| 95 | + 250 => 'u', |
|
| 96 | + 251 => 'u', |
|
| 97 | + 252 => 'u', |
|
| 98 | + 255 => 'y', |
|
| 99 | 99 | |
| 100 | 100 | // turc |
| 101 | - 286 => 'G', |
|
| 102 | - 287 => 'g', |
|
| 103 | - 304 => 'I', |
|
| 104 | - 305 => 'i', |
|
| 101 | + 286 => 'G', |
|
| 102 | + 287 => 'g', |
|
| 103 | + 304 => 'I', |
|
| 104 | + 305 => 'i', |
|
| 105 | 105 | |
| 106 | 106 | // esperanto |
| 107 | - 264 => 'Cx', |
|
| 108 | - 265 => 'cx', |
|
| 109 | - 284 => 'Gx', |
|
| 110 | - 285 => 'gx', |
|
| 111 | - 292 => 'Hx', |
|
| 112 | - 293 => 'hx', |
|
| 113 | - 308 => 'Jx', |
|
| 114 | - 309 => 'jx', |
|
| 115 | - 348 => 'Sx', |
|
| 116 | - 349 => 'sx', |
|
| 117 | - 364 => 'Ux', |
|
| 118 | - 365 => 'ux', |
|
| 107 | + 264 => 'Cx', |
|
| 108 | + 265 => 'cx', |
|
| 109 | + 284 => 'Gx', |
|
| 110 | + 285 => 'gx', |
|
| 111 | + 292 => 'Hx', |
|
| 112 | + 293 => 'hx', |
|
| 113 | + 308 => 'Jx', |
|
| 114 | + 309 => 'jx', |
|
| 115 | + 348 => 'Sx', |
|
| 116 | + 349 => 'sx', |
|
| 117 | + 364 => 'Ux', |
|
| 118 | + 365 => 'ux', |
|
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | // latin2 [Czech] |
| 122 | - 283 => 'e', |
|
| 123 | - 353 => 's', |
|
| 124 | - 269 => 'c', |
|
| 125 | - 345 => 'r', |
|
| 126 | - 382 => 'z', |
|
| 127 | - 367 => 'u', |
|
| 128 | - 328 => 'n', |
|
| 129 | - 357 => 't', |
|
| 130 | - 271 => 'd', |
|
| 131 | - 449 => 'o', |
|
| 132 | - 282 => 'E', |
|
| 133 | - 352 => 'S', |
|
| 134 | - 268 => 'C', |
|
| 135 | - 344 => 'R', |
|
| 136 | - 381 => 'Z', |
|
| 137 | - 366 => 'U', |
|
| 138 | - 327 => 'N', |
|
| 139 | - 356 => 'T', |
|
| 140 | - 270 => 'D', |
|
| 141 | - 467 => 'O', |
|
| 122 | + 283 => 'e', |
|
| 123 | + 353 => 's', |
|
| 124 | + 269 => 'c', |
|
| 125 | + 345 => 'r', |
|
| 126 | + 382 => 'z', |
|
| 127 | + 367 => 'u', |
|
| 128 | + 328 => 'n', |
|
| 129 | + 357 => 't', |
|
| 130 | + 271 => 'd', |
|
| 131 | + 449 => 'o', |
|
| 132 | + 282 => 'E', |
|
| 133 | + 352 => 'S', |
|
| 134 | + 268 => 'C', |
|
| 135 | + 344 => 'R', |
|
| 136 | + 381 => 'Z', |
|
| 137 | + 366 => 'U', |
|
| 138 | + 327 => 'N', |
|
| 139 | + 356 => 'T', |
|
| 140 | + 270 => 'D', |
|
| 141 | + 467 => 'O', |
|
| 142 | 142 | |
| 143 | 143 | // francais |
| 144 | - 338 => 'OE', |
|
| 145 | - 339 => 'oe', |
|
| 146 | - 376 => 'Y', |
|
| 147 | - 402 => 'f', |
|
| 144 | + 338 => 'OE', |
|
| 145 | + 339 => 'oe', |
|
| 146 | + 376 => 'Y', |
|
| 147 | + 402 => 'f', |
|
| 148 | 148 | |
| 149 | 149 | //polskie |
| 150 | - 260 => 'A', |
|
| 151 | - 261 => 'a', |
|
| 152 | - 262 => 'C', |
|
| 153 | - 263 => 'c', |
|
| 154 | - 280 => 'E', |
|
| 155 | - 281 => 'e', |
|
| 156 | - 321 => 'L', |
|
| 157 | - 322 => 'l', |
|
| 158 | - 323 => 'N', |
|
| 159 | - 324 => 'n', |
|
| 160 | - 346 => 'S', |
|
| 161 | - 347 => 's', |
|
| 162 | - 377 => 'Z', |
|
| 163 | - 378 => 'z', |
|
| 164 | - 379 => 'Z', |
|
| 165 | - 380 => 'z', |
|
| 150 | + 260 => 'A', |
|
| 151 | + 261 => 'a', |
|
| 152 | + 262 => 'C', |
|
| 153 | + 263 => 'c', |
|
| 154 | + 280 => 'E', |
|
| 155 | + 281 => 'e', |
|
| 156 | + 321 => 'L', |
|
| 157 | + 322 => 'l', |
|
| 158 | + 323 => 'N', |
|
| 159 | + 324 => 'n', |
|
| 160 | + 346 => 'S', |
|
| 161 | + 347 => 's', |
|
| 162 | + 377 => 'Z', |
|
| 163 | + 378 => 'z', |
|
| 164 | + 379 => 'Z', |
|
| 165 | + 380 => 'z', |
|
| 166 | 166 | |
| 167 | 167 | //roumain |
| 168 | - 258 => 'A', |
|
| 169 | - 259 => 'a', |
|
| 170 | - 354 => 'T', |
|
| 171 | - 355 => 't', |
|
| 168 | + 258 => 'A', |
|
| 169 | + 259 => 'a', |
|
| 170 | + 354 => 'T', |
|
| 171 | + 355 => 't', |
|
| 172 | 172 | |
| 173 | 173 | //turc & roumain |
| 174 | - 350 => 'S', |
|
| 175 | - 351 => 's', |
|
| 174 | + 350 => 'S', |
|
| 175 | + 351 => 's', |
|
| 176 | 176 | |
| 177 | 177 | // cyrillique |
| 178 | - 1026 => 'D%', |
|
| 179 | - 1027 => 'G%', |
|
| 180 | - 8218 => '\'', |
|
| 181 | - 1107 => 'g%', |
|
| 182 | - 8222 => '"', |
|
| 183 | - 8230 => '...', |
|
| 184 | - 8224 => '/-', |
|
| 185 | - 8225 => '/=', |
|
| 186 | - 8364 => 'EUR', |
|
| 187 | - 8240 => '0/00', |
|
| 188 | - 1033 => 'LJ', |
|
| 189 | - 8249 => '<', |
|
| 190 | - 1034 => 'NJ', |
|
| 191 | - 1036 => 'KJ', |
|
| 192 | - 1035 => 'Ts', |
|
| 193 | - 1039 => 'DZ', |
|
| 194 | - 1106 => 'd%', |
|
| 195 | - 8216 => '`', |
|
| 196 | - 8217 => '\'', |
|
| 197 | - 8220 => '"', |
|
| 198 | - 8221 => '"', |
|
| 199 | - 8226 => ' o ', |
|
| 200 | - 8211 => '-', |
|
| 201 | - 8212 => '~', |
|
| 202 | - 8482 => '(TM)', |
|
| 203 | - 1113 => 'lj', |
|
| 204 | - 8250 => '>', |
|
| 205 | - 1114 => 'nj', |
|
| 206 | - 1116 => 'kj', |
|
| 207 | - 1115 => 'ts', |
|
| 208 | - 1119 => 'dz', |
|
| 209 | - 1038 => 'V%', |
|
| 210 | - 1118 => 'v%', |
|
| 211 | - 1032 => 'J%', |
|
| 212 | - 1168 => 'G3', |
|
| 213 | - 1025 => 'IO', |
|
| 214 | - 1028 => 'IE', |
|
| 215 | - 1031 => 'YI', |
|
| 216 | - 1030 => 'II', |
|
| 217 | - 1110 => 'ii', |
|
| 218 | - 1169 => 'g3', |
|
| 219 | - 1105 => 'io', |
|
| 220 | - 8470 => 'No.', |
|
| 221 | - 1108 => 'ie', |
|
| 222 | - 1112 => 'j%', |
|
| 223 | - 1029 => 'DS', |
|
| 224 | - 1109 => 'ds', |
|
| 225 | - 1111 => 'yi', |
|
| 226 | - 1040 => 'A', |
|
| 227 | - 1041 => 'B', |
|
| 228 | - 1042 => 'V', |
|
| 229 | - 1043 => 'G', |
|
| 230 | - 1044 => 'D', |
|
| 231 | - 1045 => 'E', |
|
| 232 | - 1046 => 'ZH', |
|
| 233 | - 1047 => 'Z', |
|
| 234 | - 1048 => 'I', |
|
| 235 | - 1049 => 'J', |
|
| 236 | - 1050 => 'K', |
|
| 237 | - 1051 => 'L', |
|
| 238 | - 1052 => 'M', |
|
| 239 | - 1053 => 'N', |
|
| 240 | - 1054 => 'O', |
|
| 241 | - 1055 => 'P', |
|
| 242 | - 1056 => 'R', |
|
| 243 | - 1057 => 'S', |
|
| 244 | - 1058 => 'T', |
|
| 245 | - 1059 => 'U', |
|
| 246 | - 1060 => 'F', |
|
| 247 | - 1061 => 'H', |
|
| 248 | - 1062 => 'C', |
|
| 249 | - 1063 => 'CH', |
|
| 250 | - 1064 => 'SH', |
|
| 251 | - 1065 => 'SCH', |
|
| 252 | - 1066 => '"', |
|
| 253 | - 1067 => 'Y', |
|
| 254 | - 1068 => '\'', |
|
| 255 | - 1069 => '`E', |
|
| 256 | - 1070 => 'YU', |
|
| 257 | - 1071 => 'YA', |
|
| 258 | - 1072 => 'a', |
|
| 259 | - 1073 => 'b', |
|
| 260 | - 1074 => 'v', |
|
| 261 | - 1075 => 'g', |
|
| 262 | - 1076 => 'd', |
|
| 263 | - 1077 => 'e', |
|
| 264 | - 1078 => 'zh', |
|
| 265 | - 1079 => 'z', |
|
| 266 | - 1080 => 'i', |
|
| 267 | - 1081 => 'j', |
|
| 268 | - 1082 => 'k', |
|
| 269 | - 1083 => 'l', |
|
| 270 | - 1084 => 'm', |
|
| 271 | - 1085 => 'n', |
|
| 272 | - 1086 => 'o', |
|
| 273 | - 1087 => 'p', |
|
| 274 | - 1088 => 'r', |
|
| 275 | - 1089 => 's', |
|
| 276 | - 1090 => 't', |
|
| 277 | - 1091 => 'u', |
|
| 278 | - 1092 => 'f', |
|
| 279 | - 1093 => 'h', |
|
| 280 | - 1094 => 'c', |
|
| 281 | - 1095 => 'ch', |
|
| 282 | - 1096 => 'sh', |
|
| 283 | - 1097 => 'sch', |
|
| 284 | - 1098 => '"', |
|
| 285 | - 1099 => 'y', |
|
| 286 | - 1100 => '\'', |
|
| 287 | - 1101 => '`e', |
|
| 288 | - 1102 => 'yu', |
|
| 289 | - 1103 => 'ya', |
|
| 178 | + 1026 => 'D%', |
|
| 179 | + 1027 => 'G%', |
|
| 180 | + 8218 => '\'', |
|
| 181 | + 1107 => 'g%', |
|
| 182 | + 8222 => '"', |
|
| 183 | + 8230 => '...', |
|
| 184 | + 8224 => '/-', |
|
| 185 | + 8225 => '/=', |
|
| 186 | + 8364 => 'EUR', |
|
| 187 | + 8240 => '0/00', |
|
| 188 | + 1033 => 'LJ', |
|
| 189 | + 8249 => '<', |
|
| 190 | + 1034 => 'NJ', |
|
| 191 | + 1036 => 'KJ', |
|
| 192 | + 1035 => 'Ts', |
|
| 193 | + 1039 => 'DZ', |
|
| 194 | + 1106 => 'd%', |
|
| 195 | + 8216 => '`', |
|
| 196 | + 8217 => '\'', |
|
| 197 | + 8220 => '"', |
|
| 198 | + 8221 => '"', |
|
| 199 | + 8226 => ' o ', |
|
| 200 | + 8211 => '-', |
|
| 201 | + 8212 => '~', |
|
| 202 | + 8482 => '(TM)', |
|
| 203 | + 1113 => 'lj', |
|
| 204 | + 8250 => '>', |
|
| 205 | + 1114 => 'nj', |
|
| 206 | + 1116 => 'kj', |
|
| 207 | + 1115 => 'ts', |
|
| 208 | + 1119 => 'dz', |
|
| 209 | + 1038 => 'V%', |
|
| 210 | + 1118 => 'v%', |
|
| 211 | + 1032 => 'J%', |
|
| 212 | + 1168 => 'G3', |
|
| 213 | + 1025 => 'IO', |
|
| 214 | + 1028 => 'IE', |
|
| 215 | + 1031 => 'YI', |
|
| 216 | + 1030 => 'II', |
|
| 217 | + 1110 => 'ii', |
|
| 218 | + 1169 => 'g3', |
|
| 219 | + 1105 => 'io', |
|
| 220 | + 8470 => 'No.', |
|
| 221 | + 1108 => 'ie', |
|
| 222 | + 1112 => 'j%', |
|
| 223 | + 1029 => 'DS', |
|
| 224 | + 1109 => 'ds', |
|
| 225 | + 1111 => 'yi', |
|
| 226 | + 1040 => 'A', |
|
| 227 | + 1041 => 'B', |
|
| 228 | + 1042 => 'V', |
|
| 229 | + 1043 => 'G', |
|
| 230 | + 1044 => 'D', |
|
| 231 | + 1045 => 'E', |
|
| 232 | + 1046 => 'ZH', |
|
| 233 | + 1047 => 'Z', |
|
| 234 | + 1048 => 'I', |
|
| 235 | + 1049 => 'J', |
|
| 236 | + 1050 => 'K', |
|
| 237 | + 1051 => 'L', |
|
| 238 | + 1052 => 'M', |
|
| 239 | + 1053 => 'N', |
|
| 240 | + 1054 => 'O', |
|
| 241 | + 1055 => 'P', |
|
| 242 | + 1056 => 'R', |
|
| 243 | + 1057 => 'S', |
|
| 244 | + 1058 => 'T', |
|
| 245 | + 1059 => 'U', |
|
| 246 | + 1060 => 'F', |
|
| 247 | + 1061 => 'H', |
|
| 248 | + 1062 => 'C', |
|
| 249 | + 1063 => 'CH', |
|
| 250 | + 1064 => 'SH', |
|
| 251 | + 1065 => 'SCH', |
|
| 252 | + 1066 => '"', |
|
| 253 | + 1067 => 'Y', |
|
| 254 | + 1068 => '\'', |
|
| 255 | + 1069 => '`E', |
|
| 256 | + 1070 => 'YU', |
|
| 257 | + 1071 => 'YA', |
|
| 258 | + 1072 => 'a', |
|
| 259 | + 1073 => 'b', |
|
| 260 | + 1074 => 'v', |
|
| 261 | + 1075 => 'g', |
|
| 262 | + 1076 => 'd', |
|
| 263 | + 1077 => 'e', |
|
| 264 | + 1078 => 'zh', |
|
| 265 | + 1079 => 'z', |
|
| 266 | + 1080 => 'i', |
|
| 267 | + 1081 => 'j', |
|
| 268 | + 1082 => 'k', |
|
| 269 | + 1083 => 'l', |
|
| 270 | + 1084 => 'm', |
|
| 271 | + 1085 => 'n', |
|
| 272 | + 1086 => 'o', |
|
| 273 | + 1087 => 'p', |
|
| 274 | + 1088 => 'r', |
|
| 275 | + 1089 => 's', |
|
| 276 | + 1090 => 't', |
|
| 277 | + 1091 => 'u', |
|
| 278 | + 1092 => 'f', |
|
| 279 | + 1093 => 'h', |
|
| 280 | + 1094 => 'c', |
|
| 281 | + 1095 => 'ch', |
|
| 282 | + 1096 => 'sh', |
|
| 283 | + 1097 => 'sch', |
|
| 284 | + 1098 => '"', |
|
| 285 | + 1099 => 'y', |
|
| 286 | + 1100 => '\'', |
|
| 287 | + 1101 => '`e', |
|
| 288 | + 1102 => 'yu', |
|
| 289 | + 1103 => 'ya', |
|
| 290 | 290 | |
| 291 | 291 | // vietnamien en translitteration de base |
| 292 | - 7843 => 'a', |
|
| 293 | - 7841 => 'a', |
|
| 294 | - 7845 => 'a', |
|
| 295 | - 7847 => 'a', |
|
| 296 | - 7849 => 'a', |
|
| 297 | - 7851 => 'a', |
|
| 298 | - 7853 => 'a', |
|
| 299 | - 7855 => 'a', |
|
| 300 | - 7857 => 'a', |
|
| 301 | - 7859 => 'a', |
|
| 302 | - 7861 => 'a', |
|
| 303 | - 7863 => 'a', |
|
| 304 | - 7842 => 'A', |
|
| 305 | - 7840 => 'A', |
|
| 306 | - 7844 => 'A', |
|
| 307 | - 7846 => 'A', |
|
| 308 | - 7848 => 'A', |
|
| 309 | - 7850 => 'A', |
|
| 310 | - 7852 => 'A', |
|
| 311 | - 7854 => 'A', |
|
| 312 | - 7856 => 'A', |
|
| 313 | - 7858 => 'A', |
|
| 314 | - 7860 => 'A', |
|
| 315 | - 7862 => 'A', |
|
| 316 | - 7867 => 'e', |
|
| 317 | - 7869 => 'e', |
|
| 318 | - 7865 => 'e', |
|
| 319 | - 7871 => 'e', |
|
| 320 | - 7873 => 'e', |
|
| 321 | - 7875 => 'e', |
|
| 322 | - 7877 => 'e', |
|
| 323 | - 7879 => 'e', |
|
| 324 | - 7866 => 'E', |
|
| 325 | - 7868 => 'E', |
|
| 326 | - 7864 => 'E', |
|
| 327 | - 7870 => 'E', |
|
| 328 | - 7872 => 'E', |
|
| 329 | - 7874 => 'E', |
|
| 330 | - 7876 => 'E', |
|
| 331 | - 7878 => 'E', |
|
| 332 | - 7881 => 'i', |
|
| 333 | - 7883 => 'i', |
|
| 334 | - 7880 => 'I', |
|
| 335 | - 7882 => 'I', |
|
| 336 | - 7887 => 'o', |
|
| 337 | - 7885 => 'o', |
|
| 338 | - 7889 => 'o', |
|
| 339 | - 7891 => 'o', |
|
| 340 | - 7893 => 'o', |
|
| 341 | - 7895 => 'o', |
|
| 342 | - 7897 => 'o', |
|
| 343 | - 417 => 'o', |
|
| 344 | - 7899 => 'o', |
|
| 345 | - 7901 => 'o', |
|
| 346 | - 7903 => 'o', |
|
| 347 | - 7905 => 'o', |
|
| 348 | - 7907 => 'o', |
|
| 349 | - 7886 => 'O', |
|
| 350 | - 7884 => 'O', |
|
| 351 | - 7888 => 'O', |
|
| 352 | - 7890 => 'O', |
|
| 353 | - 7892 => 'O', |
|
| 354 | - 7894 => 'O', |
|
| 355 | - 7896 => 'O', |
|
| 356 | - 416 => 'O', |
|
| 357 | - 7898 => 'O', |
|
| 358 | - 7900 => 'O', |
|
| 359 | - 7902 => 'O', |
|
| 360 | - 7904 => 'O', |
|
| 361 | - 7906 => 'O', |
|
| 362 | - 7911 => 'u', |
|
| 363 | - 361 => 'u', |
|
| 364 | - 7909 => 'u', |
|
| 365 | - 432 => 'u', |
|
| 366 | - 7913 => 'u', |
|
| 367 | - 7915 => 'u', |
|
| 368 | - 7917 => 'u', |
|
| 369 | - 7919 => 'u', |
|
| 370 | - 7921 => 'u', |
|
| 371 | - 7910 => 'U', |
|
| 372 | - 360 => 'U', |
|
| 373 | - 7908 => 'U', |
|
| 374 | - 431 => 'U', |
|
| 375 | - 7912 => 'U', |
|
| 376 | - 7914 => 'U', |
|
| 377 | - 7916 => 'U', |
|
| 378 | - 7918 => 'U', |
|
| 379 | - 7920 => 'U', |
|
| 380 | - 253 => 'y', |
|
| 381 | - 7923 => 'y', |
|
| 382 | - 7927 => 'y', |
|
| 383 | - 7929 => 'y', |
|
| 384 | - 7925 => 'y', |
|
| 385 | - 221 => 'Y', |
|
| 386 | - 7922 => 'Y', |
|
| 387 | - 7926 => 'Y', |
|
| 388 | - 7928 => 'Y', |
|
| 389 | - 7924 => 'Y', |
|
| 390 | - 273 => 'd' |
|
| 292 | + 7843 => 'a', |
|
| 293 | + 7841 => 'a', |
|
| 294 | + 7845 => 'a', |
|
| 295 | + 7847 => 'a', |
|
| 296 | + 7849 => 'a', |
|
| 297 | + 7851 => 'a', |
|
| 298 | + 7853 => 'a', |
|
| 299 | + 7855 => 'a', |
|
| 300 | + 7857 => 'a', |
|
| 301 | + 7859 => 'a', |
|
| 302 | + 7861 => 'a', |
|
| 303 | + 7863 => 'a', |
|
| 304 | + 7842 => 'A', |
|
| 305 | + 7840 => 'A', |
|
| 306 | + 7844 => 'A', |
|
| 307 | + 7846 => 'A', |
|
| 308 | + 7848 => 'A', |
|
| 309 | + 7850 => 'A', |
|
| 310 | + 7852 => 'A', |
|
| 311 | + 7854 => 'A', |
|
| 312 | + 7856 => 'A', |
|
| 313 | + 7858 => 'A', |
|
| 314 | + 7860 => 'A', |
|
| 315 | + 7862 => 'A', |
|
| 316 | + 7867 => 'e', |
|
| 317 | + 7869 => 'e', |
|
| 318 | + 7865 => 'e', |
|
| 319 | + 7871 => 'e', |
|
| 320 | + 7873 => 'e', |
|
| 321 | + 7875 => 'e', |
|
| 322 | + 7877 => 'e', |
|
| 323 | + 7879 => 'e', |
|
| 324 | + 7866 => 'E', |
|
| 325 | + 7868 => 'E', |
|
| 326 | + 7864 => 'E', |
|
| 327 | + 7870 => 'E', |
|
| 328 | + 7872 => 'E', |
|
| 329 | + 7874 => 'E', |
|
| 330 | + 7876 => 'E', |
|
| 331 | + 7878 => 'E', |
|
| 332 | + 7881 => 'i', |
|
| 333 | + 7883 => 'i', |
|
| 334 | + 7880 => 'I', |
|
| 335 | + 7882 => 'I', |
|
| 336 | + 7887 => 'o', |
|
| 337 | + 7885 => 'o', |
|
| 338 | + 7889 => 'o', |
|
| 339 | + 7891 => 'o', |
|
| 340 | + 7893 => 'o', |
|
| 341 | + 7895 => 'o', |
|
| 342 | + 7897 => 'o', |
|
| 343 | + 417 => 'o', |
|
| 344 | + 7899 => 'o', |
|
| 345 | + 7901 => 'o', |
|
| 346 | + 7903 => 'o', |
|
| 347 | + 7905 => 'o', |
|
| 348 | + 7907 => 'o', |
|
| 349 | + 7886 => 'O', |
|
| 350 | + 7884 => 'O', |
|
| 351 | + 7888 => 'O', |
|
| 352 | + 7890 => 'O', |
|
| 353 | + 7892 => 'O', |
|
| 354 | + 7894 => 'O', |
|
| 355 | + 7896 => 'O', |
|
| 356 | + 416 => 'O', |
|
| 357 | + 7898 => 'O', |
|
| 358 | + 7900 => 'O', |
|
| 359 | + 7902 => 'O', |
|
| 360 | + 7904 => 'O', |
|
| 361 | + 7906 => 'O', |
|
| 362 | + 7911 => 'u', |
|
| 363 | + 361 => 'u', |
|
| 364 | + 7909 => 'u', |
|
| 365 | + 432 => 'u', |
|
| 366 | + 7913 => 'u', |
|
| 367 | + 7915 => 'u', |
|
| 368 | + 7917 => 'u', |
|
| 369 | + 7919 => 'u', |
|
| 370 | + 7921 => 'u', |
|
| 371 | + 7910 => 'U', |
|
| 372 | + 360 => 'U', |
|
| 373 | + 7908 => 'U', |
|
| 374 | + 431 => 'U', |
|
| 375 | + 7912 => 'U', |
|
| 376 | + 7914 => 'U', |
|
| 377 | + 7916 => 'U', |
|
| 378 | + 7918 => 'U', |
|
| 379 | + 7920 => 'U', |
|
| 380 | + 253 => 'y', |
|
| 381 | + 7923 => 'y', |
|
| 382 | + 7927 => 'y', |
|
| 383 | + 7929 => 'y', |
|
| 384 | + 7925 => 'y', |
|
| 385 | + 221 => 'Y', |
|
| 386 | + 7922 => 'Y', |
|
| 387 | + 7926 => 'Y', |
|
| 388 | + 7928 => 'Y', |
|
| 389 | + 7924 => 'Y', |
|
| 390 | + 273 => 'd' |
|
| 391 | 391 | |
| 392 | 392 | ]; |
@@ -4,123 +4,123 @@ |
||
| 4 | 4 | // ** ne pas modifier le fichier ** |
| 5 | 5 | |
| 6 | 6 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 7 | - return; |
|
| 7 | + return; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $GLOBALS[$GLOBALS['idx_lang']] = array( |
| 11 | 11 | |
| 12 | - // A |
|
| 13 | - 'accueil_site' => 'Startseite', |
|
| 14 | - 'article' => 'Artikel', |
|
| 15 | - 'articles' => 'Artikel', |
|
| 16 | - 'articles_auteur' => 'Artikel dieses Autors', |
|
| 17 | - 'articles_populaires' => 'Die beliebtesten Artikel', |
|
| 18 | - 'articles_rubrique' => 'Artikel dieser Rubrik', |
|
| 19 | - 'aucun_article' => 'Unter dieser Adresse gibt es keinen Artikel.', |
|
| 20 | - 'aucun_auteur' => 'Unter dieser Adresse gibt es keinen Autor.', |
|
| 21 | - 'aucun_site' => 'Unter dieser Adresse gibt es keien Website.', |
|
| 22 | - 'aucune_breve' => 'Unter dieser Adresse gibt es keine Meldung.', |
|
| 23 | - 'aucune_rubrique' => 'Unter dieser Adresse gibt es keine Rubrik.', |
|
| 24 | - 'auteur' => 'Autor', |
|
| 25 | - 'autres' => 'Andere', |
|
| 26 | - 'autres_breves' => 'Weitere Meldungen.', |
|
| 27 | - 'autres_groupes_mots_clefs' => 'Weitere Schlagwortgruppen', |
|
| 28 | - 'autres_sites' => 'Weitere Websites', |
|
| 29 | - |
|
| 30 | - // B |
|
| 31 | - 'bonjour' => 'Hallo', |
|
| 32 | - |
|
| 33 | - // C |
|
| 34 | - 'commenter_site' => 'Website kommentieren', |
|
| 35 | - 'contact' => 'Kontakt', |
|
| 36 | - 'copie_document_impossible' => 'Dokument kann nicht kopiert werden', |
|
| 37 | - |
|
| 38 | - // D |
|
| 39 | - 'date' => 'Datum', |
|
| 40 | - 'dernier_ajout' => 'Neuester Eintrag', |
|
| 41 | - 'dernieres_breves' => 'Neue Meldungen', |
|
| 42 | - 'derniers_articles' => 'Neueste Artikel', |
|
| 43 | - 'derniers_commentaires' => 'Neueste Kommentare', |
|
| 44 | - 'derniers_messages_forum' => 'Neue Forumsbeiträge', |
|
| 45 | - |
|
| 46 | - // E |
|
| 47 | - 'edition_mode_texte' => 'Im Textmodus bearbeiten ', |
|
| 48 | - 'en_reponse' => 'Antwort auf:', |
|
| 49 | - 'en_resume' => 'Als Zusammenfassung', |
|
| 50 | - 'envoyer_message' => 'Nachricht senden', |
|
| 51 | - 'espace_prive' => 'Redaktion', |
|
| 52 | - |
|
| 53 | - // F |
|
| 54 | - 'formats_acceptes' => 'Akzeptierte Formate: @formats@.', |
|
| 55 | - |
|
| 56 | - // H |
|
| 57 | - 'hierarchie_site' => 'Baumstruktur der Website', |
|
| 58 | - |
|
| 59 | - // J |
|
| 60 | - 'jours' => 'Tage', |
|
| 61 | - |
|
| 62 | - // L |
|
| 63 | - 'lien_connecter' => 'Login', |
|
| 64 | - |
|
| 65 | - // M |
|
| 66 | - 'meme_auteur' => 'Vom gleichen Autor', |
|
| 67 | - 'meme_rubrique' => 'In der gleichen Rubrik', |
|
| 68 | - 'memes_auteurs' => 'Von den gleichen Autoren', |
|
| 69 | - 'message' => 'Nachricht', |
|
| 70 | - 'messages_forum' => 'Nachrichten', |
|
| 71 | - 'messages_recents' => 'Neue Forumsbeiträge', |
|
| 72 | - 'mots_clef' => 'Schlagwort', |
|
| 73 | - 'mots_clefs' => 'Schlagworte', |
|
| 74 | - 'mots_clefs_meme_groupe' => 'Schlagworte der gleichen Kategorie', |
|
| 75 | - |
|
| 76 | - // N |
|
| 77 | - 'navigation' => 'Navigation', |
|
| 78 | - 'nom' => 'Name', |
|
| 79 | - 'nouveautes' => 'Neuigkeiten', |
|
| 80 | - 'nouveautes_web' => 'Neues im WWW', |
|
| 81 | - 'nouveaux_articles' => 'Neue Artikel', |
|
| 82 | - 'nouvelles_breves' => 'Neue Meldungen', |
|
| 83 | - |
|
| 84 | - // P |
|
| 85 | - 'page_precedente' => 'vorige Seite', |
|
| 86 | - 'page_suivante' => 'nächste Seite', |
|
| 87 | - 'par_auteur' => 'von ', |
|
| 88 | - 'participer_site' => 'Sie können bei dieser Website mitmachen, wenn Sie sich anmelden. Sie erhalten sofort eine E-Mail mit den Zugangsdaten zum Redaktionssystem.', |
|
| 89 | - 'plan_site' => 'Sitemap', |
|
| 90 | - 'popularite' => 'Beliebtheit', |
|
| 91 | - 'poster_message' => 'Nachricht senden', |
|
| 92 | - 'proposer_site' => 'Sie können in dieser Rubrik eine Seite vorschlagen :', |
|
| 93 | - |
|
| 94 | - // R |
|
| 95 | - 'repondre_article' => 'auf diesen Artikel antworten', |
|
| 96 | - 'repondre_breve' => 'auf diese Meldung antworten', |
|
| 97 | - 'resultats_recherche' => 'Suchergebnis(se)', |
|
| 98 | - 'retour_debut_forums' => 'Zurück zum Beginn des Forums', |
|
| 99 | - 'rss_abonnement' => 'Kopieren Sie die folgende URL in Ihren Feedreader:', |
|
| 100 | - 'rss_abonnement_titre' => 'Abonnieren', |
|
| 101 | - 'rss_abonnement_titre_page' => 'Abonnieren von', |
|
| 102 | - 'rss_explication' => 'Ein RSS-Feed sammelt Informationen über die Aktualisierungen einer Website. Er liefert den Inhalt von Einträgen oder Kommentaren oder einen Auszug daraus sowie einen Link zu den Vollversionen und einige andere Informationen. Der Feed ist dazu gedacht, von einem RSS-Aggregator (Feedreader) gelesen zu werden', |
|
| 103 | - 'rss_explication_titre' => 'Was ist ein RSS-Feed ?', |
|
| 104 | - 'rubrique' => 'Rubrik', |
|
| 105 | - 'rubriques' => 'Rubriken', |
|
| 106 | - |
|
| 107 | - // S |
|
| 108 | - 'signatures_petition' => 'Unterschrift', |
|
| 109 | - 'site_realise_avec_spip' => 'Realisiert mit SPIP', |
|
| 110 | - 'sites_web' => 'Websites', |
|
| 111 | - 'sous_rubriques' => 'Unterrubriken', |
|
| 112 | - 'spam' => 'SPAM', |
|
| 113 | - 'suite' => 'weiter', |
|
| 114 | - 'sur_web' => 'Im WWW', |
|
| 115 | - 'syndiquer_rubrique' => 'Diese Rubrik per RSS einbinden', |
|
| 116 | - 'syndiquer_site' => 'Die ganze Website mit RSS einbinden', |
|
| 117 | - |
|
| 118 | - // T |
|
| 119 | - 'texte_lettre_information' => 'Dies ist der Newsletter der Website ', |
|
| 120 | - 'texte_lettre_information_2' => 'Diese Mail informiert über die Neuerscheinungen der letzten', |
|
| 121 | - |
|
| 122 | - // V |
|
| 123 | - 'ver_imprimer' => 'Druckversion', |
|
| 124 | - 'voir_en_ligne' => 'Online ansehen', |
|
| 125 | - 'voir_squelette' => 'Layoutvorlage dieser Seite ansehen' |
|
| 12 | + // A |
|
| 13 | + 'accueil_site' => 'Startseite', |
|
| 14 | + 'article' => 'Artikel', |
|
| 15 | + 'articles' => 'Artikel', |
|
| 16 | + 'articles_auteur' => 'Artikel dieses Autors', |
|
| 17 | + 'articles_populaires' => 'Die beliebtesten Artikel', |
|
| 18 | + 'articles_rubrique' => 'Artikel dieser Rubrik', |
|
| 19 | + 'aucun_article' => 'Unter dieser Adresse gibt es keinen Artikel.', |
|
| 20 | + 'aucun_auteur' => 'Unter dieser Adresse gibt es keinen Autor.', |
|
| 21 | + 'aucun_site' => 'Unter dieser Adresse gibt es keien Website.', |
|
| 22 | + 'aucune_breve' => 'Unter dieser Adresse gibt es keine Meldung.', |
|
| 23 | + 'aucune_rubrique' => 'Unter dieser Adresse gibt es keine Rubrik.', |
|
| 24 | + 'auteur' => 'Autor', |
|
| 25 | + 'autres' => 'Andere', |
|
| 26 | + 'autres_breves' => 'Weitere Meldungen.', |
|
| 27 | + 'autres_groupes_mots_clefs' => 'Weitere Schlagwortgruppen', |
|
| 28 | + 'autres_sites' => 'Weitere Websites', |
|
| 29 | + |
|
| 30 | + // B |
|
| 31 | + 'bonjour' => 'Hallo', |
|
| 32 | + |
|
| 33 | + // C |
|
| 34 | + 'commenter_site' => 'Website kommentieren', |
|
| 35 | + 'contact' => 'Kontakt', |
|
| 36 | + 'copie_document_impossible' => 'Dokument kann nicht kopiert werden', |
|
| 37 | + |
|
| 38 | + // D |
|
| 39 | + 'date' => 'Datum', |
|
| 40 | + 'dernier_ajout' => 'Neuester Eintrag', |
|
| 41 | + 'dernieres_breves' => 'Neue Meldungen', |
|
| 42 | + 'derniers_articles' => 'Neueste Artikel', |
|
| 43 | + 'derniers_commentaires' => 'Neueste Kommentare', |
|
| 44 | + 'derniers_messages_forum' => 'Neue Forumsbeiträge', |
|
| 45 | + |
|
| 46 | + // E |
|
| 47 | + 'edition_mode_texte' => 'Im Textmodus bearbeiten ', |
|
| 48 | + 'en_reponse' => 'Antwort auf:', |
|
| 49 | + 'en_resume' => 'Als Zusammenfassung', |
|
| 50 | + 'envoyer_message' => 'Nachricht senden', |
|
| 51 | + 'espace_prive' => 'Redaktion', |
|
| 52 | + |
|
| 53 | + // F |
|
| 54 | + 'formats_acceptes' => 'Akzeptierte Formate: @formats@.', |
|
| 55 | + |
|
| 56 | + // H |
|
| 57 | + 'hierarchie_site' => 'Baumstruktur der Website', |
|
| 58 | + |
|
| 59 | + // J |
|
| 60 | + 'jours' => 'Tage', |
|
| 61 | + |
|
| 62 | + // L |
|
| 63 | + 'lien_connecter' => 'Login', |
|
| 64 | + |
|
| 65 | + // M |
|
| 66 | + 'meme_auteur' => 'Vom gleichen Autor', |
|
| 67 | + 'meme_rubrique' => 'In der gleichen Rubrik', |
|
| 68 | + 'memes_auteurs' => 'Von den gleichen Autoren', |
|
| 69 | + 'message' => 'Nachricht', |
|
| 70 | + 'messages_forum' => 'Nachrichten', |
|
| 71 | + 'messages_recents' => 'Neue Forumsbeiträge', |
|
| 72 | + 'mots_clef' => 'Schlagwort', |
|
| 73 | + 'mots_clefs' => 'Schlagworte', |
|
| 74 | + 'mots_clefs_meme_groupe' => 'Schlagworte der gleichen Kategorie', |
|
| 75 | + |
|
| 76 | + // N |
|
| 77 | + 'navigation' => 'Navigation', |
|
| 78 | + 'nom' => 'Name', |
|
| 79 | + 'nouveautes' => 'Neuigkeiten', |
|
| 80 | + 'nouveautes_web' => 'Neues im WWW', |
|
| 81 | + 'nouveaux_articles' => 'Neue Artikel', |
|
| 82 | + 'nouvelles_breves' => 'Neue Meldungen', |
|
| 83 | + |
|
| 84 | + // P |
|
| 85 | + 'page_precedente' => 'vorige Seite', |
|
| 86 | + 'page_suivante' => 'nächste Seite', |
|
| 87 | + 'par_auteur' => 'von ', |
|
| 88 | + 'participer_site' => 'Sie können bei dieser Website mitmachen, wenn Sie sich anmelden. Sie erhalten sofort eine E-Mail mit den Zugangsdaten zum Redaktionssystem.', |
|
| 89 | + 'plan_site' => 'Sitemap', |
|
| 90 | + 'popularite' => 'Beliebtheit', |
|
| 91 | + 'poster_message' => 'Nachricht senden', |
|
| 92 | + 'proposer_site' => 'Sie können in dieser Rubrik eine Seite vorschlagen :', |
|
| 93 | + |
|
| 94 | + // R |
|
| 95 | + 'repondre_article' => 'auf diesen Artikel antworten', |
|
| 96 | + 'repondre_breve' => 'auf diese Meldung antworten', |
|
| 97 | + 'resultats_recherche' => 'Suchergebnis(se)', |
|
| 98 | + 'retour_debut_forums' => 'Zurück zum Beginn des Forums', |
|
| 99 | + 'rss_abonnement' => 'Kopieren Sie die folgende URL in Ihren Feedreader:', |
|
| 100 | + 'rss_abonnement_titre' => 'Abonnieren', |
|
| 101 | + 'rss_abonnement_titre_page' => 'Abonnieren von', |
|
| 102 | + 'rss_explication' => 'Ein RSS-Feed sammelt Informationen über die Aktualisierungen einer Website. Er liefert den Inhalt von Einträgen oder Kommentaren oder einen Auszug daraus sowie einen Link zu den Vollversionen und einige andere Informationen. Der Feed ist dazu gedacht, von einem RSS-Aggregator (Feedreader) gelesen zu werden', |
|
| 103 | + 'rss_explication_titre' => 'Was ist ein RSS-Feed ?', |
|
| 104 | + 'rubrique' => 'Rubrik', |
|
| 105 | + 'rubriques' => 'Rubriken', |
|
| 106 | + |
|
| 107 | + // S |
|
| 108 | + 'signatures_petition' => 'Unterschrift', |
|
| 109 | + 'site_realise_avec_spip' => 'Realisiert mit SPIP', |
|
| 110 | + 'sites_web' => 'Websites', |
|
| 111 | + 'sous_rubriques' => 'Unterrubriken', |
|
| 112 | + 'spam' => 'SPAM', |
|
| 113 | + 'suite' => 'weiter', |
|
| 114 | + 'sur_web' => 'Im WWW', |
|
| 115 | + 'syndiquer_rubrique' => 'Diese Rubrik per RSS einbinden', |
|
| 116 | + 'syndiquer_site' => 'Die ganze Website mit RSS einbinden', |
|
| 117 | + |
|
| 118 | + // T |
|
| 119 | + 'texte_lettre_information' => 'Dies ist der Newsletter der Website ', |
|
| 120 | + 'texte_lettre_information_2' => 'Diese Mail informiert über die Neuerscheinungen der letzten', |
|
| 121 | + |
|
| 122 | + // V |
|
| 123 | + 'ver_imprimer' => 'Druckversion', |
|
| 124 | + 'voir_en_ligne' => 'Online ansehen', |
|
| 125 | + 'voir_squelette' => 'Layoutvorlage dieser Seite ansehen' |
|
| 126 | 126 | ); |
@@ -91,17 +91,17 @@ discard block |
||
| 91 | 91 | $cles = \Spip\Chiffrer\SpipCles::instance(); |
| 92 | 92 | $secret = $cles->getSecretAuth(); |
| 93 | 93 | |
| 94 | - $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 94 | + $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login='.sql_quote($login)); |
|
| 95 | 95 | if ($id_auteur !== null) { |
| 96 | 96 | // c'est un auteur connu : si on a pas de secret il faut absolument qu'il se reconnecte avec le meme mot de passe |
| 97 | 97 | // pour restaurer la copie des cles |
| 98 | 98 | if (!$secret and !auth_spip_initialiser_secret()) { |
| 99 | - $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 99 | + $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur='.intval($id_auteur)); |
|
| 100 | 100 | if (empty($row['backup_cles']) or !$cles->restore($row['backup_cles'], $pass, $row['pass'], $id_auteur)) { |
| 101 | 101 | $echec = _T('avis_connexion_erreur_fichier_cle_manquant_1'); |
| 102 | 102 | echouer_etape_3b($echec); |
| 103 | 103 | } |
| 104 | - spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth' . _LOG_INFO_IMPORTANTE); |
|
| 104 | + spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth'._LOG_INFO_IMPORTANTE); |
|
| 105 | 105 | $cles->save(); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | 'email' => $email, |
| 111 | 111 | 'login' => $login, |
| 112 | 112 | 'statut' => '0minirezo' |
| 113 | - ], 'id_auteur=' . intval($id_auteur)); |
|
| 113 | + ], 'id_auteur='.intval($id_auteur)); |
|
| 114 | 114 | // le passer webmestre separement du reste, au cas ou l'alter n'aurait pas fonctionne |
| 115 | 115 | @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
| 116 | 116 | if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | !$auteur = auth_identifier_login($login, $pass) |
| 153 | 153 | or !auth_loger($auteur) |
| 154 | 154 | ) { |
| 155 | - spip_log("login automatique impossible $auth_spip $session" . (is_countable($row) ? count($row) : 0)); |
|
| 155 | + spip_log("login automatique impossible $auth_spip $session".(is_countable($row) ? count($row) : 0)); |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | function echouer_etape_3b($echec) { |
| 175 | 175 | echo minipres( |
| 176 | 176 | 'AUTO', |
| 177 | - info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 178 | - "<div class='error'><h3>$echec</h3>\n" . |
|
| 179 | - '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 177 | + info_progression_etape(3, 'etape_', 'install/', true). |
|
| 178 | + "<div class='error'><h3>$echec</h3>\n". |
|
| 179 | + '<p>'._T('avis_connexion_echec_2').'</p>'. |
|
| 180 | 180 | '</div>' |
| 181 | 181 | ); |
| 182 | 182 | exit; |
@@ -11,172 +11,172 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/headers'); |
| 18 | 18 | |
| 19 | 19 | function install_etape_3b_dist() { |
| 20 | - $auth_spip = null; |
|
| 21 | - $session = null; |
|
| 22 | - $row = null; |
|
| 23 | - $login = _request('login'); |
|
| 24 | - $email = _request('email'); |
|
| 25 | - $nom = _request('nom'); |
|
| 26 | - $pass = _request('pass'); |
|
| 27 | - $pass_verif = _request('pass_verif'); |
|
| 28 | - |
|
| 29 | - $server_db = defined('_INSTALL_SERVER_DB') |
|
| 30 | - ? _INSTALL_SERVER_DB |
|
| 31 | - : _request('server_db'); |
|
| 32 | - |
|
| 33 | - if (!defined('_PASS_LONGUEUR_MINI')) { |
|
| 34 | - define('_PASS_LONGUEUR_MINI', 6); |
|
| 35 | - } |
|
| 36 | - if (!defined('_LOGIN_TROP_COURT')) { |
|
| 37 | - define('_LOGIN_TROP_COURT', 4); |
|
| 38 | - } |
|
| 39 | - if ($login) { |
|
| 40 | - $echec = ($pass != $pass_verif) ? |
|
| 41 | - _T('info_passes_identiques') |
|
| 42 | - : ((strlen($pass) < _PASS_LONGUEUR_MINI) ? |
|
| 43 | - _T('info_passe_trop_court_car_pluriel', ['nb' => _PASS_LONGUEUR_MINI]) |
|
| 44 | - : ((strlen($login) < _LOGIN_TROP_COURT) ? |
|
| 45 | - _T('info_login_trop_court') |
|
| 46 | - : '')); |
|
| 47 | - include_spip('inc/filtres'); |
|
| 48 | - if (!$echec and $email and !email_valide($email)) { |
|
| 49 | - $echec = _T('form_email_non_valide'); |
|
| 50 | - } |
|
| 51 | - if ($echec) { |
|
| 52 | - echouer_etape_3b($echec); |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - if (@file_exists(_FILE_CHMOD_TMP)) { |
|
| 57 | - include(_FILE_CHMOD_TMP); |
|
| 58 | - } else { |
|
| 59 | - redirige_url_ecrire('install'); |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 63 | - redirige_url_ecrire('install'); |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - # maintenant on connait le vrai charset du site s'il est deja configure |
|
| 67 | - # sinon par defaut lire_meta reglera _DEFAULT_CHARSET |
|
| 68 | - # (les donnees arrivent de toute facon postees en _DEFAULT_CHARSET) |
|
| 69 | - |
|
| 70 | - lire_metas(); |
|
| 71 | - if ($login) { |
|
| 72 | - include_spip('inc/charsets'); |
|
| 73 | - |
|
| 74 | - $nom = (importer_charset($nom, _DEFAULT_CHARSET)); |
|
| 75 | - $login = (importer_charset($login, _DEFAULT_CHARSET)); |
|
| 76 | - $email = (importer_charset($email, _DEFAULT_CHARSET)); |
|
| 77 | - # pour le passwd, bizarrement il faut le convertir comme s'il avait |
|
| 78 | - # ete tape en iso-8859-1 ; car c'est en fait ce que voit md5.js |
|
| 79 | - $pass = unicode2charset(utf_8_to_unicode($pass), 'iso-8859-1'); |
|
| 80 | - |
|
| 81 | - include_spip('auth/spip'); |
|
| 82 | - // prelablement, creer le champ webmestre si il n'existe pas (install neuve |
|
| 83 | - // sur une vieille base |
|
| 84 | - $t = sql_showtable('spip_auteurs', true); |
|
| 85 | - if (!isset($t['field']['webmestre'])) { |
|
| 86 | - @sql_alter("TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - // il faut avoir une cle des auth valide pour creer un nouvel auteur webmestre |
|
| 90 | - $cles = \Spip\Chiffrer\SpipCles::instance(); |
|
| 91 | - $secret = $cles->getSecretAuth(); |
|
| 92 | - |
|
| 93 | - $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 94 | - if ($id_auteur !== null) { |
|
| 95 | - // c'est un auteur connu : si on a pas de secret il faut absolument qu'il se reconnecte avec le meme mot de passe |
|
| 96 | - // pour restaurer la copie des cles |
|
| 97 | - if (!$secret and !auth_spip_initialiser_secret()) { |
|
| 98 | - $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 99 | - if (empty($row['backup_cles']) or !$cles->restore($row['backup_cles'], $pass, $row['pass'], $id_auteur)) { |
|
| 100 | - $echec = _T('avis_connexion_erreur_fichier_cle_manquant_1'); |
|
| 101 | - echouer_etape_3b($echec); |
|
| 102 | - } |
|
| 103 | - spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth' . _LOG_INFO_IMPORTANTE); |
|
| 104 | - $cles->save(); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - sql_updateq('spip_auteurs', [ |
|
| 108 | - 'nom' => $nom, |
|
| 109 | - 'email' => $email, |
|
| 110 | - 'login' => $login, |
|
| 111 | - 'statut' => '0minirezo' |
|
| 112 | - ], 'id_auteur=' . intval($id_auteur)); |
|
| 113 | - // le passer webmestre separement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 114 | - @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 115 | - if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
|
| 116 | - $echec = _T('avis_erreur_creation_compte'); |
|
| 117 | - echouer_etape_3b($echec); |
|
| 118 | - } |
|
| 119 | - } else { |
|
| 120 | - // Si on a pas de cle et qu'on ne sait pas la creer, on ne peut pas creer de nouveau compte : |
|
| 121 | - // il faut qu'un webmestre avec un backup fasse l'install |
|
| 122 | - if (!$secret and !auth_spip_initialiser_secret()) { |
|
| 123 | - $echec = _T('avis_connexion_erreur_fichier_cle_manquant_2'); |
|
| 124 | - echouer_etape_3b($echec); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - $id_auteur = sql_insertq('spip_auteurs', [ |
|
| 128 | - 'nom' => $nom, |
|
| 129 | - 'email' => $email, |
|
| 130 | - 'login' => $login, |
|
| 131 | - 'statut' => '0minirezo' |
|
| 132 | - ]); |
|
| 133 | - // le passer webmestre separrement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 134 | - @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 135 | - if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
|
| 136 | - $echec = _T('avis_erreur_creation_compte'); |
|
| 137 | - echouer_etape_3b($echec); |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - // inserer email comme email webmaster principal |
|
| 142 | - // (sauf s'il est vide: cas de la re-installation) |
|
| 143 | - if ($email) { |
|
| 144 | - ecrire_meta('email_webmaster', $email); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - // Connecter directement celui qui vient de (re)donner son login |
|
| 148 | - // mais sans cookie d'admin ni connexion longue |
|
| 149 | - include_spip('inc/auth'); |
|
| 150 | - if ( |
|
| 151 | - !$auteur = auth_identifier_login($login, $pass) |
|
| 152 | - or !auth_loger($auteur) |
|
| 153 | - ) { |
|
| 154 | - spip_log("login automatique impossible $auth_spip $session" . (is_countable($row) ? count($row) : 0)); |
|
| 155 | - } |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - // installer les metas |
|
| 159 | - $config = charger_fonction('config', 'inc'); |
|
| 160 | - $config(); |
|
| 161 | - |
|
| 162 | - // activer les plugins |
|
| 163 | - // leur installation ne peut pas se faire sur le meme hit, il faudra donc |
|
| 164 | - // poursuivre au hit suivant |
|
| 165 | - include_spip('inc/plugin'); |
|
| 166 | - actualise_plugins_actifs(); |
|
| 167 | - |
|
| 168 | - |
|
| 169 | - include_spip('inc/distant'); |
|
| 170 | - redirige_par_entete(parametre_url(self(), 'etape', '4', '&')); |
|
| 20 | + $auth_spip = null; |
|
| 21 | + $session = null; |
|
| 22 | + $row = null; |
|
| 23 | + $login = _request('login'); |
|
| 24 | + $email = _request('email'); |
|
| 25 | + $nom = _request('nom'); |
|
| 26 | + $pass = _request('pass'); |
|
| 27 | + $pass_verif = _request('pass_verif'); |
|
| 28 | + |
|
| 29 | + $server_db = defined('_INSTALL_SERVER_DB') |
|
| 30 | + ? _INSTALL_SERVER_DB |
|
| 31 | + : _request('server_db'); |
|
| 32 | + |
|
| 33 | + if (!defined('_PASS_LONGUEUR_MINI')) { |
|
| 34 | + define('_PASS_LONGUEUR_MINI', 6); |
|
| 35 | + } |
|
| 36 | + if (!defined('_LOGIN_TROP_COURT')) { |
|
| 37 | + define('_LOGIN_TROP_COURT', 4); |
|
| 38 | + } |
|
| 39 | + if ($login) { |
|
| 40 | + $echec = ($pass != $pass_verif) ? |
|
| 41 | + _T('info_passes_identiques') |
|
| 42 | + : ((strlen($pass) < _PASS_LONGUEUR_MINI) ? |
|
| 43 | + _T('info_passe_trop_court_car_pluriel', ['nb' => _PASS_LONGUEUR_MINI]) |
|
| 44 | + : ((strlen($login) < _LOGIN_TROP_COURT) ? |
|
| 45 | + _T('info_login_trop_court') |
|
| 46 | + : '')); |
|
| 47 | + include_spip('inc/filtres'); |
|
| 48 | + if (!$echec and $email and !email_valide($email)) { |
|
| 49 | + $echec = _T('form_email_non_valide'); |
|
| 50 | + } |
|
| 51 | + if ($echec) { |
|
| 52 | + echouer_etape_3b($echec); |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + if (@file_exists(_FILE_CHMOD_TMP)) { |
|
| 57 | + include(_FILE_CHMOD_TMP); |
|
| 58 | + } else { |
|
| 59 | + redirige_url_ecrire('install'); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 63 | + redirige_url_ecrire('install'); |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + # maintenant on connait le vrai charset du site s'il est deja configure |
|
| 67 | + # sinon par defaut lire_meta reglera _DEFAULT_CHARSET |
|
| 68 | + # (les donnees arrivent de toute facon postees en _DEFAULT_CHARSET) |
|
| 69 | + |
|
| 70 | + lire_metas(); |
|
| 71 | + if ($login) { |
|
| 72 | + include_spip('inc/charsets'); |
|
| 73 | + |
|
| 74 | + $nom = (importer_charset($nom, _DEFAULT_CHARSET)); |
|
| 75 | + $login = (importer_charset($login, _DEFAULT_CHARSET)); |
|
| 76 | + $email = (importer_charset($email, _DEFAULT_CHARSET)); |
|
| 77 | + # pour le passwd, bizarrement il faut le convertir comme s'il avait |
|
| 78 | + # ete tape en iso-8859-1 ; car c'est en fait ce que voit md5.js |
|
| 79 | + $pass = unicode2charset(utf_8_to_unicode($pass), 'iso-8859-1'); |
|
| 80 | + |
|
| 81 | + include_spip('auth/spip'); |
|
| 82 | + // prelablement, creer le champ webmestre si il n'existe pas (install neuve |
|
| 83 | + // sur une vieille base |
|
| 84 | + $t = sql_showtable('spip_auteurs', true); |
|
| 85 | + if (!isset($t['field']['webmestre'])) { |
|
| 86 | + @sql_alter("TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + // il faut avoir une cle des auth valide pour creer un nouvel auteur webmestre |
|
| 90 | + $cles = \Spip\Chiffrer\SpipCles::instance(); |
|
| 91 | + $secret = $cles->getSecretAuth(); |
|
| 92 | + |
|
| 93 | + $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 94 | + if ($id_auteur !== null) { |
|
| 95 | + // c'est un auteur connu : si on a pas de secret il faut absolument qu'il se reconnecte avec le meme mot de passe |
|
| 96 | + // pour restaurer la copie des cles |
|
| 97 | + if (!$secret and !auth_spip_initialiser_secret()) { |
|
| 98 | + $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 99 | + if (empty($row['backup_cles']) or !$cles->restore($row['backup_cles'], $pass, $row['pass'], $id_auteur)) { |
|
| 100 | + $echec = _T('avis_connexion_erreur_fichier_cle_manquant_1'); |
|
| 101 | + echouer_etape_3b($echec); |
|
| 102 | + } |
|
| 103 | + spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth' . _LOG_INFO_IMPORTANTE); |
|
| 104 | + $cles->save(); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + sql_updateq('spip_auteurs', [ |
|
| 108 | + 'nom' => $nom, |
|
| 109 | + 'email' => $email, |
|
| 110 | + 'login' => $login, |
|
| 111 | + 'statut' => '0minirezo' |
|
| 112 | + ], 'id_auteur=' . intval($id_auteur)); |
|
| 113 | + // le passer webmestre separement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 114 | + @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 115 | + if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
|
| 116 | + $echec = _T('avis_erreur_creation_compte'); |
|
| 117 | + echouer_etape_3b($echec); |
|
| 118 | + } |
|
| 119 | + } else { |
|
| 120 | + // Si on a pas de cle et qu'on ne sait pas la creer, on ne peut pas creer de nouveau compte : |
|
| 121 | + // il faut qu'un webmestre avec un backup fasse l'install |
|
| 122 | + if (!$secret and !auth_spip_initialiser_secret()) { |
|
| 123 | + $echec = _T('avis_connexion_erreur_fichier_cle_manquant_2'); |
|
| 124 | + echouer_etape_3b($echec); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + $id_auteur = sql_insertq('spip_auteurs', [ |
|
| 128 | + 'nom' => $nom, |
|
| 129 | + 'email' => $email, |
|
| 130 | + 'login' => $login, |
|
| 131 | + 'statut' => '0minirezo' |
|
| 132 | + ]); |
|
| 133 | + // le passer webmestre separrement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 134 | + @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 135 | + if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
|
| 136 | + $echec = _T('avis_erreur_creation_compte'); |
|
| 137 | + echouer_etape_3b($echec); |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + // inserer email comme email webmaster principal |
|
| 142 | + // (sauf s'il est vide: cas de la re-installation) |
|
| 143 | + if ($email) { |
|
| 144 | + ecrire_meta('email_webmaster', $email); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + // Connecter directement celui qui vient de (re)donner son login |
|
| 148 | + // mais sans cookie d'admin ni connexion longue |
|
| 149 | + include_spip('inc/auth'); |
|
| 150 | + if ( |
|
| 151 | + !$auteur = auth_identifier_login($login, $pass) |
|
| 152 | + or !auth_loger($auteur) |
|
| 153 | + ) { |
|
| 154 | + spip_log("login automatique impossible $auth_spip $session" . (is_countable($row) ? count($row) : 0)); |
|
| 155 | + } |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + // installer les metas |
|
| 159 | + $config = charger_fonction('config', 'inc'); |
|
| 160 | + $config(); |
|
| 161 | + |
|
| 162 | + // activer les plugins |
|
| 163 | + // leur installation ne peut pas se faire sur le meme hit, il faudra donc |
|
| 164 | + // poursuivre au hit suivant |
|
| 165 | + include_spip('inc/plugin'); |
|
| 166 | + actualise_plugins_actifs(); |
|
| 167 | + |
|
| 168 | + |
|
| 169 | + include_spip('inc/distant'); |
|
| 170 | + redirige_par_entete(parametre_url(self(), 'etape', '4', '&')); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | function echouer_etape_3b($echec) { |
| 174 | - echo minipres( |
|
| 175 | - 'AUTO', |
|
| 176 | - info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 177 | - "<div class='error'><h3>$echec</h3>\n" . |
|
| 178 | - '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 179 | - '</div>' |
|
| 180 | - ); |
|
| 181 | - exit; |
|
| 174 | + echo minipres( |
|
| 175 | + 'AUTO', |
|
| 176 | + info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 177 | + "<div class='error'><h3>$echec</h3>\n" . |
|
| 178 | + '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 179 | + '</div>' |
|
| 180 | + ); |
|
| 181 | + exit; |
|
| 182 | 182 | } |
@@ -14,57 +14,57 @@ |
||
| 14 | 14 | |
| 15 | 15 | /** Vérification et hachage de mot de passe */ |
| 16 | 16 | class Password { |
| 17 | - /** |
|
| 18 | - * verifier qu'un mot de passe en clair est correct a l'aide de son hash |
|
| 19 | - * |
|
| 20 | - * Le mot de passe est poivre via la cle secret_des_auth |
|
| 21 | - * |
|
| 22 | - * @param string $password_clair |
|
| 23 | - * @param string $password_hash |
|
| 24 | - * @param string $key |
|
| 25 | - * @return bool |
|
| 26 | - */ |
|
| 27 | - public static function verifier( |
|
| 28 | - #[\SensitiveParameter] |
|
| 29 | - string $password_clair, |
|
| 30 | - #[\SensitiveParameter] |
|
| 31 | - string $password_hash, |
|
| 32 | - #[\SensitiveParameter] |
|
| 33 | - ?string $key = null |
|
| 34 | - ): bool { |
|
| 35 | - $key ??= self::getDefaultKey(); |
|
| 36 | - if ($key) { |
|
| 37 | - $pass_poivre = hash_hmac('sha256', $password_clair, $key); |
|
| 38 | - return password_verify($pass_poivre, $password_hash); |
|
| 39 | - } |
|
| 40 | - spip_log('Aucune clé pour vérifier le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 41 | - return false; |
|
| 42 | - } |
|
| 17 | + /** |
|
| 18 | + * verifier qu'un mot de passe en clair est correct a l'aide de son hash |
|
| 19 | + * |
|
| 20 | + * Le mot de passe est poivre via la cle secret_des_auth |
|
| 21 | + * |
|
| 22 | + * @param string $password_clair |
|
| 23 | + * @param string $password_hash |
|
| 24 | + * @param string $key |
|
| 25 | + * @return bool |
|
| 26 | + */ |
|
| 27 | + public static function verifier( |
|
| 28 | + #[\SensitiveParameter] |
|
| 29 | + string $password_clair, |
|
| 30 | + #[\SensitiveParameter] |
|
| 31 | + string $password_hash, |
|
| 32 | + #[\SensitiveParameter] |
|
| 33 | + ?string $key = null |
|
| 34 | + ): bool { |
|
| 35 | + $key ??= self::getDefaultKey(); |
|
| 36 | + if ($key) { |
|
| 37 | + $pass_poivre = hash_hmac('sha256', $password_clair, $key); |
|
| 38 | + return password_verify($pass_poivre, $password_hash); |
|
| 39 | + } |
|
| 40 | + spip_log('Aucune clé pour vérifier le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 41 | + return false; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Calculer un hash salé du mot de passe |
|
| 46 | - * @param string $password_clair |
|
| 47 | - * @param string $salt |
|
| 48 | - * @return string |
|
| 49 | - */ |
|
| 50 | - public static function hacher( |
|
| 51 | - #[\SensitiveParameter] |
|
| 52 | - string $password_clair, |
|
| 53 | - #[\SensitiveParameter] |
|
| 54 | - ?string $key = null |
|
| 55 | - ): ?string { |
|
| 56 | - $key ??= self::getDefaultKey(); |
|
| 57 | - // ne pas fournir un hash errone si la cle nous manque |
|
| 58 | - if ($key) { |
|
| 59 | - $pass_poivre = hash_hmac('sha256', $password_clair, $key); |
|
| 60 | - return password_hash($pass_poivre, PASSWORD_DEFAULT); |
|
| 61 | - } |
|
| 62 | - spip_log('Aucune clé pour chiffrer le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 63 | - return null; |
|
| 64 | - } |
|
| 44 | + /** |
|
| 45 | + * Calculer un hash salé du mot de passe |
|
| 46 | + * @param string $password_clair |
|
| 47 | + * @param string $salt |
|
| 48 | + * @return string |
|
| 49 | + */ |
|
| 50 | + public static function hacher( |
|
| 51 | + #[\SensitiveParameter] |
|
| 52 | + string $password_clair, |
|
| 53 | + #[\SensitiveParameter] |
|
| 54 | + ?string $key = null |
|
| 55 | + ): ?string { |
|
| 56 | + $key ??= self::getDefaultKey(); |
|
| 57 | + // ne pas fournir un hash errone si la cle nous manque |
|
| 58 | + if ($key) { |
|
| 59 | + $pass_poivre = hash_hmac('sha256', $password_clair, $key); |
|
| 60 | + return password_hash($pass_poivre, PASSWORD_DEFAULT); |
|
| 61 | + } |
|
| 62 | + spip_log('Aucune clé pour chiffrer le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 63 | + return null; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - private static function getDefaultKey(): ?string { |
|
| 67 | - $keys = SpipCles::instance(); |
|
| 68 | - return $keys->getSecretAuth(); |
|
| 69 | - } |
|
| 66 | + private static function getDefaultKey(): ?string { |
|
| 67 | + $keys = SpipCles::instance(); |
|
| 68 | + return $keys->getSecretAuth(); |
|
| 69 | + } |
|
| 70 | 70 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $pass_poivre = hash_hmac('sha256', $password_clair, $key); |
| 38 | 38 | return password_verify($pass_poivre, $password_hash); |
| 39 | 39 | } |
| 40 | - spip_log('Aucune clé pour vérifier le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 40 | + spip_log('Aucune clé pour vérifier le mot de passe', 'chiffrer'._LOG_INFO_IMPORTANTE); |
|
| 41 | 41 | return false; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $pass_poivre = hash_hmac('sha256', $password_clair, $key); |
| 60 | 60 | return password_hash($pass_poivre, PASSWORD_DEFAULT); |
| 61 | 61 | } |
| 62 | - spip_log('Aucune clé pour chiffrer le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 62 | + spip_log('Aucune clé pour chiffrer le mot de passe', 'chiffrer'._LOG_INFO_IMPORTANTE); |
|
| 63 | 63 | return null; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | public function generate(string $name): string { |
| 31 | 31 | $key = Chiffrement::keygen(); |
| 32 | 32 | $this->keys[$name] = $key; |
| 33 | - spip_log("Création de la cle $name", 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 33 | + spip_log("Création de la cle $name", 'chiffrer'._LOG_INFO_IMPORTANTE); |
|
| 34 | 34 | return $key; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -14,48 +14,48 @@ |
||
| 14 | 14 | |
| 15 | 15 | /** Conteneur de clés (chiffrement, authentification) */ |
| 16 | 16 | class Cles implements \Countable /* , ContainerInterface */ { |
| 17 | - private array $keys; |
|
| 18 | - public function __construct(array $keys) { |
|
| 19 | - $this->keys = $keys; |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - public function has(string $name): bool { |
|
| 23 | - return array_key_exists($name, $this->keys); |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - public function get(string $name): ?string { |
|
| 27 | - return $this->keys[$name] ?? null; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - public function generate(string $name): string { |
|
| 31 | - $key = Chiffrement::keygen(); |
|
| 32 | - $this->keys[$name] = $key; |
|
| 33 | - spip_log("Création de la cle $name", 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 34 | - return $key; |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - public function set( |
|
| 38 | - string $name, |
|
| 39 | - #[\SensitiveParameter] |
|
| 40 | - string $key |
|
| 41 | - ): void { |
|
| 42 | - $this->keys[$name] = $key; |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - public function delete(string $name): bool { |
|
| 46 | - if (isset($this->keys[$name])) { |
|
| 47 | - unset($this->keys[$name]); |
|
| 48 | - return true; |
|
| 49 | - }; |
|
| 50 | - return false; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - public function count(): int { |
|
| 54 | - return count($this->keys); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - public function toJson(): string { |
|
| 58 | - $json = array_map('base64_encode', $this->keys); |
|
| 59 | - return \json_encode($json); |
|
| 60 | - } |
|
| 17 | + private array $keys; |
|
| 18 | + public function __construct(array $keys) { |
|
| 19 | + $this->keys = $keys; |
|
| 20 | + } |
|
| 21 | + |
|
| 22 | + public function has(string $name): bool { |
|
| 23 | + return array_key_exists($name, $this->keys); |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + public function get(string $name): ?string { |
|
| 27 | + return $this->keys[$name] ?? null; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + public function generate(string $name): string { |
|
| 31 | + $key = Chiffrement::keygen(); |
|
| 32 | + $this->keys[$name] = $key; |
|
| 33 | + spip_log("Création de la cle $name", 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 34 | + return $key; |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + public function set( |
|
| 38 | + string $name, |
|
| 39 | + #[\SensitiveParameter] |
|
| 40 | + string $key |
|
| 41 | + ): void { |
|
| 42 | + $this->keys[$name] = $key; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + public function delete(string $name): bool { |
|
| 46 | + if (isset($this->keys[$name])) { |
|
| 47 | + unset($this->keys[$name]); |
|
| 48 | + return true; |
|
| 49 | + }; |
|
| 50 | + return false; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + public function count(): int { |
|
| 54 | + return count($this->keys); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + public function toJson(): string { |
|
| 58 | + $json = array_map('base64_encode', $this->keys); |
|
| 59 | + return \json_encode($json); |
|
| 60 | + } |
|
| 61 | 61 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/autoriser'); |
@@ -30,80 +30,80 @@ discard block |
||
| 30 | 30 | * Un tableau des sous rubriques |
| 31 | 31 | */ |
| 32 | 32 | function enfant_rub($collection, $debut = 0, $limite = 500) { |
| 33 | - $voir_logo = (isset($GLOBALS['meta']['image_process']) and $GLOBALS['meta']['image_process'] != 'non'); |
|
| 34 | - $logo = ''; |
|
| 35 | - |
|
| 36 | - if ($voir_logo) { |
|
| 37 | - $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 38 | - include_spip('inc/filtres_images_mini'); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - $res = []; |
|
| 42 | - |
|
| 43 | - $result = sql_select( |
|
| 44 | - 'id_rubrique, id_parent, titre, descriptif, lang', |
|
| 45 | - 'spip_rubriques', |
|
| 46 | - 'id_parent=' . intval($collection), |
|
| 47 | - '', |
|
| 48 | - '0+titre,titre', |
|
| 49 | - $debut == -1 ? '' : "$debut,$limite" |
|
| 50 | - ); |
|
| 51 | - while ($row = sql_fetch($result)) { |
|
| 52 | - $id_rubrique = $row['id_rubrique']; |
|
| 53 | - $id_parent = $row['id_parent']; |
|
| 54 | - // pour etre sur de passer par tous les traitements |
|
| 55 | - $titre = generer_objet_info($id_rubrique, 'rubrique', 'titre'); |
|
| 56 | - if ('' !== ($rang = recuperer_numero($row['titre']))) { |
|
| 57 | - $rang = "<span class='rang'>$rang.</span> "; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - if (autoriser('voir', 'rubrique', $id_rubrique)) { |
|
| 61 | - $les_sous_enfants = sous_enfant_rub($id_rubrique); |
|
| 62 | - |
|
| 63 | - changer_typo($row['lang']); |
|
| 64 | - $lang_dir = lang_dir($row['lang']); |
|
| 65 | - $descriptif = propre($row['descriptif']); |
|
| 66 | - |
|
| 67 | - if ($voir_logo) { |
|
| 68 | - if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) { |
|
| 69 | - [$fid, $dir, $nom, $format] = $logo; |
|
| 70 | - $logo = image_recadre_avec_fallback("<img src='$fid' alt='' />", 70, 70); |
|
| 71 | - if ($logo) { |
|
| 72 | - $logo = wrap(inserer_attribut($logo, 'class', 'logo'), '<span class="logo-carre">'); |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : |
|
| 78 | - http_img_pack( |
|
| 79 | - 'auteur-0minirezo-16.png', |
|
| 80 | - '', |
|
| 81 | - " width='16' height='16'", |
|
| 82 | - _T('image_administrer_rubrique') |
|
| 83 | - )) . |
|
| 84 | - " <a class='titremlien' dir='$lang_dir'" . |
|
| 85 | - ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='" . $row['lang'] . "'" : '') . |
|
| 86 | - " href='" . |
|
| 87 | - generer_objet_url($id_rubrique, 'rubrique') . |
|
| 88 | - "'><span class='titre'>" . |
|
| 89 | - $rang . $titre |
|
| 90 | - . '</span>' |
|
| 91 | - . (is_string($logo) ? $logo : '') |
|
| 92 | - . '</a>'; |
|
| 93 | - |
|
| 94 | - $titre = bouton_block_depliable($lib_bouton, $les_sous_enfants ? false : -1, "enfants$id_rubrique") |
|
| 95 | - . (!$descriptif ? '' : "\n<div class='descriptif'>$descriptif</div>") |
|
| 96 | - ; |
|
| 97 | - |
|
| 98 | - $res[] = |
|
| 99 | - debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre) . |
|
| 100 | - $les_sous_enfants . |
|
| 101 | - fin_cadre_sous_rub(); |
|
| 102 | - } |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - changer_typo($GLOBALS['spip_lang']); # remettre la typo de l'interface pour la suite |
|
| 106 | - return $res; |
|
| 33 | + $voir_logo = (isset($GLOBALS['meta']['image_process']) and $GLOBALS['meta']['image_process'] != 'non'); |
|
| 34 | + $logo = ''; |
|
| 35 | + |
|
| 36 | + if ($voir_logo) { |
|
| 37 | + $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 38 | + include_spip('inc/filtres_images_mini'); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + $res = []; |
|
| 42 | + |
|
| 43 | + $result = sql_select( |
|
| 44 | + 'id_rubrique, id_parent, titre, descriptif, lang', |
|
| 45 | + 'spip_rubriques', |
|
| 46 | + 'id_parent=' . intval($collection), |
|
| 47 | + '', |
|
| 48 | + '0+titre,titre', |
|
| 49 | + $debut == -1 ? '' : "$debut,$limite" |
|
| 50 | + ); |
|
| 51 | + while ($row = sql_fetch($result)) { |
|
| 52 | + $id_rubrique = $row['id_rubrique']; |
|
| 53 | + $id_parent = $row['id_parent']; |
|
| 54 | + // pour etre sur de passer par tous les traitements |
|
| 55 | + $titre = generer_objet_info($id_rubrique, 'rubrique', 'titre'); |
|
| 56 | + if ('' !== ($rang = recuperer_numero($row['titre']))) { |
|
| 57 | + $rang = "<span class='rang'>$rang.</span> "; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + if (autoriser('voir', 'rubrique', $id_rubrique)) { |
|
| 61 | + $les_sous_enfants = sous_enfant_rub($id_rubrique); |
|
| 62 | + |
|
| 63 | + changer_typo($row['lang']); |
|
| 64 | + $lang_dir = lang_dir($row['lang']); |
|
| 65 | + $descriptif = propre($row['descriptif']); |
|
| 66 | + |
|
| 67 | + if ($voir_logo) { |
|
| 68 | + if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) { |
|
| 69 | + [$fid, $dir, $nom, $format] = $logo; |
|
| 70 | + $logo = image_recadre_avec_fallback("<img src='$fid' alt='' />", 70, 70); |
|
| 71 | + if ($logo) { |
|
| 72 | + $logo = wrap(inserer_attribut($logo, 'class', 'logo'), '<span class="logo-carre">'); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : |
|
| 78 | + http_img_pack( |
|
| 79 | + 'auteur-0minirezo-16.png', |
|
| 80 | + '', |
|
| 81 | + " width='16' height='16'", |
|
| 82 | + _T('image_administrer_rubrique') |
|
| 83 | + )) . |
|
| 84 | + " <a class='titremlien' dir='$lang_dir'" . |
|
| 85 | + ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='" . $row['lang'] . "'" : '') . |
|
| 86 | + " href='" . |
|
| 87 | + generer_objet_url($id_rubrique, 'rubrique') . |
|
| 88 | + "'><span class='titre'>" . |
|
| 89 | + $rang . $titre |
|
| 90 | + . '</span>' |
|
| 91 | + . (is_string($logo) ? $logo : '') |
|
| 92 | + . '</a>'; |
|
| 93 | + |
|
| 94 | + $titre = bouton_block_depliable($lib_bouton, $les_sous_enfants ? false : -1, "enfants$id_rubrique") |
|
| 95 | + . (!$descriptif ? '' : "\n<div class='descriptif'>$descriptif</div>") |
|
| 96 | + ; |
|
| 97 | + |
|
| 98 | + $res[] = |
|
| 99 | + debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre) . |
|
| 100 | + $les_sous_enfants . |
|
| 101 | + fin_cadre_sous_rub(); |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + changer_typo($GLOBALS['spip_lang']); # remettre la typo de l'interface pour la suite |
|
| 106 | + return $res; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -116,71 +116,71 @@ discard block |
||
| 116 | 116 | * Le contenu du bloc dépliable |
| 117 | 117 | */ |
| 118 | 118 | function sous_enfant_rub($collection2) { |
| 119 | - $nb = sql_countsel('spip_rubriques', 'id_parent=' . intval($collection2)); |
|
| 120 | - |
|
| 121 | - $retour = ''; |
|
| 122 | - $pagination = ''; |
|
| 123 | - $debut = 0; |
|
| 124 | - $limite = 500; |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * On ne va afficher que 500 résultats max |
|
| 128 | - * Si > 500 on affiche une pagination |
|
| 129 | - */ |
|
| 130 | - if ($nb > $limite) { |
|
| 131 | - $debut = _request('debut_rubrique' . $collection2) ?: $debut; |
|
| 132 | - $pagination = chercher_filtre('pagination'); |
|
| 133 | - $pagination = '<nav class="pagination">' . $pagination( |
|
| 134 | - $nb, |
|
| 135 | - '_rubrique' . $collection2, |
|
| 136 | - $debut, |
|
| 137 | - $limite, |
|
| 138 | - true, |
|
| 139 | - 'prive' |
|
| 140 | - ) . '</nav>'; |
|
| 141 | - $limite = $debut + $limite; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - $result = sql_select( |
|
| 145 | - 'id_rubrique, id_parent, titre, lang', |
|
| 146 | - 'spip_rubriques', |
|
| 147 | - 'id_parent=' . intval($collection2), |
|
| 148 | - '', |
|
| 149 | - '0+titre,titre', |
|
| 150 | - $debut == -1 ? '' : "$debut,$limite" |
|
| 151 | - ); |
|
| 152 | - |
|
| 153 | - while ($row = sql_fetch($result)) { |
|
| 154 | - $id_rubrique2 = $row['id_rubrique']; |
|
| 155 | - $titre2 = generer_objet_info( |
|
| 156 | - $id_rubrique2, |
|
| 157 | - 'rubrique', |
|
| 158 | - 'titre' |
|
| 159 | - ); // pour etre sur de passer par tous les traitements |
|
| 160 | - if ('' !== ($rang2 = recuperer_numero($row['titre']))) { |
|
| 161 | - $rang2 = "<span class='rang'>$rang2.</span> "; |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - changer_typo($row['lang']); |
|
| 165 | - $lang_dir = lang_dir($row['lang']); |
|
| 166 | - if (autoriser('voir', 'rubrique', $id_rubrique2)) { |
|
| 167 | - $retour .= "\n<li class='item' dir='$lang_dir'><a href='" . generer_objet_url( |
|
| 168 | - $id_rubrique2, |
|
| 169 | - 'rubrique' |
|
| 170 | - ) . "'>" . $rang2 . $titre2 . "</a></li>\n"; |
|
| 171 | - } |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - $retour = $pagination . $retour . $pagination; |
|
| 175 | - |
|
| 176 | - if (!$retour) { |
|
| 177 | - return ''; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - return debut_block_depliable($debut > 0 ? true : false, "enfants$collection2") |
|
| 181 | - . "\n<ul class='liste-items sous-sous-rub'>\n" |
|
| 182 | - . $retour |
|
| 183 | - . "</ul>\n" . fin_block() . "\n\n"; |
|
| 119 | + $nb = sql_countsel('spip_rubriques', 'id_parent=' . intval($collection2)); |
|
| 120 | + |
|
| 121 | + $retour = ''; |
|
| 122 | + $pagination = ''; |
|
| 123 | + $debut = 0; |
|
| 124 | + $limite = 500; |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * On ne va afficher que 500 résultats max |
|
| 128 | + * Si > 500 on affiche une pagination |
|
| 129 | + */ |
|
| 130 | + if ($nb > $limite) { |
|
| 131 | + $debut = _request('debut_rubrique' . $collection2) ?: $debut; |
|
| 132 | + $pagination = chercher_filtre('pagination'); |
|
| 133 | + $pagination = '<nav class="pagination">' . $pagination( |
|
| 134 | + $nb, |
|
| 135 | + '_rubrique' . $collection2, |
|
| 136 | + $debut, |
|
| 137 | + $limite, |
|
| 138 | + true, |
|
| 139 | + 'prive' |
|
| 140 | + ) . '</nav>'; |
|
| 141 | + $limite = $debut + $limite; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + $result = sql_select( |
|
| 145 | + 'id_rubrique, id_parent, titre, lang', |
|
| 146 | + 'spip_rubriques', |
|
| 147 | + 'id_parent=' . intval($collection2), |
|
| 148 | + '', |
|
| 149 | + '0+titre,titre', |
|
| 150 | + $debut == -1 ? '' : "$debut,$limite" |
|
| 151 | + ); |
|
| 152 | + |
|
| 153 | + while ($row = sql_fetch($result)) { |
|
| 154 | + $id_rubrique2 = $row['id_rubrique']; |
|
| 155 | + $titre2 = generer_objet_info( |
|
| 156 | + $id_rubrique2, |
|
| 157 | + 'rubrique', |
|
| 158 | + 'titre' |
|
| 159 | + ); // pour etre sur de passer par tous les traitements |
|
| 160 | + if ('' !== ($rang2 = recuperer_numero($row['titre']))) { |
|
| 161 | + $rang2 = "<span class='rang'>$rang2.</span> "; |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + changer_typo($row['lang']); |
|
| 165 | + $lang_dir = lang_dir($row['lang']); |
|
| 166 | + if (autoriser('voir', 'rubrique', $id_rubrique2)) { |
|
| 167 | + $retour .= "\n<li class='item' dir='$lang_dir'><a href='" . generer_objet_url( |
|
| 168 | + $id_rubrique2, |
|
| 169 | + 'rubrique' |
|
| 170 | + ) . "'>" . $rang2 . $titre2 . "</a></li>\n"; |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + $retour = $pagination . $retour . $pagination; |
|
| 175 | + |
|
| 176 | + if (!$retour) { |
|
| 177 | + return ''; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + return debut_block_depliable($debut > 0 ? true : false, "enfants$collection2") |
|
| 181 | + . "\n<ul class='liste-items sous-sous-rub'>\n" |
|
| 182 | + . $retour |
|
| 183 | + . "</ul>\n" . fin_block() . "\n\n"; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -195,44 +195,44 @@ discard block |
||
| 195 | 195 | * Le contenu textuel affiché, la liste des sous rubriques |
| 196 | 196 | */ |
| 197 | 197 | function afficher_enfant_rub($id_rubrique = 0) { |
| 198 | - $pagination = ''; |
|
| 199 | - $debut = 0; |
|
| 200 | - $limite = 500; |
|
| 201 | - |
|
| 202 | - $nb = sql_countsel('spip_rubriques', 'id_parent=' . intval($id_rubrique)); |
|
| 203 | - |
|
| 204 | - if ($nb > $limite) { |
|
| 205 | - $debut = _request('debut_rubrique' . $id_rubrique) ?: $debut; |
|
| 206 | - $pagination = chercher_filtre('pagination'); |
|
| 207 | - $pagination = '<br class="nettoyeur"><nav class="pagination">' . |
|
| 208 | - $pagination($nb, '_rubrique' . $id_rubrique, $debut, $limite, true, 'prive') . |
|
| 209 | - '</nav>'; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - $les_enfants = enfant_rub($id_rubrique, $debut, $limite); |
|
| 213 | - |
|
| 214 | - if (!$n = count($les_enfants)) { |
|
| 215 | - return ''; |
|
| 216 | - } |
|
| 217 | - |
|
| 218 | - if ($n == 1) { |
|
| 219 | - $les_enfants = reset($les_enfants); |
|
| 220 | - $les_enfants2 = ''; |
|
| 221 | - } else { |
|
| 222 | - $n = ceil($n / 2); |
|
| 223 | - $les_enfants2 = implode('', array_slice($les_enfants, $n)); |
|
| 224 | - $les_enfants = implode('', array_slice($les_enfants, 0, $n)); |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - $res = |
|
| 228 | - $pagination |
|
| 229 | - . "<div class='gauche'>" |
|
| 230 | - . $les_enfants |
|
| 231 | - . '</div>' |
|
| 232 | - . "<div class='droite'>" |
|
| 233 | - . $les_enfants2 |
|
| 234 | - . '</div>' |
|
| 235 | - . $pagination; |
|
| 236 | - |
|
| 237 | - return $res; |
|
| 198 | + $pagination = ''; |
|
| 199 | + $debut = 0; |
|
| 200 | + $limite = 500; |
|
| 201 | + |
|
| 202 | + $nb = sql_countsel('spip_rubriques', 'id_parent=' . intval($id_rubrique)); |
|
| 203 | + |
|
| 204 | + if ($nb > $limite) { |
|
| 205 | + $debut = _request('debut_rubrique' . $id_rubrique) ?: $debut; |
|
| 206 | + $pagination = chercher_filtre('pagination'); |
|
| 207 | + $pagination = '<br class="nettoyeur"><nav class="pagination">' . |
|
| 208 | + $pagination($nb, '_rubrique' . $id_rubrique, $debut, $limite, true, 'prive') . |
|
| 209 | + '</nav>'; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + $les_enfants = enfant_rub($id_rubrique, $debut, $limite); |
|
| 213 | + |
|
| 214 | + if (!$n = count($les_enfants)) { |
|
| 215 | + return ''; |
|
| 216 | + } |
|
| 217 | + |
|
| 218 | + if ($n == 1) { |
|
| 219 | + $les_enfants = reset($les_enfants); |
|
| 220 | + $les_enfants2 = ''; |
|
| 221 | + } else { |
|
| 222 | + $n = ceil($n / 2); |
|
| 223 | + $les_enfants2 = implode('', array_slice($les_enfants, $n)); |
|
| 224 | + $les_enfants = implode('', array_slice($les_enfants, 0, $n)); |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + $res = |
|
| 228 | + $pagination |
|
| 229 | + . "<div class='gauche'>" |
|
| 230 | + . $les_enfants |
|
| 231 | + . '</div>' |
|
| 232 | + . "<div class='droite'>" |
|
| 233 | + . $les_enfants2 |
|
| 234 | + . '</div>' |
|
| 235 | + . $pagination; |
|
| 236 | + |
|
| 237 | + return $res; |
|
| 238 | 238 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $result = sql_select( |
| 44 | 44 | 'id_rubrique, id_parent, titre, descriptif, lang', |
| 45 | 45 | 'spip_rubriques', |
| 46 | - 'id_parent=' . intval($collection), |
|
| 46 | + 'id_parent='.intval($collection), |
|
| 47 | 47 | '', |
| 48 | 48 | '0+titre,titre', |
| 49 | 49 | $debut == -1 ? '' : "$debut,$limite" |
@@ -74,19 +74,18 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : |
|
| 78 | - http_img_pack( |
|
| 77 | + $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : http_img_pack( |
|
| 79 | 78 | 'auteur-0minirezo-16.png', |
| 80 | 79 | '', |
| 81 | 80 | " width='16' height='16'", |
| 82 | 81 | _T('image_administrer_rubrique') |
| 83 | - )) . |
|
| 84 | - " <a class='titremlien' dir='$lang_dir'" . |
|
| 85 | - ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='" . $row['lang'] . "'" : '') . |
|
| 86 | - " href='" . |
|
| 87 | - generer_objet_url($id_rubrique, 'rubrique') . |
|
| 88 | - "'><span class='titre'>" . |
|
| 89 | - $rang . $titre |
|
| 82 | + )). |
|
| 83 | + " <a class='titremlien' dir='$lang_dir'". |
|
| 84 | + ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='".$row['lang']."'" : ''). |
|
| 85 | + " href='". |
|
| 86 | + generer_objet_url($id_rubrique, 'rubrique'). |
|
| 87 | + "'><span class='titre'>". |
|
| 88 | + $rang.$titre |
|
| 90 | 89 | . '</span>' |
| 91 | 90 | . (is_string($logo) ? $logo : '') |
| 92 | 91 | . '</a>'; |
@@ -96,8 +95,8 @@ discard block |
||
| 96 | 95 | ; |
| 97 | 96 | |
| 98 | 97 | $res[] = |
| 99 | - debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre) . |
|
| 100 | - $les_sous_enfants . |
|
| 98 | + debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre). |
|
| 99 | + $les_sous_enfants. |
|
| 101 | 100 | fin_cadre_sous_rub(); |
| 102 | 101 | } |
| 103 | 102 | } |
@@ -116,7 +115,7 @@ discard block |
||
| 116 | 115 | * Le contenu du bloc dépliable |
| 117 | 116 | */ |
| 118 | 117 | function sous_enfant_rub($collection2) { |
| 119 | - $nb = sql_countsel('spip_rubriques', 'id_parent=' . intval($collection2)); |
|
| 118 | + $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($collection2)); |
|
| 120 | 119 | |
| 121 | 120 | $retour = ''; |
| 122 | 121 | $pagination = ''; |
@@ -128,23 +127,23 @@ discard block |
||
| 128 | 127 | * Si > 500 on affiche une pagination |
| 129 | 128 | */ |
| 130 | 129 | if ($nb > $limite) { |
| 131 | - $debut = _request('debut_rubrique' . $collection2) ?: $debut; |
|
| 130 | + $debut = _request('debut_rubrique'.$collection2) ?: $debut; |
|
| 132 | 131 | $pagination = chercher_filtre('pagination'); |
| 133 | - $pagination = '<nav class="pagination">' . $pagination( |
|
| 132 | + $pagination = '<nav class="pagination">'.$pagination( |
|
| 134 | 133 | $nb, |
| 135 | - '_rubrique' . $collection2, |
|
| 134 | + '_rubrique'.$collection2, |
|
| 136 | 135 | $debut, |
| 137 | 136 | $limite, |
| 138 | 137 | true, |
| 139 | 138 | 'prive' |
| 140 | - ) . '</nav>'; |
|
| 139 | + ).'</nav>'; |
|
| 141 | 140 | $limite = $debut + $limite; |
| 142 | 141 | } |
| 143 | 142 | |
| 144 | 143 | $result = sql_select( |
| 145 | 144 | 'id_rubrique, id_parent, titre, lang', |
| 146 | 145 | 'spip_rubriques', |
| 147 | - 'id_parent=' . intval($collection2), |
|
| 146 | + 'id_parent='.intval($collection2), |
|
| 148 | 147 | '', |
| 149 | 148 | '0+titre,titre', |
| 150 | 149 | $debut == -1 ? '' : "$debut,$limite" |
@@ -164,14 +163,14 @@ discard block |
||
| 164 | 163 | changer_typo($row['lang']); |
| 165 | 164 | $lang_dir = lang_dir($row['lang']); |
| 166 | 165 | if (autoriser('voir', 'rubrique', $id_rubrique2)) { |
| 167 | - $retour .= "\n<li class='item' dir='$lang_dir'><a href='" . generer_objet_url( |
|
| 166 | + $retour .= "\n<li class='item' dir='$lang_dir'><a href='".generer_objet_url( |
|
| 168 | 167 | $id_rubrique2, |
| 169 | 168 | 'rubrique' |
| 170 | - ) . "'>" . $rang2 . $titre2 . "</a></li>\n"; |
|
| 169 | + )."'>".$rang2.$titre2."</a></li>\n"; |
|
| 171 | 170 | } |
| 172 | 171 | } |
| 173 | 172 | |
| 174 | - $retour = $pagination . $retour . $pagination; |
|
| 173 | + $retour = $pagination.$retour.$pagination; |
|
| 175 | 174 | |
| 176 | 175 | if (!$retour) { |
| 177 | 176 | return ''; |
@@ -180,7 +179,7 @@ discard block |
||
| 180 | 179 | return debut_block_depliable($debut > 0 ? true : false, "enfants$collection2") |
| 181 | 180 | . "\n<ul class='liste-items sous-sous-rub'>\n" |
| 182 | 181 | . $retour |
| 183 | - . "</ul>\n" . fin_block() . "\n\n"; |
|
| 182 | + . "</ul>\n".fin_block()."\n\n"; |
|
| 184 | 183 | } |
| 185 | 184 | |
| 186 | 185 | /** |
@@ -199,13 +198,13 @@ discard block |
||
| 199 | 198 | $debut = 0; |
| 200 | 199 | $limite = 500; |
| 201 | 200 | |
| 202 | - $nb = sql_countsel('spip_rubriques', 'id_parent=' . intval($id_rubrique)); |
|
| 201 | + $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($id_rubrique)); |
|
| 203 | 202 | |
| 204 | 203 | if ($nb > $limite) { |
| 205 | - $debut = _request('debut_rubrique' . $id_rubrique) ?: $debut; |
|
| 204 | + $debut = _request('debut_rubrique'.$id_rubrique) ?: $debut; |
|
| 206 | 205 | $pagination = chercher_filtre('pagination'); |
| 207 | - $pagination = '<br class="nettoyeur"><nav class="pagination">' . |
|
| 208 | - $pagination($nb, '_rubrique' . $id_rubrique, $debut, $limite, true, 'prive') . |
|
| 206 | + $pagination = '<br class="nettoyeur"><nav class="pagination">'. |
|
| 207 | + $pagination($nb, '_rubrique'.$id_rubrique, $debut, $limite, true, 'prive'). |
|
| 209 | 208 | '</nav>'; |
| 210 | 209 | } |
| 211 | 210 | |
@@ -11,129 +11,129 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Decompilation de l'arbre de syntaxe abstraite d'un squelette SPIP |
| 18 | 18 | |
| 19 | 19 | function decompiler_boucle($struct, $fmt = '', $prof = 0) { |
| 20 | - $nom = $struct->id_boucle; |
|
| 21 | - $preaff = decompiler_($struct->preaff, $fmt, $prof); |
|
| 22 | - $avant = decompiler_($struct->avant, $fmt, $prof); |
|
| 23 | - $apres = decompiler_($struct->apres, $fmt, $prof); |
|
| 24 | - $altern = decompiler_($struct->altern, $fmt, $prof); |
|
| 25 | - $milieu = decompiler_($struct->milieu, $fmt, $prof); |
|
| 26 | - $postaff = decompiler_($struct->postaff, $fmt, $prof); |
|
| 27 | - |
|
| 28 | - $type = $struct->sql_serveur ? "$struct->sql_serveur:" : ''; |
|
| 29 | - $type .= ($struct->type_requete ?: $struct->table_optionnelle); |
|
| 30 | - |
|
| 31 | - if ($struct->jointures_explicites) { |
|
| 32 | - $type .= ' ' . $struct->jointures_explicites; |
|
| 33 | - } |
|
| 34 | - if ($struct->table_optionnelle) { |
|
| 35 | - $type .= '?'; |
|
| 36 | - } |
|
| 37 | - // Revoir le cas de la boucle recursive |
|
| 38 | - |
|
| 39 | - $crit = $struct->param; |
|
| 40 | - if ($crit and !is_array($crit[0])) { |
|
| 41 | - $type = strtolower($type) . array_shift($crit); |
|
| 42 | - } |
|
| 43 | - $crit = decompiler_criteres($struct, $fmt, $prof); |
|
| 44 | - |
|
| 45 | - $f = 'format_boucle_' . $fmt; |
|
| 46 | - |
|
| 47 | - return $f($preaff, $avant, $nom, $type, $crit, $milieu, $apres, $altern, $postaff, $prof); |
|
| 20 | + $nom = $struct->id_boucle; |
|
| 21 | + $preaff = decompiler_($struct->preaff, $fmt, $prof); |
|
| 22 | + $avant = decompiler_($struct->avant, $fmt, $prof); |
|
| 23 | + $apres = decompiler_($struct->apres, $fmt, $prof); |
|
| 24 | + $altern = decompiler_($struct->altern, $fmt, $prof); |
|
| 25 | + $milieu = decompiler_($struct->milieu, $fmt, $prof); |
|
| 26 | + $postaff = decompiler_($struct->postaff, $fmt, $prof); |
|
| 27 | + |
|
| 28 | + $type = $struct->sql_serveur ? "$struct->sql_serveur:" : ''; |
|
| 29 | + $type .= ($struct->type_requete ?: $struct->table_optionnelle); |
|
| 30 | + |
|
| 31 | + if ($struct->jointures_explicites) { |
|
| 32 | + $type .= ' ' . $struct->jointures_explicites; |
|
| 33 | + } |
|
| 34 | + if ($struct->table_optionnelle) { |
|
| 35 | + $type .= '?'; |
|
| 36 | + } |
|
| 37 | + // Revoir le cas de la boucle recursive |
|
| 38 | + |
|
| 39 | + $crit = $struct->param; |
|
| 40 | + if ($crit and !is_array($crit[0])) { |
|
| 41 | + $type = strtolower($type) . array_shift($crit); |
|
| 42 | + } |
|
| 43 | + $crit = decompiler_criteres($struct, $fmt, $prof); |
|
| 44 | + |
|
| 45 | + $f = 'format_boucle_' . $fmt; |
|
| 46 | + |
|
| 47 | + return $f($preaff, $avant, $nom, $type, $crit, $milieu, $apres, $altern, $postaff, $prof); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | function decompiler_include($struct, $fmt = '', $prof = 0) { |
| 51 | - $res = []; |
|
| 52 | - foreach ($struct->param ?: [] as $couple) { |
|
| 53 | - array_shift($couple); |
|
| 54 | - foreach ($couple as $v) { |
|
| 55 | - $res[] = decompiler_($v, $fmt, $prof); |
|
| 56 | - } |
|
| 57 | - } |
|
| 58 | - $file = is_string($struct->texte) ? $struct->texte : |
|
| 59 | - decompiler_($struct->texte, $fmt, $prof); |
|
| 60 | - $f = 'format_inclure_' . $fmt; |
|
| 61 | - |
|
| 62 | - return $f($file, $res, $prof); |
|
| 51 | + $res = []; |
|
| 52 | + foreach ($struct->param ?: [] as $couple) { |
|
| 53 | + array_shift($couple); |
|
| 54 | + foreach ($couple as $v) { |
|
| 55 | + $res[] = decompiler_($v, $fmt, $prof); |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | + $file = is_string($struct->texte) ? $struct->texte : |
|
| 59 | + decompiler_($struct->texte, $fmt, $prof); |
|
| 60 | + $f = 'format_inclure_' . $fmt; |
|
| 61 | + |
|
| 62 | + return $f($file, $res, $prof); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | function decompiler_texte($struct, $fmt = '', $prof = 0) { |
| 66 | - $f = 'format_texte_' . $fmt; |
|
| 66 | + $f = 'format_texte_' . $fmt; |
|
| 67 | 67 | |
| 68 | - return strlen($struct->texte) ? $f($struct->texte, $prof) : ''; |
|
| 68 | + return strlen($struct->texte) ? $f($struct->texte, $prof) : ''; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | function decompiler_polyglotte($struct, $fmt = '', $prof = 0) { |
| 72 | - $f = 'format_polyglotte_' . $fmt; |
|
| 72 | + $f = 'format_polyglotte_' . $fmt; |
|
| 73 | 73 | |
| 74 | - return $f($struct->traductions, $prof); |
|
| 74 | + return $f($struct->traductions, $prof); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | function decompiler_idiome($struct, $fmt = '', $prof = 0) { |
| 78 | - $args = []; |
|
| 79 | - foreach ($struct->arg as $k => $v) { |
|
| 80 | - $args[$k] = public_decompiler($v, $fmt, $prof); |
|
| 81 | - } |
|
| 78 | + $args = []; |
|
| 79 | + foreach ($struct->arg as $k => $v) { |
|
| 80 | + $args[$k] = public_decompiler($v, $fmt, $prof); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - $filtres = decompiler_liste($struct->param, $fmt, $prof); |
|
| 83 | + $filtres = decompiler_liste($struct->param, $fmt, $prof); |
|
| 84 | 84 | |
| 85 | - $f = 'format_idiome_' . $fmt; |
|
| 85 | + $f = 'format_idiome_' . $fmt; |
|
| 86 | 86 | |
| 87 | - return $f($struct->nom_champ, $struct->module, $args, $filtres, $prof); |
|
| 87 | + return $f($struct->nom_champ, $struct->module, $args, $filtres, $prof); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | function decompiler_champ($struct, $fmt = '', $prof = 0) { |
| 91 | - $avant = decompiler_($struct->avant, $fmt, $prof); |
|
| 92 | - $apres = decompiler_($struct->apres, $fmt, $prof); |
|
| 93 | - $args = $filtres = ''; |
|
| 94 | - if ($p = $struct->param) { |
|
| 95 | - if ($p[0][0] === '') { |
|
| 96 | - $args = decompiler_liste([array_shift($p)], $fmt, $prof); |
|
| 97 | - } |
|
| 98 | - $filtres = decompiler_liste($p, $fmt, $prof); |
|
| 99 | - } |
|
| 100 | - $f = 'format_champ_' . $fmt; |
|
| 101 | - |
|
| 102 | - return $f($struct->nom_champ, $struct->nom_boucle, $struct->etoile, $avant, $apres, $args, $filtres, $prof); |
|
| 91 | + $avant = decompiler_($struct->avant, $fmt, $prof); |
|
| 92 | + $apres = decompiler_($struct->apres, $fmt, $prof); |
|
| 93 | + $args = $filtres = ''; |
|
| 94 | + if ($p = $struct->param) { |
|
| 95 | + if ($p[0][0] === '') { |
|
| 96 | + $args = decompiler_liste([array_shift($p)], $fmt, $prof); |
|
| 97 | + } |
|
| 98 | + $filtres = decompiler_liste($p, $fmt, $prof); |
|
| 99 | + } |
|
| 100 | + $f = 'format_champ_' . $fmt; |
|
| 101 | + |
|
| 102 | + return $f($struct->nom_champ, $struct->nom_boucle, $struct->etoile, $avant, $apres, $args, $filtres, $prof); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | function decompiler_liste($sources, $fmt = '', $prof = 0) { |
| 106 | - if (!is_array($sources)) { |
|
| 107 | - return ''; |
|
| 108 | - } |
|
| 109 | - $f = 'format_liste_' . $fmt; |
|
| 110 | - $res = ''; |
|
| 111 | - foreach ($sources as $arg) { |
|
| 112 | - if (!is_array($arg)) { |
|
| 113 | - continue; // ne devrait pas arriver. |
|
| 114 | - } else { |
|
| 115 | - $r = array_shift($arg); |
|
| 116 | - } |
|
| 117 | - $args = []; |
|
| 118 | - foreach ($arg as $v) { |
|
| 119 | - // cas des arguments entoures de ' ou " |
|
| 120 | - if ( |
|
| 121 | - ((is_countable($v) ? count($v) : 0) == 1) |
|
| 122 | - and $v[0]->type == 'texte' |
|
| 123 | - and (strlen($v[0]->apres) == 1) |
|
| 124 | - and $v[0]->apres == $v[0]->avant |
|
| 125 | - ) { |
|
| 126 | - $args[] = $v[0]->avant . $v[0]->texte . $v[0]->apres; |
|
| 127 | - } else { |
|
| 128 | - $args[] = decompiler_($v, $fmt, 0 - $prof); |
|
| 129 | - } |
|
| 130 | - } |
|
| 131 | - if (($r !== '') or $args) { |
|
| 132 | - $res .= $f($r, $args, $prof); |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - return $res; |
|
| 106 | + if (!is_array($sources)) { |
|
| 107 | + return ''; |
|
| 108 | + } |
|
| 109 | + $f = 'format_liste_' . $fmt; |
|
| 110 | + $res = ''; |
|
| 111 | + foreach ($sources as $arg) { |
|
| 112 | + if (!is_array($arg)) { |
|
| 113 | + continue; // ne devrait pas arriver. |
|
| 114 | + } else { |
|
| 115 | + $r = array_shift($arg); |
|
| 116 | + } |
|
| 117 | + $args = []; |
|
| 118 | + foreach ($arg as $v) { |
|
| 119 | + // cas des arguments entoures de ' ou " |
|
| 120 | + if ( |
|
| 121 | + ((is_countable($v) ? count($v) : 0) == 1) |
|
| 122 | + and $v[0]->type == 'texte' |
|
| 123 | + and (strlen($v[0]->apres) == 1) |
|
| 124 | + and $v[0]->apres == $v[0]->avant |
|
| 125 | + ) { |
|
| 126 | + $args[] = $v[0]->avant . $v[0]->texte . $v[0]->apres; |
|
| 127 | + } else { |
|
| 128 | + $args[] = decompiler_($v, $fmt, 0 - $prof); |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | + if (($r !== '') or $args) { |
|
| 132 | + $res .= $f($r, $args, $prof); |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + return $res; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // Decompilation des criteres: on triche et on deroge: |
@@ -141,93 +141,93 @@ discard block |
||
| 141 | 141 | // - le champ apres signale le critere {"separateur"} ou {'separateur'} |
| 142 | 142 | // - les champs sont implicitement etendus (crochets implicites mais interdits) |
| 143 | 143 | function decompiler_criteres($boucle, $fmt = '', $prof = 0) { |
| 144 | - $sources = $boucle->param; |
|
| 145 | - if (!is_array($sources)) { |
|
| 146 | - return ''; |
|
| 147 | - } |
|
| 148 | - $res = ''; |
|
| 149 | - $f = 'format_critere_' . $fmt; |
|
| 150 | - foreach ($sources as $crit) { |
|
| 151 | - if (!is_array($crit)) { |
|
| 152 | - continue; |
|
| 153 | - } // boucle recursive |
|
| 154 | - array_shift($crit); |
|
| 155 | - $args = []; |
|
| 156 | - foreach ($crit as $i => $v) { |
|
| 157 | - if ( |
|
| 158 | - ((is_countable($v) ? count($v) : 0) == 1) |
|
| 159 | - and $v[0]->type == 'texte' |
|
| 160 | - and $v[0]->apres |
|
| 161 | - ) { |
|
| 162 | - $args[] = [['texte', ($v[0]->apres . $v[0]->texte . $v[0]->apres)]]; |
|
| 163 | - } else { |
|
| 164 | - $res2 = []; |
|
| 165 | - foreach ($v as $k => $p) { |
|
| 166 | - if ( |
|
| 167 | - isset($p->type) |
|
| 168 | - and function_exists($d = 'decompiler_' . $p->type) |
|
| 169 | - ) { |
|
| 170 | - $r = $d($p, $fmt, (0 - $prof)); |
|
| 171 | - $res2[] = [$p->type, $r]; |
|
| 172 | - } else { |
|
| 173 | - spip_log("critere $i / $k mal forme"); |
|
| 174 | - } |
|
| 175 | - } |
|
| 176 | - $args[] = $res2; |
|
| 177 | - } |
|
| 178 | - } |
|
| 179 | - $res .= $f($args); |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - return $res; |
|
| 144 | + $sources = $boucle->param; |
|
| 145 | + if (!is_array($sources)) { |
|
| 146 | + return ''; |
|
| 147 | + } |
|
| 148 | + $res = ''; |
|
| 149 | + $f = 'format_critere_' . $fmt; |
|
| 150 | + foreach ($sources as $crit) { |
|
| 151 | + if (!is_array($crit)) { |
|
| 152 | + continue; |
|
| 153 | + } // boucle recursive |
|
| 154 | + array_shift($crit); |
|
| 155 | + $args = []; |
|
| 156 | + foreach ($crit as $i => $v) { |
|
| 157 | + if ( |
|
| 158 | + ((is_countable($v) ? count($v) : 0) == 1) |
|
| 159 | + and $v[0]->type == 'texte' |
|
| 160 | + and $v[0]->apres |
|
| 161 | + ) { |
|
| 162 | + $args[] = [['texte', ($v[0]->apres . $v[0]->texte . $v[0]->apres)]]; |
|
| 163 | + } else { |
|
| 164 | + $res2 = []; |
|
| 165 | + foreach ($v as $k => $p) { |
|
| 166 | + if ( |
|
| 167 | + isset($p->type) |
|
| 168 | + and function_exists($d = 'decompiler_' . $p->type) |
|
| 169 | + ) { |
|
| 170 | + $r = $d($p, $fmt, (0 - $prof)); |
|
| 171 | + $res2[] = [$p->type, $r]; |
|
| 172 | + } else { |
|
| 173 | + spip_log("critere $i / $k mal forme"); |
|
| 174 | + } |
|
| 175 | + } |
|
| 176 | + $args[] = $res2; |
|
| 177 | + } |
|
| 178 | + } |
|
| 179 | + $res .= $f($args); |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + return $res; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | |
| 186 | 186 | function decompiler_($liste, $fmt = '', $prof = 0) { |
| 187 | - if (!is_array($liste)) { |
|
| 188 | - return ''; |
|
| 189 | - } |
|
| 190 | - $prof2 = ($prof < 0) ? ($prof - 1) : ($prof + 1); |
|
| 191 | - $contenu = []; |
|
| 192 | - foreach ($liste as $k => $p) { |
|
| 193 | - if (!isset($p->type)) { |
|
| 194 | - continue; |
|
| 195 | - } #?????? |
|
| 196 | - $d = 'decompiler_' . $p->type; |
|
| 197 | - $next = $liste[$k + 1] ?? false; |
|
| 198 | - // Forcer le champ etendu si son source (pas les reecritures) |
|
| 199 | - // contenait des args et s'il est suivi d'espaces, |
|
| 200 | - // le champ simple les eliminant est un bug helas perenne. |
|
| 201 | - |
|
| 202 | - if ( |
|
| 203 | - $next |
|
| 204 | - and ($next->type == 'texte') |
|
| 205 | - and $p->type == 'champ' |
|
| 206 | - and !$p->apres |
|
| 207 | - and !$p->avant |
|
| 208 | - and $p->fonctions |
|
| 209 | - ) { |
|
| 210 | - $n = strlen($next->texte) - strlen(ltrim($next->texte)); |
|
| 211 | - if ($n) { |
|
| 212 | - $champ = new Texte(); |
|
| 213 | - $champ->texte = substr($next->texte, 0, $n); |
|
| 214 | - $champ->ligne = $p->ligne; |
|
| 215 | - $p->apres = [$champ]; |
|
| 216 | - $next->texte = substr($next->texte, $n); |
|
| 217 | - } |
|
| 218 | - } |
|
| 219 | - $contenu[] = [$d($p, $fmt, $prof2), $p->type]; |
|
| 220 | - } |
|
| 221 | - $f = 'format_suite_' . $fmt; |
|
| 222 | - |
|
| 223 | - return $f($contenu); |
|
| 187 | + if (!is_array($liste)) { |
|
| 188 | + return ''; |
|
| 189 | + } |
|
| 190 | + $prof2 = ($prof < 0) ? ($prof - 1) : ($prof + 1); |
|
| 191 | + $contenu = []; |
|
| 192 | + foreach ($liste as $k => $p) { |
|
| 193 | + if (!isset($p->type)) { |
|
| 194 | + continue; |
|
| 195 | + } #?????? |
|
| 196 | + $d = 'decompiler_' . $p->type; |
|
| 197 | + $next = $liste[$k + 1] ?? false; |
|
| 198 | + // Forcer le champ etendu si son source (pas les reecritures) |
|
| 199 | + // contenait des args et s'il est suivi d'espaces, |
|
| 200 | + // le champ simple les eliminant est un bug helas perenne. |
|
| 201 | + |
|
| 202 | + if ( |
|
| 203 | + $next |
|
| 204 | + and ($next->type == 'texte') |
|
| 205 | + and $p->type == 'champ' |
|
| 206 | + and !$p->apres |
|
| 207 | + and !$p->avant |
|
| 208 | + and $p->fonctions |
|
| 209 | + ) { |
|
| 210 | + $n = strlen($next->texte) - strlen(ltrim($next->texte)); |
|
| 211 | + if ($n) { |
|
| 212 | + $champ = new Texte(); |
|
| 213 | + $champ->texte = substr($next->texte, 0, $n); |
|
| 214 | + $champ->ligne = $p->ligne; |
|
| 215 | + $p->apres = [$champ]; |
|
| 216 | + $next->texte = substr($next->texte, $n); |
|
| 217 | + } |
|
| 218 | + } |
|
| 219 | + $contenu[] = [$d($p, $fmt, $prof2), $p->type]; |
|
| 220 | + } |
|
| 221 | + $f = 'format_suite_' . $fmt; |
|
| 222 | + |
|
| 223 | + return $f($contenu); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | function public_decompiler($liste, $fmt = '', $prof = 0, $quoi = '') { |
| 227 | - if (!include_spip('public/format_' . $fmt)) { |
|
| 228 | - return "'$fmt'?"; |
|
| 229 | - } |
|
| 230 | - $f = 'decompiler_' . $quoi; |
|
| 227 | + if (!include_spip('public/format_' . $fmt)) { |
|
| 228 | + return "'$fmt'?"; |
|
| 229 | + } |
|
| 230 | + $f = 'decompiler_' . $quoi; |
|
| 231 | 231 | |
| 232 | - return $f($liste, $fmt, $prof); |
|
| 232 | + return $f($liste, $fmt, $prof); |
|
| 233 | 233 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $type .= ($struct->type_requete ?: $struct->table_optionnelle); |
| 30 | 30 | |
| 31 | 31 | if ($struct->jointures_explicites) { |
| 32 | - $type .= ' ' . $struct->jointures_explicites; |
|
| 32 | + $type .= ' '.$struct->jointures_explicites; |
|
| 33 | 33 | } |
| 34 | 34 | if ($struct->table_optionnelle) { |
| 35 | 35 | $type .= '?'; |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $crit = $struct->param; |
| 40 | 40 | if ($crit and !is_array($crit[0])) { |
| 41 | - $type = strtolower($type) . array_shift($crit); |
|
| 41 | + $type = strtolower($type).array_shift($crit); |
|
| 42 | 42 | } |
| 43 | 43 | $crit = decompiler_criteres($struct, $fmt, $prof); |
| 44 | 44 | |
| 45 | - $f = 'format_boucle_' . $fmt; |
|
| 45 | + $f = 'format_boucle_'.$fmt; |
|
| 46 | 46 | |
| 47 | 47 | return $f($preaff, $avant, $nom, $type, $crit, $milieu, $apres, $altern, $postaff, $prof); |
| 48 | 48 | } |
@@ -55,21 +55,20 @@ discard block |
||
| 55 | 55 | $res[] = decompiler_($v, $fmt, $prof); |
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | - $file = is_string($struct->texte) ? $struct->texte : |
|
| 59 | - decompiler_($struct->texte, $fmt, $prof); |
|
| 60 | - $f = 'format_inclure_' . $fmt; |
|
| 58 | + $file = is_string($struct->texte) ? $struct->texte : decompiler_($struct->texte, $fmt, $prof); |
|
| 59 | + $f = 'format_inclure_'.$fmt; |
|
| 61 | 60 | |
| 62 | 61 | return $f($file, $res, $prof); |
| 63 | 62 | } |
| 64 | 63 | |
| 65 | 64 | function decompiler_texte($struct, $fmt = '', $prof = 0) { |
| 66 | - $f = 'format_texte_' . $fmt; |
|
| 65 | + $f = 'format_texte_'.$fmt; |
|
| 67 | 66 | |
| 68 | 67 | return strlen($struct->texte) ? $f($struct->texte, $prof) : ''; |
| 69 | 68 | } |
| 70 | 69 | |
| 71 | 70 | function decompiler_polyglotte($struct, $fmt = '', $prof = 0) { |
| 72 | - $f = 'format_polyglotte_' . $fmt; |
|
| 71 | + $f = 'format_polyglotte_'.$fmt; |
|
| 73 | 72 | |
| 74 | 73 | return $f($struct->traductions, $prof); |
| 75 | 74 | } |
@@ -82,7 +81,7 @@ discard block |
||
| 82 | 81 | |
| 83 | 82 | $filtres = decompiler_liste($struct->param, $fmt, $prof); |
| 84 | 83 | |
| 85 | - $f = 'format_idiome_' . $fmt; |
|
| 84 | + $f = 'format_idiome_'.$fmt; |
|
| 86 | 85 | |
| 87 | 86 | return $f($struct->nom_champ, $struct->module, $args, $filtres, $prof); |
| 88 | 87 | } |
@@ -97,7 +96,7 @@ discard block |
||
| 97 | 96 | } |
| 98 | 97 | $filtres = decompiler_liste($p, $fmt, $prof); |
| 99 | 98 | } |
| 100 | - $f = 'format_champ_' . $fmt; |
|
| 99 | + $f = 'format_champ_'.$fmt; |
|
| 101 | 100 | |
| 102 | 101 | return $f($struct->nom_champ, $struct->nom_boucle, $struct->etoile, $avant, $apres, $args, $filtres, $prof); |
| 103 | 102 | } |
@@ -106,7 +105,7 @@ discard block |
||
| 106 | 105 | if (!is_array($sources)) { |
| 107 | 106 | return ''; |
| 108 | 107 | } |
| 109 | - $f = 'format_liste_' . $fmt; |
|
| 108 | + $f = 'format_liste_'.$fmt; |
|
| 110 | 109 | $res = ''; |
| 111 | 110 | foreach ($sources as $arg) { |
| 112 | 111 | if (!is_array($arg)) { |
@@ -123,7 +122,7 @@ discard block |
||
| 123 | 122 | and (strlen($v[0]->apres) == 1) |
| 124 | 123 | and $v[0]->apres == $v[0]->avant |
| 125 | 124 | ) { |
| 126 | - $args[] = $v[0]->avant . $v[0]->texte . $v[0]->apres; |
|
| 125 | + $args[] = $v[0]->avant.$v[0]->texte.$v[0]->apres; |
|
| 127 | 126 | } else { |
| 128 | 127 | $args[] = decompiler_($v, $fmt, 0 - $prof); |
| 129 | 128 | } |
@@ -146,7 +145,7 @@ discard block |
||
| 146 | 145 | return ''; |
| 147 | 146 | } |
| 148 | 147 | $res = ''; |
| 149 | - $f = 'format_critere_' . $fmt; |
|
| 148 | + $f = 'format_critere_'.$fmt; |
|
| 150 | 149 | foreach ($sources as $crit) { |
| 151 | 150 | if (!is_array($crit)) { |
| 152 | 151 | continue; |
@@ -159,13 +158,13 @@ discard block |
||
| 159 | 158 | and $v[0]->type == 'texte' |
| 160 | 159 | and $v[0]->apres |
| 161 | 160 | ) { |
| 162 | - $args[] = [['texte', ($v[0]->apres . $v[0]->texte . $v[0]->apres)]]; |
|
| 161 | + $args[] = [['texte', ($v[0]->apres.$v[0]->texte.$v[0]->apres)]]; |
|
| 163 | 162 | } else { |
| 164 | 163 | $res2 = []; |
| 165 | 164 | foreach ($v as $k => $p) { |
| 166 | 165 | if ( |
| 167 | 166 | isset($p->type) |
| 168 | - and function_exists($d = 'decompiler_' . $p->type) |
|
| 167 | + and function_exists($d = 'decompiler_'.$p->type) |
|
| 169 | 168 | ) { |
| 170 | 169 | $r = $d($p, $fmt, (0 - $prof)); |
| 171 | 170 | $res2[] = [$p->type, $r]; |
@@ -193,7 +192,7 @@ discard block |
||
| 193 | 192 | if (!isset($p->type)) { |
| 194 | 193 | continue; |
| 195 | 194 | } #?????? |
| 196 | - $d = 'decompiler_' . $p->type; |
|
| 195 | + $d = 'decompiler_'.$p->type; |
|
| 197 | 196 | $next = $liste[$k + 1] ?? false; |
| 198 | 197 | // Forcer le champ etendu si son source (pas les reecritures) |
| 199 | 198 | // contenait des args et s'il est suivi d'espaces, |
@@ -218,16 +217,16 @@ discard block |
||
| 218 | 217 | } |
| 219 | 218 | $contenu[] = [$d($p, $fmt, $prof2), $p->type]; |
| 220 | 219 | } |
| 221 | - $f = 'format_suite_' . $fmt; |
|
| 220 | + $f = 'format_suite_'.$fmt; |
|
| 222 | 221 | |
| 223 | 222 | return $f($contenu); |
| 224 | 223 | } |
| 225 | 224 | |
| 226 | 225 | function public_decompiler($liste, $fmt = '', $prof = 0, $quoi = '') { |
| 227 | - if (!include_spip('public/format_' . $fmt)) { |
|
| 226 | + if (!include_spip('public/format_'.$fmt)) { |
|
| 228 | 227 | return "'$fmt'?"; |
| 229 | 228 | } |
| 230 | - $f = 'decompiler_' . $quoi; |
|
| 229 | + $f = 'decompiler_'.$quoi; |
|
| 231 | 230 | |
| 232 | 231 | return $f($liste, $fmt, $prof); |
| 233 | 232 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Queue |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | define('_JQ_SCHEDULED', 1); |
@@ -50,103 +50,103 @@ discard block |
||
| 50 | 50 | * id of job |
| 51 | 51 | */ |
| 52 | 52 | function queue_add_job( |
| 53 | - $function, |
|
| 54 | - $description, |
|
| 55 | - $arguments = [], |
|
| 56 | - $file = '', |
|
| 57 | - $no_duplicate = false, |
|
| 58 | - $time = 0, |
|
| 59 | - $priority = 0 |
|
| 53 | + $function, |
|
| 54 | + $description, |
|
| 55 | + $arguments = [], |
|
| 56 | + $file = '', |
|
| 57 | + $no_duplicate = false, |
|
| 58 | + $time = 0, |
|
| 59 | + $priority = 0 |
|
| 60 | 60 | ) { |
| 61 | - include_spip('base/abstract_sql'); |
|
| 62 | - |
|
| 63 | - // cas pourri de ecrire/action/editer_site avec l'option reload=oui |
|
| 64 | - if (defined('_GENIE_SYNDIC_NOW')) { |
|
| 65 | - $arguments['id_syndic'] = _GENIE_SYNDIC_NOW; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - // serialiser les arguments |
|
| 69 | - $arguments = serialize($arguments); |
|
| 70 | - $md5args = md5($arguments); |
|
| 71 | - |
|
| 72 | - // si pas de date programee, des que possible |
|
| 73 | - $duplicate_where = 'status=' . intval(_JQ_SCHEDULED) . ' AND '; |
|
| 74 | - if (!$time) { |
|
| 75 | - $time = time(); |
|
| 76 | - $duplicate_where = ''; // ne pas dupliquer si deja le meme job en cours d'execution |
|
| 77 | - } |
|
| 78 | - $date = date('Y-m-d H:i:s', $time); |
|
| 79 | - |
|
| 80 | - $set_job = [ |
|
| 81 | - 'fonction' => $function, |
|
| 82 | - 'descriptif' => $description, |
|
| 83 | - 'args' => $arguments, |
|
| 84 | - 'md5args' => $md5args, |
|
| 85 | - 'inclure' => $file, |
|
| 86 | - 'priorite' => max(-10, min(10, intval($priority))), |
|
| 87 | - 'date' => $date, |
|
| 88 | - 'status' => _JQ_SCHEDULED, |
|
| 89 | - ]; |
|
| 90 | - // si option ne pas dupliquer, regarder si la fonction existe deja |
|
| 91 | - // avec les memes args et file |
|
| 92 | - if ( |
|
| 93 | - $no_duplicate |
|
| 94 | - and |
|
| 95 | - $id_job = sql_getfetsel( |
|
| 96 | - 'id_job', |
|
| 97 | - 'spip_jobs', |
|
| 98 | - $duplicate_where = |
|
| 99 | - $duplicate_where . 'fonction=' . sql_quote($function) |
|
| 100 | - . (($no_duplicate === 'function_only') ? '' : |
|
| 101 | - ' AND md5args=' . sql_quote($md5args) . ' AND inclure=' . sql_quote($file)) |
|
| 102 | - ) |
|
| 103 | - ) { |
|
| 104 | - return $id_job; |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - $id_job = sql_insertq('spip_jobs', $set_job); |
|
| 108 | - // en cas de concurrence, deux process peuvent arriver jusqu'ici en parallele |
|
| 109 | - // avec le meme job unique a inserer. Dans ce cas, celui qui a eu l'id le plus grand |
|
| 110 | - // doit s'effacer |
|
| 111 | - if ( |
|
| 112 | - $no_duplicate |
|
| 113 | - and |
|
| 114 | - $id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<' . intval($id_job) . " AND $duplicate_where") |
|
| 115 | - ) { |
|
| 116 | - sql_delete('spip_jobs', 'id_job=' . intval($id_job)); |
|
| 117 | - |
|
| 118 | - return $id_prev; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - // verifier la non duplication qui peut etre problematique en cas de concurence |
|
| 122 | - // il faut dans ce cas que seul le dernier ajoute se supprime ! |
|
| 123 | - |
|
| 124 | - // une option de debug pour verifier que les arguments en base sont bons |
|
| 125 | - // ie cas d'un char non acceptables sur certains type de champs |
|
| 126 | - // qui coupe la valeur |
|
| 127 | - if (defined('_JQ_INSERT_CHECK_ARGS') and $id_job) { |
|
| 128 | - $args = sql_getfetsel('args', 'spip_jobs', 'id_job=' . intval($id_job)); |
|
| 129 | - if ($args !== $arguments) { |
|
| 130 | - spip_log('arguments job errones / longueur ' . strlen($args) . ' vs ' . strlen($arguments) . ' / valeur : ' . var_export( |
|
| 131 | - $arguments, |
|
| 132 | - true |
|
| 133 | - ), 'queue'); |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - if ($id_job) { |
|
| 138 | - queue_update_next_job_time($time); |
|
| 139 | - } |
|
| 140 | - // si la mise en file d'attente du job echoue, |
|
| 141 | - // il ne faut pas perdre l'execution de la fonction |
|
| 142 | - // on la lance immediatement, c'est un fallback |
|
| 143 | - // sauf en cas d'upgrade necessaire (table spip_jobs inexistante) |
|
| 144 | - elseif ($GLOBALS['meta']['version_installee'] == $GLOBALS['spip_version_base']) { |
|
| 145 | - $set_job['id_job'] = 0; |
|
| 146 | - queue_start_job($set_job); |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - return $id_job; |
|
| 61 | + include_spip('base/abstract_sql'); |
|
| 62 | + |
|
| 63 | + // cas pourri de ecrire/action/editer_site avec l'option reload=oui |
|
| 64 | + if (defined('_GENIE_SYNDIC_NOW')) { |
|
| 65 | + $arguments['id_syndic'] = _GENIE_SYNDIC_NOW; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + // serialiser les arguments |
|
| 69 | + $arguments = serialize($arguments); |
|
| 70 | + $md5args = md5($arguments); |
|
| 71 | + |
|
| 72 | + // si pas de date programee, des que possible |
|
| 73 | + $duplicate_where = 'status=' . intval(_JQ_SCHEDULED) . ' AND '; |
|
| 74 | + if (!$time) { |
|
| 75 | + $time = time(); |
|
| 76 | + $duplicate_where = ''; // ne pas dupliquer si deja le meme job en cours d'execution |
|
| 77 | + } |
|
| 78 | + $date = date('Y-m-d H:i:s', $time); |
|
| 79 | + |
|
| 80 | + $set_job = [ |
|
| 81 | + 'fonction' => $function, |
|
| 82 | + 'descriptif' => $description, |
|
| 83 | + 'args' => $arguments, |
|
| 84 | + 'md5args' => $md5args, |
|
| 85 | + 'inclure' => $file, |
|
| 86 | + 'priorite' => max(-10, min(10, intval($priority))), |
|
| 87 | + 'date' => $date, |
|
| 88 | + 'status' => _JQ_SCHEDULED, |
|
| 89 | + ]; |
|
| 90 | + // si option ne pas dupliquer, regarder si la fonction existe deja |
|
| 91 | + // avec les memes args et file |
|
| 92 | + if ( |
|
| 93 | + $no_duplicate |
|
| 94 | + and |
|
| 95 | + $id_job = sql_getfetsel( |
|
| 96 | + 'id_job', |
|
| 97 | + 'spip_jobs', |
|
| 98 | + $duplicate_where = |
|
| 99 | + $duplicate_where . 'fonction=' . sql_quote($function) |
|
| 100 | + . (($no_duplicate === 'function_only') ? '' : |
|
| 101 | + ' AND md5args=' . sql_quote($md5args) . ' AND inclure=' . sql_quote($file)) |
|
| 102 | + ) |
|
| 103 | + ) { |
|
| 104 | + return $id_job; |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + $id_job = sql_insertq('spip_jobs', $set_job); |
|
| 108 | + // en cas de concurrence, deux process peuvent arriver jusqu'ici en parallele |
|
| 109 | + // avec le meme job unique a inserer. Dans ce cas, celui qui a eu l'id le plus grand |
|
| 110 | + // doit s'effacer |
|
| 111 | + if ( |
|
| 112 | + $no_duplicate |
|
| 113 | + and |
|
| 114 | + $id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<' . intval($id_job) . " AND $duplicate_where") |
|
| 115 | + ) { |
|
| 116 | + sql_delete('spip_jobs', 'id_job=' . intval($id_job)); |
|
| 117 | + |
|
| 118 | + return $id_prev; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + // verifier la non duplication qui peut etre problematique en cas de concurence |
|
| 122 | + // il faut dans ce cas que seul le dernier ajoute se supprime ! |
|
| 123 | + |
|
| 124 | + // une option de debug pour verifier que les arguments en base sont bons |
|
| 125 | + // ie cas d'un char non acceptables sur certains type de champs |
|
| 126 | + // qui coupe la valeur |
|
| 127 | + if (defined('_JQ_INSERT_CHECK_ARGS') and $id_job) { |
|
| 128 | + $args = sql_getfetsel('args', 'spip_jobs', 'id_job=' . intval($id_job)); |
|
| 129 | + if ($args !== $arguments) { |
|
| 130 | + spip_log('arguments job errones / longueur ' . strlen($args) . ' vs ' . strlen($arguments) . ' / valeur : ' . var_export( |
|
| 131 | + $arguments, |
|
| 132 | + true |
|
| 133 | + ), 'queue'); |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + if ($id_job) { |
|
| 138 | + queue_update_next_job_time($time); |
|
| 139 | + } |
|
| 140 | + // si la mise en file d'attente du job echoue, |
|
| 141 | + // il ne faut pas perdre l'execution de la fonction |
|
| 142 | + // on la lance immediatement, c'est un fallback |
|
| 143 | + // sauf en cas d'upgrade necessaire (table spip_jobs inexistante) |
|
| 144 | + elseif ($GLOBALS['meta']['version_installee'] == $GLOBALS['spip_version_base']) { |
|
| 145 | + $set_job['id_job'] = 0; |
|
| 146 | + queue_start_job($set_job); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + return $id_job; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | * @return void |
| 156 | 156 | */ |
| 157 | 157 | function queue_purger() { |
| 158 | - include_spip('base/abstract_sql'); |
|
| 159 | - sql_delete('spip_jobs'); |
|
| 160 | - sql_delete('spip_jobs_liens', 'id_job NOT IN (' . sql_get_select('id_job', 'spip_jobs') . ')'); |
|
| 161 | - include_spip('inc/genie'); |
|
| 162 | - genie_queue_watch_dist(); |
|
| 158 | + include_spip('base/abstract_sql'); |
|
| 159 | + sql_delete('spip_jobs'); |
|
| 160 | + sql_delete('spip_jobs_liens', 'id_job NOT IN (' . sql_get_select('id_job', 'spip_jobs') . ')'); |
|
| 161 | + include_spip('inc/genie'); |
|
| 162 | + genie_queue_watch_dist(); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -170,25 +170,25 @@ discard block |
||
| 170 | 170 | * @return int|bool |
| 171 | 171 | */ |
| 172 | 172 | function queue_remove_job($id_job) { |
| 173 | - include_spip('base/abstract_sql'); |
|
| 174 | - |
|
| 175 | - if ( |
|
| 176 | - $row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job=' . intval($id_job)) |
|
| 177 | - and $res = sql_delete('spip_jobs', 'id_job=' . intval($id_job)) |
|
| 178 | - ) { |
|
| 179 | - queue_unlink_job($id_job); |
|
| 180 | - // est-ce une tache cron qu'il faut relancer ? |
|
| 181 | - if ($periode = queue_is_cron_job($row['fonction'], $row['inclure'])) { |
|
| 182 | - // relancer avec les nouveaux arguments de temps |
|
| 183 | - include_spip('inc/genie'); |
|
| 184 | - // relancer avec la periode prevue |
|
| 185 | - queue_genie_replan_job($row['fonction'], $periode, strtotime($row['date'])); |
|
| 186 | - } |
|
| 187 | - queue_update_next_job_time(); |
|
| 188 | - return $res; |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - return false; |
|
| 173 | + include_spip('base/abstract_sql'); |
|
| 174 | + |
|
| 175 | + if ( |
|
| 176 | + $row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job=' . intval($id_job)) |
|
| 177 | + and $res = sql_delete('spip_jobs', 'id_job=' . intval($id_job)) |
|
| 178 | + ) { |
|
| 179 | + queue_unlink_job($id_job); |
|
| 180 | + // est-ce une tache cron qu'il faut relancer ? |
|
| 181 | + if ($periode = queue_is_cron_job($row['fonction'], $row['inclure'])) { |
|
| 182 | + // relancer avec les nouveaux arguments de temps |
|
| 183 | + include_spip('inc/genie'); |
|
| 184 | + // relancer avec la periode prevue |
|
| 185 | + queue_genie_replan_job($row['fonction'], $periode, strtotime($row['date'])); |
|
| 186 | + } |
|
| 187 | + queue_update_next_job_time(); |
|
| 188 | + return $res; |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + return false; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -201,18 +201,18 @@ discard block |
||
| 201 | 201 | * ou un tableau composé de tableaux simples pour lieur plusieurs objets en une fois |
| 202 | 202 | */ |
| 203 | 203 | function queue_link_job($id_job, $objets) { |
| 204 | - include_spip('base/abstract_sql'); |
|
| 205 | - |
|
| 206 | - if (is_array($objets) and count($objets)) { |
|
| 207 | - if (is_array(reset($objets))) { |
|
| 208 | - foreach ($objets as $k => $o) { |
|
| 209 | - $objets[$k]['id_job'] = $id_job; |
|
| 210 | - } |
|
| 211 | - sql_insertq_multi('spip_jobs_liens', $objets); |
|
| 212 | - } else { |
|
| 213 | - sql_insertq('spip_jobs_liens', array_merge(['id_job' => $id_job], $objets)); |
|
| 214 | - } |
|
| 215 | - } |
|
| 204 | + include_spip('base/abstract_sql'); |
|
| 205 | + |
|
| 206 | + if (is_array($objets) and count($objets)) { |
|
| 207 | + if (is_array(reset($objets))) { |
|
| 208 | + foreach ($objets as $k => $o) { |
|
| 209 | + $objets[$k]['id_job'] = $id_job; |
|
| 210 | + } |
|
| 211 | + sql_insertq_multi('spip_jobs_liens', $objets); |
|
| 212 | + } else { |
|
| 213 | + sql_insertq('spip_jobs_liens', array_merge(['id_job' => $id_job], $objets)); |
|
| 214 | + } |
|
| 215 | + } |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * resultat du sql_delete |
| 225 | 225 | */ |
| 226 | 226 | function queue_unlink_job($id_job) { |
| 227 | - return sql_delete('spip_jobs_liens', 'id_job=' . intval($id_job)); |
|
| 227 | + return sql_delete('spip_jobs_liens', 'id_job=' . intval($id_job)); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
@@ -237,36 +237,36 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | function queue_start_job($row) { |
| 239 | 239 | |
| 240 | - // deserialiser les arguments |
|
| 241 | - $args = unserialize($row['args']); |
|
| 242 | - if (!is_array($args)) { |
|
| 243 | - spip_log('arguments job errones ' . var_export($row, true), 'queue'); |
|
| 244 | - $args = []; |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - $fonction = $row['fonction']; |
|
| 248 | - if (strlen($inclure = trim($row['inclure']))) { |
|
| 249 | - if (substr($inclure, -1) == '/') { // c'est un chemin pour charger_fonction |
|
| 250 | - $f = charger_fonction($fonction, rtrim($inclure, '/'), false); |
|
| 251 | - if ($f) { |
|
| 252 | - $fonction = $f; |
|
| 253 | - } |
|
| 254 | - } else { |
|
| 255 | - include_spip($inclure); |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - |
|
| 259 | - if (!function_exists($fonction)) { |
|
| 260 | - spip_log("fonction $fonction ($inclure) inexistante " . var_export($row, true), 'queue'); |
|
| 261 | - |
|
| 262 | - return false; |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - spip_log('queue [' . $row['id_job'] . "]: $fonction() start", 'queue'); |
|
| 266 | - $res = $fonction(...$args); |
|
| 267 | - spip_log('queue [' . $row['id_job'] . "]: $fonction() end", 'queue'); |
|
| 268 | - |
|
| 269 | - return $res; |
|
| 240 | + // deserialiser les arguments |
|
| 241 | + $args = unserialize($row['args']); |
|
| 242 | + if (!is_array($args)) { |
|
| 243 | + spip_log('arguments job errones ' . var_export($row, true), 'queue'); |
|
| 244 | + $args = []; |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + $fonction = $row['fonction']; |
|
| 248 | + if (strlen($inclure = trim($row['inclure']))) { |
|
| 249 | + if (substr($inclure, -1) == '/') { // c'est un chemin pour charger_fonction |
|
| 250 | + $f = charger_fonction($fonction, rtrim($inclure, '/'), false); |
|
| 251 | + if ($f) { |
|
| 252 | + $fonction = $f; |
|
| 253 | + } |
|
| 254 | + } else { |
|
| 255 | + include_spip($inclure); |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + |
|
| 259 | + if (!function_exists($fonction)) { |
|
| 260 | + spip_log("fonction $fonction ($inclure) inexistante " . var_export($row, true), 'queue'); |
|
| 261 | + |
|
| 262 | + return false; |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + spip_log('queue [' . $row['id_job'] . "]: $fonction() start", 'queue'); |
|
| 266 | + $res = $fonction(...$args); |
|
| 267 | + spip_log('queue [' . $row['id_job'] . "]: $fonction() end", 'queue'); |
|
| 268 | + |
|
| 269 | + return $res; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -293,89 +293,89 @@ discard block |
||
| 293 | 293 | * - true : une planification a été faite. |
| 294 | 294 | */ |
| 295 | 295 | function queue_schedule($force_jobs = null) { |
| 296 | - $time = time(); |
|
| 297 | - if (defined('_DEBUG_BLOCK_QUEUE')) { |
|
| 298 | - spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq' . _LOG_DEBUG); |
|
| 299 | - |
|
| 300 | - return; |
|
| 301 | - } |
|
| 302 | - |
|
| 303 | - // rien a faire si le prochain job est encore dans le futur |
|
| 304 | - if (queue_sleep_time_to_next_job() > 0 and (!$force_jobs or !count($force_jobs))) { |
|
| 305 | - spip_log('queue_sleep_time_to_next_job', 'jq' . _LOG_DEBUG); |
|
| 306 | - |
|
| 307 | - return; |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - include_spip('base/abstract_sql'); |
|
| 311 | - // on ne peut rien faire si pas de connexion SQL |
|
| 312 | - if (!spip_connect()) { |
|
| 313 | - return false; |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - if (!defined('_JQ_MAX_JOBS_TIME_TO_EXECUTE')) { |
|
| 317 | - $max_time = ini_get('max_execution_time') / 2; |
|
| 318 | - // valeur conservatrice si on a pas reussi a lire le max_execution_time |
|
| 319 | - if (!$max_time) { |
|
| 320 | - $max_time = 5; |
|
| 321 | - } |
|
| 322 | - define('_JQ_MAX_JOBS_TIME_TO_EXECUTE', min($max_time, 15)); // une valeur maxi en temps. |
|
| 323 | - } |
|
| 324 | - $end_time = $time + _JQ_MAX_JOBS_TIME_TO_EXECUTE; |
|
| 325 | - |
|
| 326 | - spip_log("JQ schedule $time / $end_time", 'jq' . _LOG_DEBUG); |
|
| 327 | - |
|
| 328 | - if (!defined('_JQ_MAX_JOBS_EXECUTE')) { |
|
| 329 | - define('_JQ_MAX_JOBS_EXECUTE', 200); |
|
| 330 | - } |
|
| 331 | - $nbj = 0; |
|
| 332 | - // attraper les jobs |
|
| 333 | - // dont la date est passee (echus en attente), |
|
| 334 | - // par ordre : |
|
| 335 | - // - de priorite |
|
| 336 | - // - de date |
|
| 337 | - // lorsqu'un job cron n'a pas fini, sa priorite est descendue |
|
| 338 | - // pour qu'il ne bloque pas les autres jobs en attente |
|
| 339 | - if (is_array($force_jobs) and count($force_jobs)) { |
|
| 340 | - $cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND ' . sql_in('id_job', $force_jobs); |
|
| 341 | - } else { |
|
| 342 | - $now = date('Y-m-d H:i:s', $time); |
|
| 343 | - $cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND date<=' . sql_quote($now); |
|
| 344 | - } |
|
| 345 | - |
|
| 346 | - register_shutdown_function('queue_error_handler'); // recuperer les erreurs auant que possible |
|
| 347 | - $res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,' . (_JQ_MAX_JOBS_EXECUTE + 1)); |
|
| 348 | - do { |
|
| 349 | - if ($row = array_shift($res)) { |
|
| 350 | - $nbj++; |
|
| 351 | - // il faut un verrou, a base de sql_delete |
|
| 352 | - if (sql_delete('spip_jobs', 'id_job=' . intval($row['id_job']) . ' AND status=' . intval(_JQ_SCHEDULED))) { |
|
| 353 | - #spip_log("JQ schedule job ".$nbj." OK",'jq'); |
|
| 354 | - // on reinsert dans la base aussitot avec un status=_JQ_PENDING |
|
| 355 | - $row['status'] = _JQ_PENDING; |
|
| 356 | - $row['date'] = date('Y-m-d H:i:s', $time); |
|
| 357 | - sql_insertq('spip_jobs', $row); |
|
| 358 | - |
|
| 359 | - // on a la main sur le job : |
|
| 360 | - // l'executer |
|
| 361 | - $result = queue_start_job($row); |
|
| 362 | - |
|
| 363 | - $time = time(); |
|
| 364 | - queue_close_job($row, $time, $result); |
|
| 365 | - } |
|
| 366 | - } |
|
| 367 | - spip_log('JQ schedule job end time ' . $time, 'jq' . _LOG_DEBUG); |
|
| 368 | - } while ($nbj < _JQ_MAX_JOBS_EXECUTE and $row and $time < $end_time); |
|
| 369 | - spip_log('JQ schedule end time ' . time(), 'jq' . _LOG_DEBUG); |
|
| 370 | - |
|
| 371 | - if ($row = array_shift($res)) { |
|
| 372 | - queue_update_next_job_time(0); // on sait qu'il y a encore des jobs a lancer ASAP |
|
| 373 | - spip_log('JQ encore !', 'jq' . _LOG_DEBUG); |
|
| 374 | - } else { |
|
| 375 | - queue_update_next_job_time(); |
|
| 376 | - } |
|
| 377 | - |
|
| 378 | - return true; |
|
| 296 | + $time = time(); |
|
| 297 | + if (defined('_DEBUG_BLOCK_QUEUE')) { |
|
| 298 | + spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq' . _LOG_DEBUG); |
|
| 299 | + |
|
| 300 | + return; |
|
| 301 | + } |
|
| 302 | + |
|
| 303 | + // rien a faire si le prochain job est encore dans le futur |
|
| 304 | + if (queue_sleep_time_to_next_job() > 0 and (!$force_jobs or !count($force_jobs))) { |
|
| 305 | + spip_log('queue_sleep_time_to_next_job', 'jq' . _LOG_DEBUG); |
|
| 306 | + |
|
| 307 | + return; |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + include_spip('base/abstract_sql'); |
|
| 311 | + // on ne peut rien faire si pas de connexion SQL |
|
| 312 | + if (!spip_connect()) { |
|
| 313 | + return false; |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + if (!defined('_JQ_MAX_JOBS_TIME_TO_EXECUTE')) { |
|
| 317 | + $max_time = ini_get('max_execution_time') / 2; |
|
| 318 | + // valeur conservatrice si on a pas reussi a lire le max_execution_time |
|
| 319 | + if (!$max_time) { |
|
| 320 | + $max_time = 5; |
|
| 321 | + } |
|
| 322 | + define('_JQ_MAX_JOBS_TIME_TO_EXECUTE', min($max_time, 15)); // une valeur maxi en temps. |
|
| 323 | + } |
|
| 324 | + $end_time = $time + _JQ_MAX_JOBS_TIME_TO_EXECUTE; |
|
| 325 | + |
|
| 326 | + spip_log("JQ schedule $time / $end_time", 'jq' . _LOG_DEBUG); |
|
| 327 | + |
|
| 328 | + if (!defined('_JQ_MAX_JOBS_EXECUTE')) { |
|
| 329 | + define('_JQ_MAX_JOBS_EXECUTE', 200); |
|
| 330 | + } |
|
| 331 | + $nbj = 0; |
|
| 332 | + // attraper les jobs |
|
| 333 | + // dont la date est passee (echus en attente), |
|
| 334 | + // par ordre : |
|
| 335 | + // - de priorite |
|
| 336 | + // - de date |
|
| 337 | + // lorsqu'un job cron n'a pas fini, sa priorite est descendue |
|
| 338 | + // pour qu'il ne bloque pas les autres jobs en attente |
|
| 339 | + if (is_array($force_jobs) and count($force_jobs)) { |
|
| 340 | + $cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND ' . sql_in('id_job', $force_jobs); |
|
| 341 | + } else { |
|
| 342 | + $now = date('Y-m-d H:i:s', $time); |
|
| 343 | + $cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND date<=' . sql_quote($now); |
|
| 344 | + } |
|
| 345 | + |
|
| 346 | + register_shutdown_function('queue_error_handler'); // recuperer les erreurs auant que possible |
|
| 347 | + $res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,' . (_JQ_MAX_JOBS_EXECUTE + 1)); |
|
| 348 | + do { |
|
| 349 | + if ($row = array_shift($res)) { |
|
| 350 | + $nbj++; |
|
| 351 | + // il faut un verrou, a base de sql_delete |
|
| 352 | + if (sql_delete('spip_jobs', 'id_job=' . intval($row['id_job']) . ' AND status=' . intval(_JQ_SCHEDULED))) { |
|
| 353 | + #spip_log("JQ schedule job ".$nbj." OK",'jq'); |
|
| 354 | + // on reinsert dans la base aussitot avec un status=_JQ_PENDING |
|
| 355 | + $row['status'] = _JQ_PENDING; |
|
| 356 | + $row['date'] = date('Y-m-d H:i:s', $time); |
|
| 357 | + sql_insertq('spip_jobs', $row); |
|
| 358 | + |
|
| 359 | + // on a la main sur le job : |
|
| 360 | + // l'executer |
|
| 361 | + $result = queue_start_job($row); |
|
| 362 | + |
|
| 363 | + $time = time(); |
|
| 364 | + queue_close_job($row, $time, $result); |
|
| 365 | + } |
|
| 366 | + } |
|
| 367 | + spip_log('JQ schedule job end time ' . $time, 'jq' . _LOG_DEBUG); |
|
| 368 | + } while ($nbj < _JQ_MAX_JOBS_EXECUTE and $row and $time < $end_time); |
|
| 369 | + spip_log('JQ schedule end time ' . time(), 'jq' . _LOG_DEBUG); |
|
| 370 | + |
|
| 371 | + if ($row = array_shift($res)) { |
|
| 372 | + queue_update_next_job_time(0); // on sait qu'il y a encore des jobs a lancer ASAP |
|
| 373 | + spip_log('JQ encore !', 'jq' . _LOG_DEBUG); |
|
| 374 | + } else { |
|
| 375 | + queue_update_next_job_time(); |
|
| 376 | + } |
|
| 377 | + |
|
| 378 | + return true; |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** |
@@ -393,21 +393,21 @@ discard block |
||
| 393 | 393 | * @param int $result |
| 394 | 394 | */ |
| 395 | 395 | function queue_close_job(&$row, $time, $result = 0) { |
| 396 | - // est-ce une tache cron qu'il faut relancer ? |
|
| 397 | - if ($periode = queue_is_cron_job($row['fonction'], $row['inclure'])) { |
|
| 398 | - // relancer avec les nouveaux arguments de temps |
|
| 399 | - include_spip('inc/genie'); |
|
| 400 | - if ($result < 0) { // relancer tout de suite, mais en baissant la priorite |
|
| 401 | - queue_genie_replan_job($row['fonction'], $periode, 0 - $result, null, $row['priorite'] - 1); |
|
| 402 | - } else // relancer avec la periode prevue |
|
| 403 | - { |
|
| 404 | - queue_genie_replan_job($row['fonction'], $periode, $time); |
|
| 405 | - } |
|
| 406 | - } |
|
| 407 | - // purger ses liens eventuels avec des objets |
|
| 408 | - sql_delete('spip_jobs_liens', 'id_job=' . intval($row['id_job'])); |
|
| 409 | - // supprimer le job fini |
|
| 410 | - sql_delete('spip_jobs', 'id_job=' . intval($row['id_job'])); |
|
| 396 | + // est-ce une tache cron qu'il faut relancer ? |
|
| 397 | + if ($periode = queue_is_cron_job($row['fonction'], $row['inclure'])) { |
|
| 398 | + // relancer avec les nouveaux arguments de temps |
|
| 399 | + include_spip('inc/genie'); |
|
| 400 | + if ($result < 0) { // relancer tout de suite, mais en baissant la priorite |
|
| 401 | + queue_genie_replan_job($row['fonction'], $periode, 0 - $result, null, $row['priorite'] - 1); |
|
| 402 | + } else // relancer avec la periode prevue |
|
| 403 | + { |
|
| 404 | + queue_genie_replan_job($row['fonction'], $periode, $time); |
|
| 405 | + } |
|
| 406 | + } |
|
| 407 | + // purger ses liens eventuels avec des objets |
|
| 408 | + sql_delete('spip_jobs_liens', 'id_job=' . intval($row['id_job'])); |
|
| 409 | + // supprimer le job fini |
|
| 410 | + sql_delete('spip_jobs', 'id_job=' . intval($row['id_job'])); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
@@ -417,10 +417,10 @@ discard block |
||
| 417 | 417 | * @uses queue_update_next_job_time() |
| 418 | 418 | */ |
| 419 | 419 | function queue_error_handler() { |
| 420 | - // se remettre dans le bon dossier, car Apache le change parfois (toujours?) |
|
| 421 | - chdir(_ROOT_CWD); |
|
| 420 | + // se remettre dans le bon dossier, car Apache le change parfois (toujours?) |
|
| 421 | + chdir(_ROOT_CWD); |
|
| 422 | 422 | |
| 423 | - queue_update_next_job_time(); |
|
| 423 | + queue_update_next_job_time(); |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | |
@@ -437,18 +437,18 @@ discard block |
||
| 437 | 437 | * Périodicité de la tâche en secondes, si tâche périodique, sinon false. |
| 438 | 438 | */ |
| 439 | 439 | function queue_is_cron_job($function, $inclure) { |
| 440 | - static $taches = null; |
|
| 441 | - if (strncmp($inclure, 'genie/', 6) == 0) { |
|
| 442 | - if (is_null($taches)) { |
|
| 443 | - include_spip('inc/genie'); |
|
| 444 | - $taches = taches_generales(); |
|
| 445 | - } |
|
| 446 | - if (isset($taches[$function])) { |
|
| 447 | - return $taches[$function]; |
|
| 448 | - } |
|
| 449 | - } |
|
| 450 | - |
|
| 451 | - return false; |
|
| 440 | + static $taches = null; |
|
| 441 | + if (strncmp($inclure, 'genie/', 6) == 0) { |
|
| 442 | + if (is_null($taches)) { |
|
| 443 | + include_spip('inc/genie'); |
|
| 444 | + $taches = taches_generales(); |
|
| 445 | + } |
|
| 446 | + if (isset($taches[$function])) { |
|
| 447 | + return $taches[$function]; |
|
| 448 | + } |
|
| 449 | + } |
|
| 450 | + |
|
| 451 | + return false; |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | /** |
@@ -462,62 +462,62 @@ discard block |
||
| 462 | 462 | * temps de la tache ajoutee ou 0 pour ASAP |
| 463 | 463 | */ |
| 464 | 464 | function queue_update_next_job_time($next_time = null) { |
| 465 | - static $nb_jobs_scheduled = null; |
|
| 466 | - static $deja_la = false; |
|
| 467 | - // prendre le min des $next_time que l'on voit passer ici, en cas de reentrance |
|
| 468 | - static $next = null; |
|
| 469 | - // queue_close_job peut etre reentrant ici |
|
| 470 | - if ($deja_la) { |
|
| 471 | - return; |
|
| 472 | - } |
|
| 473 | - $deja_la = true; |
|
| 474 | - |
|
| 475 | - include_spip('base/abstract_sql'); |
|
| 476 | - $time = time(); |
|
| 477 | - |
|
| 478 | - // traiter les jobs morts au combat (_JQ_PENDING depuis plus de 180s) |
|
| 479 | - // pour cause de timeout ou autre erreur fatale |
|
| 480 | - $res = sql_allfetsel( |
|
| 481 | - '*', |
|
| 482 | - 'spip_jobs', |
|
| 483 | - 'status=' . intval(_JQ_PENDING) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time - 180)) |
|
| 484 | - ); |
|
| 485 | - if (is_array($res)) { |
|
| 486 | - foreach ($res as $row) { |
|
| 487 | - queue_close_job($row, $time); |
|
| 488 | - spip_log('queue_close_job car _JQ_PENDING depuis +180s : ' . print_r($row, 1), 'job_mort' . _LOG_ERREUR); |
|
| 489 | - } |
|
| 490 | - } |
|
| 491 | - |
|
| 492 | - // chercher la date du prochain job si pas connu |
|
| 493 | - if (is_null($next) or is_null(queue_sleep_time_to_next_job())) { |
|
| 494 | - $date = sql_getfetsel('date', 'spip_jobs', 'status=' . intval(_JQ_SCHEDULED), '', 'date', '0,1'); |
|
| 495 | - $next = strtotime($date); |
|
| 496 | - } |
|
| 497 | - if (!is_null($next_time)) { |
|
| 498 | - if (is_null($next) or $next > $next_time) { |
|
| 499 | - $next = $next_time; |
|
| 500 | - } |
|
| 501 | - } |
|
| 502 | - |
|
| 503 | - if ($next) { |
|
| 504 | - if (is_null($nb_jobs_scheduled)) { |
|
| 505 | - $nb_jobs_scheduled = sql_countsel( |
|
| 506 | - 'spip_jobs', |
|
| 507 | - 'status=' . intval(_JQ_SCHEDULED) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time)) |
|
| 508 | - ); |
|
| 509 | - } elseif ($next <= $time) { |
|
| 510 | - $nb_jobs_scheduled++; |
|
| 511 | - } |
|
| 512 | - // si trop de jobs en attente, on force la purge en fin de hit |
|
| 513 | - // pour assurer le coup |
|
| 514 | - if ($nb_jobs_scheduled > (defined('_JQ_NB_JOBS_OVERFLOW') ? _JQ_NB_JOBS_OVERFLOW : 10000)) { |
|
| 515 | - define('_DIRECT_CRON_FORCE', true); |
|
| 516 | - } |
|
| 517 | - } |
|
| 518 | - |
|
| 519 | - queue_set_next_job_time($next); |
|
| 520 | - $deja_la = false; |
|
| 465 | + static $nb_jobs_scheduled = null; |
|
| 466 | + static $deja_la = false; |
|
| 467 | + // prendre le min des $next_time que l'on voit passer ici, en cas de reentrance |
|
| 468 | + static $next = null; |
|
| 469 | + // queue_close_job peut etre reentrant ici |
|
| 470 | + if ($deja_la) { |
|
| 471 | + return; |
|
| 472 | + } |
|
| 473 | + $deja_la = true; |
|
| 474 | + |
|
| 475 | + include_spip('base/abstract_sql'); |
|
| 476 | + $time = time(); |
|
| 477 | + |
|
| 478 | + // traiter les jobs morts au combat (_JQ_PENDING depuis plus de 180s) |
|
| 479 | + // pour cause de timeout ou autre erreur fatale |
|
| 480 | + $res = sql_allfetsel( |
|
| 481 | + '*', |
|
| 482 | + 'spip_jobs', |
|
| 483 | + 'status=' . intval(_JQ_PENDING) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time - 180)) |
|
| 484 | + ); |
|
| 485 | + if (is_array($res)) { |
|
| 486 | + foreach ($res as $row) { |
|
| 487 | + queue_close_job($row, $time); |
|
| 488 | + spip_log('queue_close_job car _JQ_PENDING depuis +180s : ' . print_r($row, 1), 'job_mort' . _LOG_ERREUR); |
|
| 489 | + } |
|
| 490 | + } |
|
| 491 | + |
|
| 492 | + // chercher la date du prochain job si pas connu |
|
| 493 | + if (is_null($next) or is_null(queue_sleep_time_to_next_job())) { |
|
| 494 | + $date = sql_getfetsel('date', 'spip_jobs', 'status=' . intval(_JQ_SCHEDULED), '', 'date', '0,1'); |
|
| 495 | + $next = strtotime($date); |
|
| 496 | + } |
|
| 497 | + if (!is_null($next_time)) { |
|
| 498 | + if (is_null($next) or $next > $next_time) { |
|
| 499 | + $next = $next_time; |
|
| 500 | + } |
|
| 501 | + } |
|
| 502 | + |
|
| 503 | + if ($next) { |
|
| 504 | + if (is_null($nb_jobs_scheduled)) { |
|
| 505 | + $nb_jobs_scheduled = sql_countsel( |
|
| 506 | + 'spip_jobs', |
|
| 507 | + 'status=' . intval(_JQ_SCHEDULED) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time)) |
|
| 508 | + ); |
|
| 509 | + } elseif ($next <= $time) { |
|
| 510 | + $nb_jobs_scheduled++; |
|
| 511 | + } |
|
| 512 | + // si trop de jobs en attente, on force la purge en fin de hit |
|
| 513 | + // pour assurer le coup |
|
| 514 | + if ($nb_jobs_scheduled > (defined('_JQ_NB_JOBS_OVERFLOW') ? _JQ_NB_JOBS_OVERFLOW : 10000)) { |
|
| 515 | + define('_DIRECT_CRON_FORCE', true); |
|
| 516 | + } |
|
| 517 | + } |
|
| 518 | + |
|
| 519 | + queue_set_next_job_time($next); |
|
| 520 | + $deja_la = false; |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | |
@@ -528,26 +528,26 @@ discard block |
||
| 528 | 528 | */ |
| 529 | 529 | function queue_set_next_job_time($next) { |
| 530 | 530 | |
| 531 | - // utiliser le temps courant reel plutot que temps de la requete ici |
|
| 532 | - $time = time(); |
|
| 533 | - |
|
| 534 | - // toujours relire la valeur pour comparer, pour tenir compte des maj concourrantes |
|
| 535 | - // et ne mettre a jour que si il y a un interet a le faire |
|
| 536 | - // permet ausis d'initialiser le nom de fichier a coup sur |
|
| 537 | - $curr_next = $_SERVER['REQUEST_TIME'] + max(0, queue_sleep_time_to_next_job(true)); |
|
| 538 | - if ( |
|
| 539 | - ($curr_next <= $time and $next > $time) // le prochain job est dans le futur mais pas la date planifiee actuelle |
|
| 540 | - or $curr_next > $next // le prochain job est plus tot que la date planifiee actuelle |
|
| 541 | - ) { |
|
| 542 | - if (function_exists('cache_set') and defined('_MEMOIZE_MEMORY') and _MEMOIZE_MEMORY) { |
|
| 543 | - cache_set(_JQ_NEXT_JOB_TIME_FILENAME, intval($next)); |
|
| 544 | - } else { |
|
| 545 | - ecrire_fichier(_JQ_NEXT_JOB_TIME_FILENAME, intval($next)); |
|
| 546 | - } |
|
| 547 | - queue_sleep_time_to_next_job($next); |
|
| 548 | - } |
|
| 549 | - |
|
| 550 | - return queue_sleep_time_to_next_job(); |
|
| 531 | + // utiliser le temps courant reel plutot que temps de la requete ici |
|
| 532 | + $time = time(); |
|
| 533 | + |
|
| 534 | + // toujours relire la valeur pour comparer, pour tenir compte des maj concourrantes |
|
| 535 | + // et ne mettre a jour que si il y a un interet a le faire |
|
| 536 | + // permet ausis d'initialiser le nom de fichier a coup sur |
|
| 537 | + $curr_next = $_SERVER['REQUEST_TIME'] + max(0, queue_sleep_time_to_next_job(true)); |
|
| 538 | + if ( |
|
| 539 | + ($curr_next <= $time and $next > $time) // le prochain job est dans le futur mais pas la date planifiee actuelle |
|
| 540 | + or $curr_next > $next // le prochain job est plus tot que la date planifiee actuelle |
|
| 541 | + ) { |
|
| 542 | + if (function_exists('cache_set') and defined('_MEMOIZE_MEMORY') and _MEMOIZE_MEMORY) { |
|
| 543 | + cache_set(_JQ_NEXT_JOB_TIME_FILENAME, intval($next)); |
|
| 544 | + } else { |
|
| 545 | + ecrire_fichier(_JQ_NEXT_JOB_TIME_FILENAME, intval($next)); |
|
| 546 | + } |
|
| 547 | + queue_sleep_time_to_next_job($next); |
|
| 548 | + } |
|
| 549 | + |
|
| 550 | + return queue_sleep_time_to_next_job(); |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | /** |
@@ -564,60 +564,60 @@ discard block |
||
| 564 | 564 | * @return string |
| 565 | 565 | */ |
| 566 | 566 | function queue_affichage_cron() { |
| 567 | - $texte = ''; |
|
| 568 | - |
|
| 569 | - $time_to_next = queue_sleep_time_to_next_job(); |
|
| 570 | - // rien a faire si le prochain job est encore dans le futur |
|
| 571 | - if ($time_to_next > 0 or defined('_DEBUG_BLOCK_QUEUE')) { |
|
| 572 | - return $texte; |
|
| 573 | - } |
|
| 574 | - |
|
| 575 | - // ne pas relancer si on vient de lancer dans la meme seconde par un hit concurent |
|
| 576 | - if (file_exists($lock = _DIR_TMP . 'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) { |
|
| 577 | - return $texte; |
|
| 578 | - } |
|
| 579 | - |
|
| 580 | - @touch($lock); |
|
| 581 | - |
|
| 582 | - // il y a des taches en attentes |
|
| 583 | - // si depuis plus de 5min, on essaye de lancer le cron par tous les moyens pour rattraper le coup |
|
| 584 | - // on est sans doute sur un site qui n'autorise pas http sortant ou avec peu de trafic |
|
| 585 | - $urgent = false; |
|
| 586 | - if ($time_to_next < -300) { |
|
| 587 | - $urgent = true; |
|
| 588 | - } |
|
| 589 | - |
|
| 590 | - $url_cron = generer_url_action('cron', '', false, true); |
|
| 591 | - |
|
| 592 | - if (!defined('_HTML_BG_CRON_FORCE') or !_HTML_BG_CRON_FORCE) { |
|
| 593 | - if (queue_lancer_url_http_async($url_cron) and !$urgent) { |
|
| 594 | - return $texte; |
|
| 595 | - } |
|
| 596 | - } |
|
| 597 | - |
|
| 598 | - // si deja force, on retourne sans rien |
|
| 599 | - if (defined('_DIRECT_CRON_FORCE')) { |
|
| 600 | - return $texte; |
|
| 601 | - } |
|
| 602 | - |
|
| 603 | - // si c'est un bot |
|
| 604 | - // inutile de faire un appel par image background, |
|
| 605 | - // on force un appel direct en fin de hit |
|
| 606 | - if ((defined('_IS_BOT') and _IS_BOT)) { |
|
| 607 | - define('_DIRECT_CRON_FORCE', true); |
|
| 608 | - |
|
| 609 | - return $texte; |
|
| 610 | - } |
|
| 611 | - |
|
| 612 | - if (!defined('_HTML_BG_CRON_INHIB') or !_HTML_BG_CRON_INHIB) { |
|
| 613 | - // en derniere solution, on insere un appel xhr non bloquant ou une image background dans la page si pas de JS |
|
| 614 | - $url_cron = generer_url_action('cron'); |
|
| 615 | - $texte = '<!-- SPIP-CRON -->' |
|
| 616 | - . "<script>setTimeout(function(){var xo = new XMLHttpRequest();xo.open('GET', '$url_cron', true);xo.send('');},100);</script>" |
|
| 617 | - . "<noscript><div style=\"background-image: url('$url_cron');\"></div></noscript>"; |
|
| 618 | - } |
|
| 619 | - |
|
| 620 | - return $texte; |
|
| 567 | + $texte = ''; |
|
| 568 | + |
|
| 569 | + $time_to_next = queue_sleep_time_to_next_job(); |
|
| 570 | + // rien a faire si le prochain job est encore dans le futur |
|
| 571 | + if ($time_to_next > 0 or defined('_DEBUG_BLOCK_QUEUE')) { |
|
| 572 | + return $texte; |
|
| 573 | + } |
|
| 574 | + |
|
| 575 | + // ne pas relancer si on vient de lancer dans la meme seconde par un hit concurent |
|
| 576 | + if (file_exists($lock = _DIR_TMP . 'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) { |
|
| 577 | + return $texte; |
|
| 578 | + } |
|
| 579 | + |
|
| 580 | + @touch($lock); |
|
| 581 | + |
|
| 582 | + // il y a des taches en attentes |
|
| 583 | + // si depuis plus de 5min, on essaye de lancer le cron par tous les moyens pour rattraper le coup |
|
| 584 | + // on est sans doute sur un site qui n'autorise pas http sortant ou avec peu de trafic |
|
| 585 | + $urgent = false; |
|
| 586 | + if ($time_to_next < -300) { |
|
| 587 | + $urgent = true; |
|
| 588 | + } |
|
| 589 | + |
|
| 590 | + $url_cron = generer_url_action('cron', '', false, true); |
|
| 591 | + |
|
| 592 | + if (!defined('_HTML_BG_CRON_FORCE') or !_HTML_BG_CRON_FORCE) { |
|
| 593 | + if (queue_lancer_url_http_async($url_cron) and !$urgent) { |
|
| 594 | + return $texte; |
|
| 595 | + } |
|
| 596 | + } |
|
| 597 | + |
|
| 598 | + // si deja force, on retourne sans rien |
|
| 599 | + if (defined('_DIRECT_CRON_FORCE')) { |
|
| 600 | + return $texte; |
|
| 601 | + } |
|
| 602 | + |
|
| 603 | + // si c'est un bot |
|
| 604 | + // inutile de faire un appel par image background, |
|
| 605 | + // on force un appel direct en fin de hit |
|
| 606 | + if ((defined('_IS_BOT') and _IS_BOT)) { |
|
| 607 | + define('_DIRECT_CRON_FORCE', true); |
|
| 608 | + |
|
| 609 | + return $texte; |
|
| 610 | + } |
|
| 611 | + |
|
| 612 | + if (!defined('_HTML_BG_CRON_INHIB') or !_HTML_BG_CRON_INHIB) { |
|
| 613 | + // en derniere solution, on insere un appel xhr non bloquant ou une image background dans la page si pas de JS |
|
| 614 | + $url_cron = generer_url_action('cron'); |
|
| 615 | + $texte = '<!-- SPIP-CRON -->' |
|
| 616 | + . "<script>setTimeout(function(){var xo = new XMLHttpRequest();xo.open('GET', '$url_cron', true);xo.send('');},100);</script>" |
|
| 617 | + . "<noscript><div style=\"background-image: url('$url_cron');\"></div></noscript>"; |
|
| 618 | + } |
|
| 619 | + |
|
| 620 | + return $texte; |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /** |
@@ -626,73 +626,73 @@ discard block |
||
| 626 | 626 | * @return bool : true si l'url a pu être appelée en asynchrone, false sinon |
| 627 | 627 | */ |
| 628 | 628 | function queue_lancer_url_http_async($url_cron) { |
| 629 | - // methode la plus rapide : |
|
| 630 | - // Si fsockopen est possible, on lance le cron via un socket en asynchrone |
|
| 631 | - // si fsockopen echoue (disponibilite serveur, firewall) on essaye pas cURL |
|
| 632 | - // car on a toutes les chances d'echouer pareil mais sans moyen de le savoir |
|
| 633 | - // mais on renvoie false direct |
|
| 634 | - if (function_exists('fsockopen')) { |
|
| 635 | - $parts = parse_url($url_cron); |
|
| 636 | - |
|
| 637 | - switch ($parts['scheme']) { |
|
| 638 | - case 'https': |
|
| 639 | - $scheme = 'ssl://'; |
|
| 640 | - $port = 443; |
|
| 641 | - break; |
|
| 642 | - case 'http': |
|
| 643 | - default: |
|
| 644 | - $scheme = ''; |
|
| 645 | - $port = 80; |
|
| 646 | - } |
|
| 647 | - $fp = @fsockopen( |
|
| 648 | - $scheme . $parts['host'], |
|
| 649 | - $parts['port'] ?? $port, |
|
| 650 | - $errno, |
|
| 651 | - $errstr, |
|
| 652 | - 1 |
|
| 653 | - ); |
|
| 654 | - |
|
| 655 | - if ($fp) { |
|
| 656 | - $host_sent = $parts['host']; |
|
| 657 | - if (isset($parts['port']) and $parts['port'] !== $port) { |
|
| 658 | - $host_sent .= ':' . $parts['port']; |
|
| 659 | - } |
|
| 660 | - $timeout = 200; // ms |
|
| 661 | - stream_set_timeout($fp, 0, $timeout * 1000); |
|
| 662 | - $query = $parts['path'] . ($parts['query'] ? '?' . $parts['query'] : ''); |
|
| 663 | - $out = 'GET ' . $query . " HTTP/1.1\r\n"; |
|
| 664 | - $out .= 'Host: ' . $host_sent . "\r\n"; |
|
| 665 | - $out .= "Connection: Close\r\n\r\n"; |
|
| 666 | - fwrite($fp, $out); |
|
| 667 | - spip_timer('read'); |
|
| 668 | - $t = 0; |
|
| 669 | - // on lit la reponse si possible pour fermer proprement la connexion |
|
| 670 | - // avec un timeout total de 200ms pour ne pas se bloquer |
|
| 671 | - while (!feof($fp) and $t < $timeout) { |
|
| 672 | - @fgets($fp, 1024); |
|
| 673 | - $t += spip_timer('read', true); |
|
| 674 | - spip_timer('read'); |
|
| 675 | - } |
|
| 676 | - fclose($fp); |
|
| 677 | - return true; |
|
| 678 | - } |
|
| 679 | - } |
|
| 680 | - // si fsockopen n'est pas dispo on essaye cURL : |
|
| 681 | - // lancer le cron par un cURL asynchrone si cURL est present |
|
| 682 | - elseif (function_exists('curl_init')) { |
|
| 683 | - //setting the curl parameters. |
|
| 684 | - $ch = curl_init($url_cron); |
|
| 685 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
| 686 | - // cf bug : http://www.php.net/manual/en/function.curl-setopt.php#104597 |
|
| 687 | - curl_setopt($ch, CURLOPT_NOSIGNAL, 1); |
|
| 688 | - // valeur mini pour que la requete soit lancee |
|
| 689 | - curl_setopt($ch, CURLOPT_TIMEOUT_MS, 200); |
|
| 690 | - // lancer |
|
| 691 | - curl_exec($ch); |
|
| 692 | - // fermer |
|
| 693 | - curl_close($ch); |
|
| 694 | - return true; |
|
| 695 | - } |
|
| 696 | - |
|
| 697 | - return false; |
|
| 629 | + // methode la plus rapide : |
|
| 630 | + // Si fsockopen est possible, on lance le cron via un socket en asynchrone |
|
| 631 | + // si fsockopen echoue (disponibilite serveur, firewall) on essaye pas cURL |
|
| 632 | + // car on a toutes les chances d'echouer pareil mais sans moyen de le savoir |
|
| 633 | + // mais on renvoie false direct |
|
| 634 | + if (function_exists('fsockopen')) { |
|
| 635 | + $parts = parse_url($url_cron); |
|
| 636 | + |
|
| 637 | + switch ($parts['scheme']) { |
|
| 638 | + case 'https': |
|
| 639 | + $scheme = 'ssl://'; |
|
| 640 | + $port = 443; |
|
| 641 | + break; |
|
| 642 | + case 'http': |
|
| 643 | + default: |
|
| 644 | + $scheme = ''; |
|
| 645 | + $port = 80; |
|
| 646 | + } |
|
| 647 | + $fp = @fsockopen( |
|
| 648 | + $scheme . $parts['host'], |
|
| 649 | + $parts['port'] ?? $port, |
|
| 650 | + $errno, |
|
| 651 | + $errstr, |
|
| 652 | + 1 |
|
| 653 | + ); |
|
| 654 | + |
|
| 655 | + if ($fp) { |
|
| 656 | + $host_sent = $parts['host']; |
|
| 657 | + if (isset($parts['port']) and $parts['port'] !== $port) { |
|
| 658 | + $host_sent .= ':' . $parts['port']; |
|
| 659 | + } |
|
| 660 | + $timeout = 200; // ms |
|
| 661 | + stream_set_timeout($fp, 0, $timeout * 1000); |
|
| 662 | + $query = $parts['path'] . ($parts['query'] ? '?' . $parts['query'] : ''); |
|
| 663 | + $out = 'GET ' . $query . " HTTP/1.1\r\n"; |
|
| 664 | + $out .= 'Host: ' . $host_sent . "\r\n"; |
|
| 665 | + $out .= "Connection: Close\r\n\r\n"; |
|
| 666 | + fwrite($fp, $out); |
|
| 667 | + spip_timer('read'); |
|
| 668 | + $t = 0; |
|
| 669 | + // on lit la reponse si possible pour fermer proprement la connexion |
|
| 670 | + // avec un timeout total de 200ms pour ne pas se bloquer |
|
| 671 | + while (!feof($fp) and $t < $timeout) { |
|
| 672 | + @fgets($fp, 1024); |
|
| 673 | + $t += spip_timer('read', true); |
|
| 674 | + spip_timer('read'); |
|
| 675 | + } |
|
| 676 | + fclose($fp); |
|
| 677 | + return true; |
|
| 678 | + } |
|
| 679 | + } |
|
| 680 | + // si fsockopen n'est pas dispo on essaye cURL : |
|
| 681 | + // lancer le cron par un cURL asynchrone si cURL est present |
|
| 682 | + elseif (function_exists('curl_init')) { |
|
| 683 | + //setting the curl parameters. |
|
| 684 | + $ch = curl_init($url_cron); |
|
| 685 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
| 686 | + // cf bug : http://www.php.net/manual/en/function.curl-setopt.php#104597 |
|
| 687 | + curl_setopt($ch, CURLOPT_NOSIGNAL, 1); |
|
| 688 | + // valeur mini pour que la requete soit lancee |
|
| 689 | + curl_setopt($ch, CURLOPT_TIMEOUT_MS, 200); |
|
| 690 | + // lancer |
|
| 691 | + curl_exec($ch); |
|
| 692 | + // fermer |
|
| 693 | + curl_close($ch); |
|
| 694 | + return true; |
|
| 695 | + } |
|
| 696 | + |
|
| 697 | + return false; |
|
| 698 | 698 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $md5args = md5($arguments); |
| 71 | 71 | |
| 72 | 72 | // si pas de date programee, des que possible |
| 73 | - $duplicate_where = 'status=' . intval(_JQ_SCHEDULED) . ' AND '; |
|
| 73 | + $duplicate_where = 'status='.intval(_JQ_SCHEDULED).' AND '; |
|
| 74 | 74 | if (!$time) { |
| 75 | 75 | $time = time(); |
| 76 | 76 | $duplicate_where = ''; // ne pas dupliquer si deja le meme job en cours d'execution |
@@ -96,9 +96,8 @@ discard block |
||
| 96 | 96 | 'id_job', |
| 97 | 97 | 'spip_jobs', |
| 98 | 98 | $duplicate_where = |
| 99 | - $duplicate_where . 'fonction=' . sql_quote($function) |
|
| 100 | - . (($no_duplicate === 'function_only') ? '' : |
|
| 101 | - ' AND md5args=' . sql_quote($md5args) . ' AND inclure=' . sql_quote($file)) |
|
| 99 | + $duplicate_where.'fonction='.sql_quote($function) |
|
| 100 | + . (($no_duplicate === 'function_only') ? '' : ' AND md5args='.sql_quote($md5args).' AND inclure='.sql_quote($file)) |
|
| 102 | 101 | ) |
| 103 | 102 | ) { |
| 104 | 103 | return $id_job; |
@@ -111,9 +110,9 @@ discard block |
||
| 111 | 110 | if ( |
| 112 | 111 | $no_duplicate |
| 113 | 112 | and |
| 114 | - $id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<' . intval($id_job) . " AND $duplicate_where") |
|
| 113 | + $id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<'.intval($id_job)." AND $duplicate_where") |
|
| 115 | 114 | ) { |
| 116 | - sql_delete('spip_jobs', 'id_job=' . intval($id_job)); |
|
| 115 | + sql_delete('spip_jobs', 'id_job='.intval($id_job)); |
|
| 117 | 116 | |
| 118 | 117 | return $id_prev; |
| 119 | 118 | } |
@@ -125,9 +124,9 @@ discard block |
||
| 125 | 124 | // ie cas d'un char non acceptables sur certains type de champs |
| 126 | 125 | // qui coupe la valeur |
| 127 | 126 | if (defined('_JQ_INSERT_CHECK_ARGS') and $id_job) { |
| 128 | - $args = sql_getfetsel('args', 'spip_jobs', 'id_job=' . intval($id_job)); |
|
| 127 | + $args = sql_getfetsel('args', 'spip_jobs', 'id_job='.intval($id_job)); |
|
| 129 | 128 | if ($args !== $arguments) { |
| 130 | - spip_log('arguments job errones / longueur ' . strlen($args) . ' vs ' . strlen($arguments) . ' / valeur : ' . var_export( |
|
| 129 | + spip_log('arguments job errones / longueur '.strlen($args).' vs '.strlen($arguments).' / valeur : '.var_export( |
|
| 131 | 130 | $arguments, |
| 132 | 131 | true |
| 133 | 132 | ), 'queue'); |
@@ -157,7 +156,7 @@ discard block |
||
| 157 | 156 | function queue_purger() { |
| 158 | 157 | include_spip('base/abstract_sql'); |
| 159 | 158 | sql_delete('spip_jobs'); |
| 160 | - sql_delete('spip_jobs_liens', 'id_job NOT IN (' . sql_get_select('id_job', 'spip_jobs') . ')'); |
|
| 159 | + sql_delete('spip_jobs_liens', 'id_job NOT IN ('.sql_get_select('id_job', 'spip_jobs').')'); |
|
| 161 | 160 | include_spip('inc/genie'); |
| 162 | 161 | genie_queue_watch_dist(); |
| 163 | 162 | } |
@@ -173,8 +172,8 @@ discard block |
||
| 173 | 172 | include_spip('base/abstract_sql'); |
| 174 | 173 | |
| 175 | 174 | if ( |
| 176 | - $row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job=' . intval($id_job)) |
|
| 177 | - and $res = sql_delete('spip_jobs', 'id_job=' . intval($id_job)) |
|
| 175 | + $row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job='.intval($id_job)) |
|
| 176 | + and $res = sql_delete('spip_jobs', 'id_job='.intval($id_job)) |
|
| 178 | 177 | ) { |
| 179 | 178 | queue_unlink_job($id_job); |
| 180 | 179 | // est-ce une tache cron qu'il faut relancer ? |
@@ -224,7 +223,7 @@ discard block |
||
| 224 | 223 | * resultat du sql_delete |
| 225 | 224 | */ |
| 226 | 225 | function queue_unlink_job($id_job) { |
| 227 | - return sql_delete('spip_jobs_liens', 'id_job=' . intval($id_job)); |
|
| 226 | + return sql_delete('spip_jobs_liens', 'id_job='.intval($id_job)); |
|
| 228 | 227 | } |
| 229 | 228 | |
| 230 | 229 | /** |
@@ -240,7 +239,7 @@ discard block |
||
| 240 | 239 | // deserialiser les arguments |
| 241 | 240 | $args = unserialize($row['args']); |
| 242 | 241 | if (!is_array($args)) { |
| 243 | - spip_log('arguments job errones ' . var_export($row, true), 'queue'); |
|
| 242 | + spip_log('arguments job errones '.var_export($row, true), 'queue'); |
|
| 244 | 243 | $args = []; |
| 245 | 244 | } |
| 246 | 245 | |
@@ -257,14 +256,14 @@ discard block |
||
| 257 | 256 | } |
| 258 | 257 | |
| 259 | 258 | if (!function_exists($fonction)) { |
| 260 | - spip_log("fonction $fonction ($inclure) inexistante " . var_export($row, true), 'queue'); |
|
| 259 | + spip_log("fonction $fonction ($inclure) inexistante ".var_export($row, true), 'queue'); |
|
| 261 | 260 | |
| 262 | 261 | return false; |
| 263 | 262 | } |
| 264 | 263 | |
| 265 | - spip_log('queue [' . $row['id_job'] . "]: $fonction() start", 'queue'); |
|
| 264 | + spip_log('queue ['.$row['id_job']."]: $fonction() start", 'queue'); |
|
| 266 | 265 | $res = $fonction(...$args); |
| 267 | - spip_log('queue [' . $row['id_job'] . "]: $fonction() end", 'queue'); |
|
| 266 | + spip_log('queue ['.$row['id_job']."]: $fonction() end", 'queue'); |
|
| 268 | 267 | |
| 269 | 268 | return $res; |
| 270 | 269 | } |
@@ -295,14 +294,14 @@ discard block |
||
| 295 | 294 | function queue_schedule($force_jobs = null) { |
| 296 | 295 | $time = time(); |
| 297 | 296 | if (defined('_DEBUG_BLOCK_QUEUE')) { |
| 298 | - spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq' . _LOG_DEBUG); |
|
| 297 | + spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq'._LOG_DEBUG); |
|
| 299 | 298 | |
| 300 | 299 | return; |
| 301 | 300 | } |
| 302 | 301 | |
| 303 | 302 | // rien a faire si le prochain job est encore dans le futur |
| 304 | 303 | if (queue_sleep_time_to_next_job() > 0 and (!$force_jobs or !count($force_jobs))) { |
| 305 | - spip_log('queue_sleep_time_to_next_job', 'jq' . _LOG_DEBUG); |
|
| 304 | + spip_log('queue_sleep_time_to_next_job', 'jq'._LOG_DEBUG); |
|
| 306 | 305 | |
| 307 | 306 | return; |
| 308 | 307 | } |
@@ -323,7 +322,7 @@ discard block |
||
| 323 | 322 | } |
| 324 | 323 | $end_time = $time + _JQ_MAX_JOBS_TIME_TO_EXECUTE; |
| 325 | 324 | |
| 326 | - spip_log("JQ schedule $time / $end_time", 'jq' . _LOG_DEBUG); |
|
| 325 | + spip_log("JQ schedule $time / $end_time", 'jq'._LOG_DEBUG); |
|
| 327 | 326 | |
| 328 | 327 | if (!defined('_JQ_MAX_JOBS_EXECUTE')) { |
| 329 | 328 | define('_JQ_MAX_JOBS_EXECUTE', 200); |
@@ -337,19 +336,19 @@ discard block |
||
| 337 | 336 | // lorsqu'un job cron n'a pas fini, sa priorite est descendue |
| 338 | 337 | // pour qu'il ne bloque pas les autres jobs en attente |
| 339 | 338 | if (is_array($force_jobs) and count($force_jobs)) { |
| 340 | - $cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND ' . sql_in('id_job', $force_jobs); |
|
| 339 | + $cond = 'status='.intval(_JQ_SCHEDULED).' AND '.sql_in('id_job', $force_jobs); |
|
| 341 | 340 | } else { |
| 342 | 341 | $now = date('Y-m-d H:i:s', $time); |
| 343 | - $cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND date<=' . sql_quote($now); |
|
| 342 | + $cond = 'status='.intval(_JQ_SCHEDULED).' AND date<='.sql_quote($now); |
|
| 344 | 343 | } |
| 345 | 344 | |
| 346 | 345 | register_shutdown_function('queue_error_handler'); // recuperer les erreurs auant que possible |
| 347 | - $res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,' . (_JQ_MAX_JOBS_EXECUTE + 1)); |
|
| 346 | + $res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,'.(_JQ_MAX_JOBS_EXECUTE + 1)); |
|
| 348 | 347 | do { |
| 349 | 348 | if ($row = array_shift($res)) { |
| 350 | 349 | $nbj++; |
| 351 | 350 | // il faut un verrou, a base de sql_delete |
| 352 | - if (sql_delete('spip_jobs', 'id_job=' . intval($row['id_job']) . ' AND status=' . intval(_JQ_SCHEDULED))) { |
|
| 351 | + if (sql_delete('spip_jobs', 'id_job='.intval($row['id_job']).' AND status='.intval(_JQ_SCHEDULED))) { |
|
| 353 | 352 | #spip_log("JQ schedule job ".$nbj." OK",'jq'); |
| 354 | 353 | // on reinsert dans la base aussitot avec un status=_JQ_PENDING |
| 355 | 354 | $row['status'] = _JQ_PENDING; |
@@ -364,13 +363,13 @@ discard block |
||
| 364 | 363 | queue_close_job($row, $time, $result); |
| 365 | 364 | } |
| 366 | 365 | } |
| 367 | - spip_log('JQ schedule job end time ' . $time, 'jq' . _LOG_DEBUG); |
|
| 366 | + spip_log('JQ schedule job end time '.$time, 'jq'._LOG_DEBUG); |
|
| 368 | 367 | } while ($nbj < _JQ_MAX_JOBS_EXECUTE and $row and $time < $end_time); |
| 369 | - spip_log('JQ schedule end time ' . time(), 'jq' . _LOG_DEBUG); |
|
| 368 | + spip_log('JQ schedule end time '.time(), 'jq'._LOG_DEBUG); |
|
| 370 | 369 | |
| 371 | 370 | if ($row = array_shift($res)) { |
| 372 | 371 | queue_update_next_job_time(0); // on sait qu'il y a encore des jobs a lancer ASAP |
| 373 | - spip_log('JQ encore !', 'jq' . _LOG_DEBUG); |
|
| 372 | + spip_log('JQ encore !', 'jq'._LOG_DEBUG); |
|
| 374 | 373 | } else { |
| 375 | 374 | queue_update_next_job_time(); |
| 376 | 375 | } |
@@ -405,9 +404,9 @@ discard block |
||
| 405 | 404 | } |
| 406 | 405 | } |
| 407 | 406 | // purger ses liens eventuels avec des objets |
| 408 | - sql_delete('spip_jobs_liens', 'id_job=' . intval($row['id_job'])); |
|
| 407 | + sql_delete('spip_jobs_liens', 'id_job='.intval($row['id_job'])); |
|
| 409 | 408 | // supprimer le job fini |
| 410 | - sql_delete('spip_jobs', 'id_job=' . intval($row['id_job'])); |
|
| 409 | + sql_delete('spip_jobs', 'id_job='.intval($row['id_job'])); |
|
| 411 | 410 | } |
| 412 | 411 | |
| 413 | 412 | /** |
@@ -480,18 +479,18 @@ discard block |
||
| 480 | 479 | $res = sql_allfetsel( |
| 481 | 480 | '*', |
| 482 | 481 | 'spip_jobs', |
| 483 | - 'status=' . intval(_JQ_PENDING) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time - 180)) |
|
| 482 | + 'status='.intval(_JQ_PENDING).' AND date<'.sql_quote(date('Y-m-d H:i:s', $time - 180)) |
|
| 484 | 483 | ); |
| 485 | 484 | if (is_array($res)) { |
| 486 | 485 | foreach ($res as $row) { |
| 487 | 486 | queue_close_job($row, $time); |
| 488 | - spip_log('queue_close_job car _JQ_PENDING depuis +180s : ' . print_r($row, 1), 'job_mort' . _LOG_ERREUR); |
|
| 487 | + spip_log('queue_close_job car _JQ_PENDING depuis +180s : '.print_r($row, 1), 'job_mort'._LOG_ERREUR); |
|
| 489 | 488 | } |
| 490 | 489 | } |
| 491 | 490 | |
| 492 | 491 | // chercher la date du prochain job si pas connu |
| 493 | 492 | if (is_null($next) or is_null(queue_sleep_time_to_next_job())) { |
| 494 | - $date = sql_getfetsel('date', 'spip_jobs', 'status=' . intval(_JQ_SCHEDULED), '', 'date', '0,1'); |
|
| 493 | + $date = sql_getfetsel('date', 'spip_jobs', 'status='.intval(_JQ_SCHEDULED), '', 'date', '0,1'); |
|
| 495 | 494 | $next = strtotime($date); |
| 496 | 495 | } |
| 497 | 496 | if (!is_null($next_time)) { |
@@ -504,7 +503,7 @@ discard block |
||
| 504 | 503 | if (is_null($nb_jobs_scheduled)) { |
| 505 | 504 | $nb_jobs_scheduled = sql_countsel( |
| 506 | 505 | 'spip_jobs', |
| 507 | - 'status=' . intval(_JQ_SCHEDULED) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time)) |
|
| 506 | + 'status='.intval(_JQ_SCHEDULED).' AND date<'.sql_quote(date('Y-m-d H:i:s', $time)) |
|
| 508 | 507 | ); |
| 509 | 508 | } elseif ($next <= $time) { |
| 510 | 509 | $nb_jobs_scheduled++; |
@@ -573,7 +572,7 @@ discard block |
||
| 573 | 572 | } |
| 574 | 573 | |
| 575 | 574 | // ne pas relancer si on vient de lancer dans la meme seconde par un hit concurent |
| 576 | - if (file_exists($lock = _DIR_TMP . 'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) { |
|
| 575 | + if (file_exists($lock = _DIR_TMP.'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) { |
|
| 577 | 576 | return $texte; |
| 578 | 577 | } |
| 579 | 578 | |
@@ -645,7 +644,7 @@ discard block |
||
| 645 | 644 | $port = 80; |
| 646 | 645 | } |
| 647 | 646 | $fp = @fsockopen( |
| 648 | - $scheme . $parts['host'], |
|
| 647 | + $scheme.$parts['host'], |
|
| 649 | 648 | $parts['port'] ?? $port, |
| 650 | 649 | $errno, |
| 651 | 650 | $errstr, |
@@ -655,13 +654,13 @@ discard block |
||
| 655 | 654 | if ($fp) { |
| 656 | 655 | $host_sent = $parts['host']; |
| 657 | 656 | if (isset($parts['port']) and $parts['port'] !== $port) { |
| 658 | - $host_sent .= ':' . $parts['port']; |
|
| 657 | + $host_sent .= ':'.$parts['port']; |
|
| 659 | 658 | } |
| 660 | 659 | $timeout = 200; // ms |
| 661 | 660 | stream_set_timeout($fp, 0, $timeout * 1000); |
| 662 | - $query = $parts['path'] . ($parts['query'] ? '?' . $parts['query'] : ''); |
|
| 663 | - $out = 'GET ' . $query . " HTTP/1.1\r\n"; |
|
| 664 | - $out .= 'Host: ' . $host_sent . "\r\n"; |
|
| 661 | + $query = $parts['path'].($parts['query'] ? '?'.$parts['query'] : ''); |
|
| 662 | + $out = 'GET '.$query." HTTP/1.1\r\n"; |
|
| 663 | + $out .= 'Host: '.$host_sent."\r\n"; |
|
| 665 | 664 | $out .= "Connection: Close\r\n\r\n"; |
| 666 | 665 | fwrite($fp, $out); |
| 667 | 666 | spip_timer('read'); |