@@ -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 | ]; |
@@ -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 | |
@@ -13,49 +13,49 @@ |
||
| 13 | 13 | |
| 14 | 14 | /** Vérification et hachage de mot de passe */ |
| 15 | 15 | class Password { |
| 16 | - /** |
|
| 17 | - * verifier qu'un mot de passe en clair est correct a l'aide de son hash |
|
| 18 | - * |
|
| 19 | - * Le mot de passe est poivre via la cle secret_des_auth |
|
| 20 | - */ |
|
| 21 | - public static function verifier( |
|
| 22 | - #[\SensitiveParameter] |
|
| 23 | - string $password_clair, |
|
| 24 | - #[\SensitiveParameter] |
|
| 25 | - string $password_hash, |
|
| 26 | - #[\SensitiveParameter] |
|
| 27 | - ?string $key = null |
|
| 28 | - ): bool { |
|
| 29 | - $key ??= self::getDefaultKey(); |
|
| 30 | - if ($key) { |
|
| 31 | - $pass_poivre = hash_hmac('sha256', $password_clair, $key); |
|
| 32 | - return password_verify($pass_poivre, $password_hash); |
|
| 33 | - } |
|
| 34 | - spip_log('Aucune clé pour vérifier le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 35 | - return false; |
|
| 36 | - } |
|
| 16 | + /** |
|
| 17 | + * verifier qu'un mot de passe en clair est correct a l'aide de son hash |
|
| 18 | + * |
|
| 19 | + * Le mot de passe est poivre via la cle secret_des_auth |
|
| 20 | + */ |
|
| 21 | + public static function verifier( |
|
| 22 | + #[\SensitiveParameter] |
|
| 23 | + string $password_clair, |
|
| 24 | + #[\SensitiveParameter] |
|
| 25 | + string $password_hash, |
|
| 26 | + #[\SensitiveParameter] |
|
| 27 | + ?string $key = null |
|
| 28 | + ): bool { |
|
| 29 | + $key ??= self::getDefaultKey(); |
|
| 30 | + if ($key) { |
|
| 31 | + $pass_poivre = hash_hmac('sha256', $password_clair, $key); |
|
| 32 | + return password_verify($pass_poivre, $password_hash); |
|
| 33 | + } |
|
| 34 | + spip_log('Aucune clé pour vérifier le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 35 | + return false; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Calculer un hash salé du mot de passe |
|
| 40 | - */ |
|
| 41 | - public static function hacher( |
|
| 42 | - #[\SensitiveParameter] |
|
| 43 | - string $password_clair, |
|
| 44 | - #[\SensitiveParameter] |
|
| 45 | - ?string $key = null |
|
| 46 | - ): ?string { |
|
| 47 | - $key ??= self::getDefaultKey(); |
|
| 48 | - // ne pas fournir un hash errone si la cle nous manque |
|
| 49 | - if ($key) { |
|
| 50 | - $pass_poivre = hash_hmac('sha256', $password_clair, $key); |
|
| 51 | - return password_hash($pass_poivre, PASSWORD_DEFAULT); |
|
| 52 | - } |
|
| 53 | - spip_log('Aucune clé pour chiffrer le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 54 | - return null; |
|
| 55 | - } |
|
| 38 | + /** |
|
| 39 | + * Calculer un hash salé du mot de passe |
|
| 40 | + */ |
|
| 41 | + public static function hacher( |
|
| 42 | + #[\SensitiveParameter] |
|
| 43 | + string $password_clair, |
|
| 44 | + #[\SensitiveParameter] |
|
| 45 | + ?string $key = null |
|
| 46 | + ): ?string { |
|
| 47 | + $key ??= self::getDefaultKey(); |
|
| 48 | + // ne pas fournir un hash errone si la cle nous manque |
|
| 49 | + if ($key) { |
|
| 50 | + $pass_poivre = hash_hmac('sha256', $password_clair, $key); |
|
| 51 | + return password_hash($pass_poivre, PASSWORD_DEFAULT); |
|
| 52 | + } |
|
| 53 | + spip_log('Aucune clé pour chiffrer le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 54 | + return null; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - private static function getDefaultKey(): ?string { |
|
| 58 | - $keys = SpipCles::instance(); |
|
| 59 | - return $keys->getSecretAuth(); |
|
| 60 | - } |
|
| 57 | + private static function getDefaultKey(): ?string { |
|
| 58 | + $keys = SpipCles::instance(); |
|
| 59 | + return $keys->getSecretAuth(); |
|
| 60 | + } |
|
| 61 | 61 | } |
@@ -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 | |
@@ -13,46 +13,46 @@ |
||
| 13 | 13 | |
| 14 | 14 | /** Conteneur de clés (chiffrement, authentification) */ |
| 15 | 15 | class Cles implements \Countable /* , ContainerInterface */ { |
| 16 | - public function __construct(private array $keys) { |
|
| 17 | - } |
|
| 18 | - |
|
| 19 | - public function has(string $name): bool { |
|
| 20 | - return array_key_exists($name, $this->keys); |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - public function get(string $name): ?string { |
|
| 24 | - return $this->keys[$name] ?? null; |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - public function generate(string $name): string { |
|
| 28 | - $key = Chiffrement::keygen(); |
|
| 29 | - $this->keys[$name] = $key; |
|
| 30 | - spip_log("Création de la cle $name", 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 31 | - return $key; |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - public function set( |
|
| 35 | - string $name, |
|
| 36 | - #[\SensitiveParameter] |
|
| 37 | - string $key |
|
| 38 | - ): void { |
|
| 39 | - $this->keys[$name] = $key; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - public function delete(string $name): bool { |
|
| 43 | - if (isset($this->keys[$name])) { |
|
| 44 | - unset($this->keys[$name]); |
|
| 45 | - return true; |
|
| 46 | - }; |
|
| 47 | - return false; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - public function count(): int { |
|
| 51 | - return count($this->keys); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - public function toJson(): string { |
|
| 55 | - $json = array_map('base64_encode', $this->keys); |
|
| 56 | - return \json_encode($json, JSON_THROW_ON_ERROR); |
|
| 57 | - } |
|
| 16 | + public function __construct(private array $keys) { |
|
| 17 | + } |
|
| 18 | + |
|
| 19 | + public function has(string $name): bool { |
|
| 20 | + return array_key_exists($name, $this->keys); |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + public function get(string $name): ?string { |
|
| 24 | + return $this->keys[$name] ?? null; |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + public function generate(string $name): string { |
|
| 28 | + $key = Chiffrement::keygen(); |
|
| 29 | + $this->keys[$name] = $key; |
|
| 30 | + spip_log("Création de la cle $name", 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 31 | + return $key; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + public function set( |
|
| 35 | + string $name, |
|
| 36 | + #[\SensitiveParameter] |
|
| 37 | + string $key |
|
| 38 | + ): void { |
|
| 39 | + $this->keys[$name] = $key; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + public function delete(string $name): bool { |
|
| 43 | + if (isset($this->keys[$name])) { |
|
| 44 | + unset($this->keys[$name]); |
|
| 45 | + return true; |
|
| 46 | + }; |
|
| 47 | + return false; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + public function count(): int { |
|
| 51 | + return count($this->keys); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + public function toJson(): string { |
|
| 55 | + $json = array_map('base64_encode', $this->keys); |
|
| 56 | + return \json_encode($json, JSON_THROW_ON_ERROR); |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | } else { |
| 40 | 40 | $tls = true; |
| 41 | 41 | } |
| 42 | - } |
|
| 43 | - else { |
|
| 42 | + } else { |
|
| 44 | 43 | $tls_ldap == 'non'; |
| 45 | 44 | } |
| 46 | 45 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $adresse_ldap = filter_var($adresse_ldap, FILTER_SANITIZE_URL) ?: ''; |
| 49 | 49 | |
| 50 | 50 | $ldap_link = ldap_connect($adresse_ldap, $port_ldap); |
| 51 | - $erreur = 'ldap_connect(' . spip_htmlspecialchars($adresse_ldap) . ', ' . spip_htmlspecialchars($port_ldap) . ')'; |
|
| 51 | + $erreur = 'ldap_connect('.spip_htmlspecialchars($adresse_ldap).', '.spip_htmlspecialchars($port_ldap).')'; |
|
| 52 | 52 | |
| 53 | 53 | if ($ldap_link) { |
| 54 | 54 | if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) { |
@@ -56,18 +56,18 @@ discard block |
||
| 56 | 56 | ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap); |
| 57 | 57 | } |
| 58 | 58 | if ($tls && !ldap_start_tls($ldap_link)) { |
| 59 | - $erreur = 'ldap_start_tls(' . spip_htmlspecialchars($ldap_link) |
|
| 60 | - . ' ' . spip_htmlspecialchars($adresse_ldap) |
|
| 61 | - . ', ' . spip_htmlspecialchars($port_ldap) . ')'; |
|
| 59 | + $erreur = 'ldap_start_tls('.spip_htmlspecialchars($ldap_link) |
|
| 60 | + . ' '.spip_htmlspecialchars($adresse_ldap) |
|
| 61 | + . ', '.spip_htmlspecialchars($port_ldap).')'; |
|
| 62 | 62 | $ldap_link = false; |
| 63 | 63 | } |
| 64 | 64 | if ($ldap_link) { |
| 65 | 65 | $ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap); |
| 66 | - $erreur = "ldap_bind('" . spip_htmlspecialchars($ldap_link) |
|
| 67 | - . "', '" . spip_htmlspecialchars($login_ldap) |
|
| 68 | - . "', '" . spip_htmlspecialchars($pass_ldap) |
|
| 69 | - . "'): " . spip_htmlspecialchars($adresse_ldap) |
|
| 70 | - . ', ' . spip_htmlspecialchars($port_ldap); |
|
| 66 | + $erreur = "ldap_bind('".spip_htmlspecialchars($ldap_link) |
|
| 67 | + . "', '".spip_htmlspecialchars($login_ldap) |
|
| 68 | + . "', '".spip_htmlspecialchars($pass_ldap) |
|
| 69 | + . "'): ".spip_htmlspecialchars($adresse_ldap) |
|
| 70 | + . ', '.spip_htmlspecialchars($port_ldap); |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -75,22 +75,22 @@ discard block |
||
| 75 | 75 | echo info_etape( |
| 76 | 76 | _T('titre_connexion_ldap'), |
| 77 | 77 | info_progression_etape(2, 'etape_ldap', 'install/') |
| 78 | - ), _T('info_connexion_ldap_ok'); |
|
| 78 | + ), _T('info_connexion_ldap_ok'); |
|
| 79 | 79 | echo generer_form_ecrire('install', ( |
| 80 | 80 | "\n<input type='hidden' name='etape' value='ldap3' />" |
| 81 | - . "\n<input type='hidden' name='adresse_ldap' value=\"" . spip_htmlspecialchars($adresse_ldap) . '" />' |
|
| 82 | - . "\n<input type='hidden' name='port_ldap' value=\"" . spip_htmlspecialchars($port_ldap) . '" />' |
|
| 83 | - . "\n<input type='hidden' name='login_ldap' value=\"" . spip_htmlspecialchars($login_ldap) . '" />' |
|
| 84 | - . "\n<input type='hidden' name='pass_ldap' value=\"" . spip_htmlspecialchars($pass_ldap) . '" />' |
|
| 85 | - . "\n<input type='hidden' name='protocole_ldap' value=\"" . spip_htmlspecialchars($protocole_ldap) . '" />' |
|
| 86 | - . "\n<input type='hidden' name='tls_ldap' value=\"" . spip_htmlspecialchars($tls_ldap) . '" />' |
|
| 81 | + . "\n<input type='hidden' name='adresse_ldap' value=\"".spip_htmlspecialchars($adresse_ldap).'" />' |
|
| 82 | + . "\n<input type='hidden' name='port_ldap' value=\"".spip_htmlspecialchars($port_ldap).'" />' |
|
| 83 | + . "\n<input type='hidden' name='login_ldap' value=\"".spip_htmlspecialchars($login_ldap).'" />' |
|
| 84 | + . "\n<input type='hidden' name='pass_ldap' value=\"".spip_htmlspecialchars($pass_ldap).'" />' |
|
| 85 | + . "\n<input type='hidden' name='protocole_ldap' value=\"".spip_htmlspecialchars($protocole_ldap).'" />' |
|
| 86 | + . "\n<input type='hidden' name='tls_ldap' value=\"".spip_htmlspecialchars($tls_ldap).'" />' |
|
| 87 | 87 | . bouton_suivant())); |
| 88 | 88 | } else { |
| 89 | 89 | echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true), |
| 90 | - "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>', |
|
| 91 | - '<p>' . _T('avis_connexion_ldap_echec_2') . |
|
| 92 | - "<br />\n" . _T('avis_connexion_ldap_echec_3') . |
|
| 93 | - '<br /><br />' . $erreur . '<b> ?</b></p></div>'; |
|
| 90 | + "<div class='error'><p>"._T('avis_connexion_ldap_echec_1').'</p>', |
|
| 91 | + '<p>'._T('avis_connexion_ldap_echec_2'). |
|
| 92 | + "<br />\n"._T('avis_connexion_ldap_echec_3'). |
|
| 93 | + '<br /><br />'.$erreur.'<b> ?</b></p></div>'; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | echo $minipage->installFinPage(); |
@@ -12,88 +12,88 @@ |
||
| 12 | 12 | \***************************************************************************/ |
| 13 | 13 | |
| 14 | 14 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | function install_etape_ldap2_dist() { |
| 19 | - $minipage = new Installation(); |
|
| 20 | - echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 21 | - |
|
| 22 | - $adresse_ldap = _request('adresse_ldap'); |
|
| 23 | - |
|
| 24 | - $port_ldap = _request('port_ldap'); |
|
| 25 | - |
|
| 26 | - $tls_ldap = _request('tls_ldap'); |
|
| 27 | - |
|
| 28 | - $protocole_ldap = _request('protocole_ldap'); |
|
| 29 | - |
|
| 30 | - $login_ldap = _request('login_ldap'); |
|
| 31 | - |
|
| 32 | - $pass_ldap = _request('pass_ldap'); |
|
| 33 | - |
|
| 34 | - $port_ldap = (int) $port_ldap; |
|
| 35 | - |
|
| 36 | - $tls = false; |
|
| 37 | - |
|
| 38 | - if ($tls_ldap == 'oui') { |
|
| 39 | - if ($port_ldap == 636) { |
|
| 40 | - $adresse_ldap = "ldaps://$adresse_ldap"; |
|
| 41 | - } else { |
|
| 42 | - $tls = true; |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - else { |
|
| 46 | - $tls_ldap == 'non'; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - // Verifions que l'adresse demandee est valide |
|
| 50 | - $adresse_ldap = filter_var($adresse_ldap, FILTER_SANITIZE_URL) ?: ''; |
|
| 51 | - |
|
| 52 | - $ldap_link = ldap_connect($adresse_ldap, $port_ldap); |
|
| 53 | - $erreur = 'ldap_connect(' . spip_htmlspecialchars($adresse_ldap) . ', ' . spip_htmlspecialchars($port_ldap) . ')'; |
|
| 54 | - |
|
| 55 | - if ($ldap_link) { |
|
| 56 | - if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) { |
|
| 57 | - $protocole_ldap = 2; |
|
| 58 | - ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap); |
|
| 59 | - } |
|
| 60 | - if ($tls && !ldap_start_tls($ldap_link)) { |
|
| 61 | - $erreur = 'ldap_start_tls(' . spip_htmlspecialchars($ldap_link) |
|
| 62 | - . ' ' . spip_htmlspecialchars($adresse_ldap) |
|
| 63 | - . ', ' . spip_htmlspecialchars($port_ldap) . ')'; |
|
| 64 | - $ldap_link = false; |
|
| 65 | - } |
|
| 66 | - if ($ldap_link) { |
|
| 67 | - $ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap); |
|
| 68 | - $erreur = "ldap_bind('" . spip_htmlspecialchars($ldap_link) |
|
| 69 | - . "', '" . spip_htmlspecialchars($login_ldap) |
|
| 70 | - . "', '" . spip_htmlspecialchars($pass_ldap) |
|
| 71 | - . "'): " . spip_htmlspecialchars($adresse_ldap) |
|
| 72 | - . ', ' . spip_htmlspecialchars($port_ldap); |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - if ($ldap_link) { |
|
| 77 | - echo info_etape( |
|
| 78 | - _T('titre_connexion_ldap'), |
|
| 79 | - info_progression_etape(2, 'etape_ldap', 'install/') |
|
| 80 | - ), _T('info_connexion_ldap_ok'); |
|
| 81 | - echo generer_form_ecrire('install', ( |
|
| 82 | - "\n<input type='hidden' name='etape' value='ldap3' />" |
|
| 83 | - . "\n<input type='hidden' name='adresse_ldap' value=\"" . spip_htmlspecialchars($adresse_ldap) . '" />' |
|
| 84 | - . "\n<input type='hidden' name='port_ldap' value=\"" . spip_htmlspecialchars($port_ldap) . '" />' |
|
| 85 | - . "\n<input type='hidden' name='login_ldap' value=\"" . spip_htmlspecialchars($login_ldap) . '" />' |
|
| 86 | - . "\n<input type='hidden' name='pass_ldap' value=\"" . spip_htmlspecialchars($pass_ldap) . '" />' |
|
| 87 | - . "\n<input type='hidden' name='protocole_ldap' value=\"" . spip_htmlspecialchars($protocole_ldap) . '" />' |
|
| 88 | - . "\n<input type='hidden' name='tls_ldap' value=\"" . spip_htmlspecialchars($tls_ldap) . '" />' |
|
| 89 | - . bouton_suivant())); |
|
| 90 | - } else { |
|
| 91 | - echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true), |
|
| 92 | - "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>', |
|
| 93 | - '<p>' . _T('avis_connexion_ldap_echec_2') . |
|
| 94 | - "<br />\n" . _T('avis_connexion_ldap_echec_3') . |
|
| 95 | - '<br /><br />' . $erreur . '<b> ?</b></p></div>'; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - echo $minipage->installFinPage(); |
|
| 19 | + $minipage = new Installation(); |
|
| 20 | + echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 21 | + |
|
| 22 | + $adresse_ldap = _request('adresse_ldap'); |
|
| 23 | + |
|
| 24 | + $port_ldap = _request('port_ldap'); |
|
| 25 | + |
|
| 26 | + $tls_ldap = _request('tls_ldap'); |
|
| 27 | + |
|
| 28 | + $protocole_ldap = _request('protocole_ldap'); |
|
| 29 | + |
|
| 30 | + $login_ldap = _request('login_ldap'); |
|
| 31 | + |
|
| 32 | + $pass_ldap = _request('pass_ldap'); |
|
| 33 | + |
|
| 34 | + $port_ldap = (int) $port_ldap; |
|
| 35 | + |
|
| 36 | + $tls = false; |
|
| 37 | + |
|
| 38 | + if ($tls_ldap == 'oui') { |
|
| 39 | + if ($port_ldap == 636) { |
|
| 40 | + $adresse_ldap = "ldaps://$adresse_ldap"; |
|
| 41 | + } else { |
|
| 42 | + $tls = true; |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + else { |
|
| 46 | + $tls_ldap == 'non'; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + // Verifions que l'adresse demandee est valide |
|
| 50 | + $adresse_ldap = filter_var($adresse_ldap, FILTER_SANITIZE_URL) ?: ''; |
|
| 51 | + |
|
| 52 | + $ldap_link = ldap_connect($adresse_ldap, $port_ldap); |
|
| 53 | + $erreur = 'ldap_connect(' . spip_htmlspecialchars($adresse_ldap) . ', ' . spip_htmlspecialchars($port_ldap) . ')'; |
|
| 54 | + |
|
| 55 | + if ($ldap_link) { |
|
| 56 | + if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) { |
|
| 57 | + $protocole_ldap = 2; |
|
| 58 | + ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap); |
|
| 59 | + } |
|
| 60 | + if ($tls && !ldap_start_tls($ldap_link)) { |
|
| 61 | + $erreur = 'ldap_start_tls(' . spip_htmlspecialchars($ldap_link) |
|
| 62 | + . ' ' . spip_htmlspecialchars($adresse_ldap) |
|
| 63 | + . ', ' . spip_htmlspecialchars($port_ldap) . ')'; |
|
| 64 | + $ldap_link = false; |
|
| 65 | + } |
|
| 66 | + if ($ldap_link) { |
|
| 67 | + $ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap); |
|
| 68 | + $erreur = "ldap_bind('" . spip_htmlspecialchars($ldap_link) |
|
| 69 | + . "', '" . spip_htmlspecialchars($login_ldap) |
|
| 70 | + . "', '" . spip_htmlspecialchars($pass_ldap) |
|
| 71 | + . "'): " . spip_htmlspecialchars($adresse_ldap) |
|
| 72 | + . ', ' . spip_htmlspecialchars($port_ldap); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + if ($ldap_link) { |
|
| 77 | + echo info_etape( |
|
| 78 | + _T('titre_connexion_ldap'), |
|
| 79 | + info_progression_etape(2, 'etape_ldap', 'install/') |
|
| 80 | + ), _T('info_connexion_ldap_ok'); |
|
| 81 | + echo generer_form_ecrire('install', ( |
|
| 82 | + "\n<input type='hidden' name='etape' value='ldap3' />" |
|
| 83 | + . "\n<input type='hidden' name='adresse_ldap' value=\"" . spip_htmlspecialchars($adresse_ldap) . '" />' |
|
| 84 | + . "\n<input type='hidden' name='port_ldap' value=\"" . spip_htmlspecialchars($port_ldap) . '" />' |
|
| 85 | + . "\n<input type='hidden' name='login_ldap' value=\"" . spip_htmlspecialchars($login_ldap) . '" />' |
|
| 86 | + . "\n<input type='hidden' name='pass_ldap' value=\"" . spip_htmlspecialchars($pass_ldap) . '" />' |
|
| 87 | + . "\n<input type='hidden' name='protocole_ldap' value=\"" . spip_htmlspecialchars($protocole_ldap) . '" />' |
|
| 88 | + . "\n<input type='hidden' name='tls_ldap' value=\"" . spip_htmlspecialchars($tls_ldap) . '" />' |
|
| 89 | + . bouton_suivant())); |
|
| 90 | + } else { |
|
| 91 | + echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true), |
|
| 92 | + "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>', |
|
| 93 | + '<p>' . _T('avis_connexion_ldap_echec_2') . |
|
| 94 | + "<br />\n" . _T('avis_connexion_ldap_echec_3') . |
|
| 95 | + '<br /><br />' . $erreur . '<b> ?</b></p></div>'; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + echo $minipage->installFinPage(); |
|
| 99 | 99 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $id_rubrique, |
| 151 | 151 | [ |
| 152 | 152 | 'data' => $set, |
| 153 | - 'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique] |
|
| 153 | + 'nonvide' => ['titre' => _T('titre_nouvelle_rubrique').' '._T('info_numero_abbreviation').$id_rubrique] |
|
| 154 | 154 | ], |
| 155 | 155 | $c |
| 156 | 156 | ) |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | ) |
| 255 | 255 | ) { |
| 256 | 256 | if ($s['statut'] != 'prepa') { |
| 257 | - spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']); |
|
| 257 | + spip_log("deplacement de $id_rubrique vers $id_parent refuse a ".$GLOBALS['visiteur_session']['id_auteur'].' '.$GLOBALS['visiteur_session']['statut']); |
|
| 258 | 258 | } |
| 259 | 259 | } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
| 260 | 260 | $statut_ancien = $s['statut']; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @package SPIP\Core\Rubriques\Edition |
| 16 | 16 | */ |
| 17 | 17 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 18 | - return; |
|
| 18 | + return; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | include_spip('inc/rubriques'); |
@@ -37,34 +37,34 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function action_editer_rubrique_dist($arg = null) { |
| 39 | 39 | |
| 40 | - if (is_null($arg)) { |
|
| 41 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 42 | - $arg = $securiser_action(); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - if (!$id_rubrique = (int) $arg) { |
|
| 46 | - if ($arg != 'oui') { |
|
| 47 | - include_spip('inc/headers'); |
|
| 48 | - redirige_url_ecrire(); |
|
| 49 | - } |
|
| 50 | - $id_rubrique = rubrique_inserer(_request('id_parent')); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - $err = rubrique_modifier($id_rubrique); |
|
| 54 | - |
|
| 55 | - if (_request('redirect')) { |
|
| 56 | - $redirect = parametre_url( |
|
| 57 | - urldecode((string) _request('redirect')), |
|
| 58 | - 'id_rubrique', |
|
| 59 | - $id_rubrique, |
|
| 60 | - '&' |
|
| 61 | - ); |
|
| 62 | - |
|
| 63 | - include_spip('inc/headers'); |
|
| 64 | - redirige_par_entete($redirect); |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - return [$id_rubrique, $err]; |
|
| 40 | + if (is_null($arg)) { |
|
| 41 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 42 | + $arg = $securiser_action(); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + if (!$id_rubrique = (int) $arg) { |
|
| 46 | + if ($arg != 'oui') { |
|
| 47 | + include_spip('inc/headers'); |
|
| 48 | + redirige_url_ecrire(); |
|
| 49 | + } |
|
| 50 | + $id_rubrique = rubrique_inserer(_request('id_parent')); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + $err = rubrique_modifier($id_rubrique); |
|
| 54 | + |
|
| 55 | + if (_request('redirect')) { |
|
| 56 | + $redirect = parametre_url( |
|
| 57 | + urldecode((string) _request('redirect')), |
|
| 58 | + 'id_rubrique', |
|
| 59 | + $id_rubrique, |
|
| 60 | + '&' |
|
| 61 | + ); |
|
| 62 | + |
|
| 63 | + include_spip('inc/headers'); |
|
| 64 | + redirige_par_entete($redirect); |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + return [$id_rubrique, $err]; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -79,64 +79,64 @@ discard block |
||
| 79 | 79 | * Identifiant de la rubrique crée |
| 80 | 80 | */ |
| 81 | 81 | function rubrique_inserer($id_parent, $set = null) { |
| 82 | - $champs = [ |
|
| 83 | - 'titre' => _T('item_nouvelle_rubrique'), |
|
| 84 | - 'id_parent' => (int) $id_parent, |
|
| 85 | - 'statut' => 'prepa' |
|
| 86 | - ]; |
|
| 87 | - |
|
| 88 | - if ($set) { |
|
| 89 | - $champs = array_merge($champs, $set); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - // Envoyer aux plugins |
|
| 93 | - $champs = pipeline( |
|
| 94 | - 'pre_insertion', |
|
| 95 | - [ |
|
| 96 | - 'args' => [ |
|
| 97 | - 'table' => 'spip_rubriques', |
|
| 98 | - ], |
|
| 99 | - 'data' => $champs |
|
| 100 | - ] |
|
| 101 | - ); |
|
| 102 | - |
|
| 103 | - $id_rubrique = sql_insertq('spip_rubriques', $champs); |
|
| 104 | - pipeline( |
|
| 105 | - 'post_insertion', |
|
| 106 | - [ |
|
| 107 | - 'args' => [ |
|
| 108 | - 'table' => 'spip_rubriques', |
|
| 109 | - 'id_objet' => $id_rubrique |
|
| 110 | - ], |
|
| 111 | - 'data' => $champs |
|
| 112 | - ] |
|
| 113 | - ); |
|
| 114 | - propager_les_secteurs(); |
|
| 115 | - calculer_langues_rubriques(); |
|
| 116 | - |
|
| 117 | - // Appeler une notification |
|
| 118 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 119 | - $notifications( |
|
| 120 | - 'rubrique_inserer', |
|
| 121 | - $id_rubrique, |
|
| 122 | - [ |
|
| 123 | - 'id_parent' => $id_parent, |
|
| 124 | - 'champs' => $champs, |
|
| 125 | - ] |
|
| 126 | - ); |
|
| 127 | - $notifications( |
|
| 128 | - 'objet_inserer', |
|
| 129 | - $id_rubrique, |
|
| 130 | - [ |
|
| 131 | - 'objet' => 'rubrique', |
|
| 132 | - 'id_objet' => $id_rubrique, |
|
| 133 | - 'id_parent' => $id_parent, |
|
| 134 | - 'champs' => $champs, |
|
| 135 | - ] |
|
| 136 | - ); |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - return $id_rubrique; |
|
| 82 | + $champs = [ |
|
| 83 | + 'titre' => _T('item_nouvelle_rubrique'), |
|
| 84 | + 'id_parent' => (int) $id_parent, |
|
| 85 | + 'statut' => 'prepa' |
|
| 86 | + ]; |
|
| 87 | + |
|
| 88 | + if ($set) { |
|
| 89 | + $champs = array_merge($champs, $set); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + // Envoyer aux plugins |
|
| 93 | + $champs = pipeline( |
|
| 94 | + 'pre_insertion', |
|
| 95 | + [ |
|
| 96 | + 'args' => [ |
|
| 97 | + 'table' => 'spip_rubriques', |
|
| 98 | + ], |
|
| 99 | + 'data' => $champs |
|
| 100 | + ] |
|
| 101 | + ); |
|
| 102 | + |
|
| 103 | + $id_rubrique = sql_insertq('spip_rubriques', $champs); |
|
| 104 | + pipeline( |
|
| 105 | + 'post_insertion', |
|
| 106 | + [ |
|
| 107 | + 'args' => [ |
|
| 108 | + 'table' => 'spip_rubriques', |
|
| 109 | + 'id_objet' => $id_rubrique |
|
| 110 | + ], |
|
| 111 | + 'data' => $champs |
|
| 112 | + ] |
|
| 113 | + ); |
|
| 114 | + propager_les_secteurs(); |
|
| 115 | + calculer_langues_rubriques(); |
|
| 116 | + |
|
| 117 | + // Appeler une notification |
|
| 118 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 119 | + $notifications( |
|
| 120 | + 'rubrique_inserer', |
|
| 121 | + $id_rubrique, |
|
| 122 | + [ |
|
| 123 | + 'id_parent' => $id_parent, |
|
| 124 | + 'champs' => $champs, |
|
| 125 | + ] |
|
| 126 | + ); |
|
| 127 | + $notifications( |
|
| 128 | + 'objet_inserer', |
|
| 129 | + $id_rubrique, |
|
| 130 | + [ |
|
| 131 | + 'objet' => 'rubrique', |
|
| 132 | + 'id_objet' => $id_rubrique, |
|
| 133 | + 'id_parent' => $id_parent, |
|
| 134 | + 'champs' => $champs, |
|
| 135 | + ] |
|
| 136 | + ); |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + return $id_rubrique; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -152,46 +152,46 @@ discard block |
||
| 152 | 152 | * - chaîne : texte d'un message d'erreur |
| 153 | 153 | */ |
| 154 | 154 | function rubrique_modifier($id_rubrique, $set = null) { |
| 155 | - include_spip('inc/autoriser'); |
|
| 156 | - include_spip('inc/filtres'); |
|
| 157 | - |
|
| 158 | - include_spip('inc/modifier'); |
|
| 159 | - $c = collecter_requests( |
|
| 160 | - // include list |
|
| 161 | - objet_info('rubrique', 'champs_editables'), |
|
| 162 | - // exclude list |
|
| 163 | - ['id_parent', 'confirme_deplace'], |
|
| 164 | - // donnees eventuellement fournies |
|
| 165 | - $set |
|
| 166 | - ); |
|
| 167 | - |
|
| 168 | - if ( |
|
| 169 | - $err = objet_modifier_champs( |
|
| 170 | - 'rubrique', |
|
| 171 | - $id_rubrique, |
|
| 172 | - [ |
|
| 173 | - 'data' => $set, |
|
| 174 | - 'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique] |
|
| 175 | - ], |
|
| 176 | - $c |
|
| 177 | - ) |
|
| 178 | - ) { |
|
| 179 | - return $err; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - $c = collecter_requests(['id_parent', 'confirme_deplace'], [], $set); |
|
| 183 | - // Deplacer la rubrique |
|
| 184 | - if (isset($c['id_parent'])) { |
|
| 185 | - $err = rubrique_instituer($id_rubrique, $c); |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - // invalider les caches marques de cette rubrique |
|
| 189 | - include_spip('inc/invalideur'); |
|
| 190 | - suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 191 | - // et celui de menu_rubriques |
|
| 192 | - effacer_meta('date_calcul_rubriques'); |
|
| 193 | - |
|
| 194 | - return $err; |
|
| 155 | + include_spip('inc/autoriser'); |
|
| 156 | + include_spip('inc/filtres'); |
|
| 157 | + |
|
| 158 | + include_spip('inc/modifier'); |
|
| 159 | + $c = collecter_requests( |
|
| 160 | + // include list |
|
| 161 | + objet_info('rubrique', 'champs_editables'), |
|
| 162 | + // exclude list |
|
| 163 | + ['id_parent', 'confirme_deplace'], |
|
| 164 | + // donnees eventuellement fournies |
|
| 165 | + $set |
|
| 166 | + ); |
|
| 167 | + |
|
| 168 | + if ( |
|
| 169 | + $err = objet_modifier_champs( |
|
| 170 | + 'rubrique', |
|
| 171 | + $id_rubrique, |
|
| 172 | + [ |
|
| 173 | + 'data' => $set, |
|
| 174 | + 'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique] |
|
| 175 | + ], |
|
| 176 | + $c |
|
| 177 | + ) |
|
| 178 | + ) { |
|
| 179 | + return $err; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + $c = collecter_requests(['id_parent', 'confirme_deplace'], [], $set); |
|
| 183 | + // Deplacer la rubrique |
|
| 184 | + if (isset($c['id_parent'])) { |
|
| 185 | + $err = rubrique_instituer($id_rubrique, $c); |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + // invalider les caches marques de cette rubrique |
|
| 189 | + include_spip('inc/invalideur'); |
|
| 190 | + suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 191 | + // et celui de menu_rubriques |
|
| 192 | + effacer_meta('date_calcul_rubriques'); |
|
| 193 | + |
|
| 194 | + return $err; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -214,29 +214,29 @@ discard block |
||
| 214 | 214 | * false si la confirmation du déplacement n'est pas présente |
| 215 | 215 | */ |
| 216 | 216 | function editer_rubrique_breves($id_rubrique, $id_parent, $c = []) { |
| 217 | - if (!sql_table_exists('spip_breves')) { |
|
| 218 | - return true; |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) { |
|
| 222 | - return true; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - if (empty($c['confirme_deplace']) || $c['confirme_deplace'] != 'oui') { |
|
| 226 | - return false; |
|
| 227 | - } |
|
| 228 | - |
|
| 229 | - if ( |
|
| 230 | - $id_secteur = sql_getfetsel( |
|
| 231 | - 'id_secteur', |
|
| 232 | - 'spip_rubriques', |
|
| 233 | - "id_rubrique=$id_parent" |
|
| 234 | - ) |
|
| 235 | - ) { |
|
| 236 | - sql_updateq('spip_breves', ['id_rubrique' => $id_secteur], "id_rubrique=$id_rubrique"); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - return true; |
|
| 217 | + if (!sql_table_exists('spip_breves')) { |
|
| 218 | + return true; |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) { |
|
| 222 | + return true; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + if (empty($c['confirme_deplace']) || $c['confirme_deplace'] != 'oui') { |
|
| 226 | + return false; |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + if ( |
|
| 230 | + $id_secteur = sql_getfetsel( |
|
| 231 | + 'id_secteur', |
|
| 232 | + 'spip_rubriques', |
|
| 233 | + "id_rubrique=$id_parent" |
|
| 234 | + ) |
|
| 235 | + ) { |
|
| 236 | + sql_updateq('spip_breves', ['id_rubrique' => $id_secteur], "id_rubrique=$id_rubrique"); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + return true; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -258,72 +258,72 @@ discard block |
||
| 258 | 258 | * Chaîne : texte du message d'erreur |
| 259 | 259 | */ |
| 260 | 260 | function rubrique_instituer($id_rubrique, $c) { |
| 261 | - // traitement de la rubrique parente |
|
| 262 | - // interdiction de deplacer vers ou a partir d'une rubrique |
|
| 263 | - // qu'on n'administre pas. |
|
| 264 | - |
|
| 265 | - if (null !== ($id_parent = $c['id_parent'])) { |
|
| 266 | - $id_parent = (int) $id_parent; |
|
| 267 | - $filles = calcul_branche_in($id_rubrique); |
|
| 268 | - if (str_contains(",$id_parent,", (string) ",$filles,")) { |
|
| 269 | - spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent"); |
|
| 270 | - } else { |
|
| 271 | - $s = sql_fetsel('id_parent, statut', 'spip_rubriques', "id_rubrique=$id_rubrique"); |
|
| 272 | - $old_parent = $s['id_parent']; |
|
| 273 | - |
|
| 274 | - if ( |
|
| 275 | - !($id_parent != $old_parent |
|
| 276 | - && autoriser('publierdans', 'rubrique', $id_parent) |
|
| 277 | - && autoriser('creerrubriquedans', 'rubrique', $id_parent) |
|
| 278 | - && autoriser('publierdans', 'rubrique', $old_parent) |
|
| 279 | - ) |
|
| 280 | - ) { |
|
| 281 | - if ($s['statut'] != 'prepa') { |
|
| 282 | - spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']); |
|
| 283 | - } |
|
| 284 | - } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
|
| 285 | - $statut_ancien = $s['statut']; |
|
| 286 | - sql_updateq('spip_rubriques', ['id_parent' => $id_parent], "id_rubrique=$id_rubrique"); |
|
| 287 | - |
|
| 288 | - |
|
| 289 | - propager_les_secteurs(); |
|
| 290 | - |
|
| 291 | - // Deplacement d'une rubrique publiee ==> chgt general de leur statut |
|
| 292 | - if ($statut_ancien == 'publie') { |
|
| 293 | - calculer_rubriques_if($old_parent, ['id_rubrique' => $id_parent], ['statut_ancien' => $statut_ancien]); |
|
| 294 | - } |
|
| 295 | - // Creation ou deplacement d'une rubrique non publiee |
|
| 296 | - // invalider le cache de leur menu |
|
| 297 | - elseif (!$statut_ancien || $old_parent != $id_parent) { |
|
| 298 | - effacer_meta('date_calcul_rubriques'); |
|
| 299 | - } |
|
| 300 | - |
|
| 301 | - calculer_langues_rubriques(); |
|
| 302 | - |
|
| 303 | - // Appeler une notification |
|
| 304 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 305 | - $notifications( |
|
| 306 | - 'rubrique_instituer', |
|
| 307 | - $id_rubrique, |
|
| 308 | - [ |
|
| 309 | - 'statut_ancien' => $statut_ancien, |
|
| 310 | - 'id_parent_ancien' => $old_parent, |
|
| 311 | - ] |
|
| 312 | - ); |
|
| 313 | - $notifications( |
|
| 314 | - 'objet_instituer', |
|
| 315 | - $id_rubrique, |
|
| 316 | - [ |
|
| 317 | - 'objet' => 'rubrique', |
|
| 318 | - 'id_objet' => $id_rubrique, |
|
| 319 | - 'statut_ancien' => $statut_ancien, |
|
| 320 | - 'id_parent_ancien' => $old_parent, |
|
| 321 | - ] |
|
| 322 | - ); |
|
| 323 | - } |
|
| 324 | - } |
|
| 325 | - } |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - return ''; // pas d'erreur |
|
| 261 | + // traitement de la rubrique parente |
|
| 262 | + // interdiction de deplacer vers ou a partir d'une rubrique |
|
| 263 | + // qu'on n'administre pas. |
|
| 264 | + |
|
| 265 | + if (null !== ($id_parent = $c['id_parent'])) { |
|
| 266 | + $id_parent = (int) $id_parent; |
|
| 267 | + $filles = calcul_branche_in($id_rubrique); |
|
| 268 | + if (str_contains(",$id_parent,", (string) ",$filles,")) { |
|
| 269 | + spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent"); |
|
| 270 | + } else { |
|
| 271 | + $s = sql_fetsel('id_parent, statut', 'spip_rubriques', "id_rubrique=$id_rubrique"); |
|
| 272 | + $old_parent = $s['id_parent']; |
|
| 273 | + |
|
| 274 | + if ( |
|
| 275 | + !($id_parent != $old_parent |
|
| 276 | + && autoriser('publierdans', 'rubrique', $id_parent) |
|
| 277 | + && autoriser('creerrubriquedans', 'rubrique', $id_parent) |
|
| 278 | + && autoriser('publierdans', 'rubrique', $old_parent) |
|
| 279 | + ) |
|
| 280 | + ) { |
|
| 281 | + if ($s['statut'] != 'prepa') { |
|
| 282 | + spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']); |
|
| 283 | + } |
|
| 284 | + } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
|
| 285 | + $statut_ancien = $s['statut']; |
|
| 286 | + sql_updateq('spip_rubriques', ['id_parent' => $id_parent], "id_rubrique=$id_rubrique"); |
|
| 287 | + |
|
| 288 | + |
|
| 289 | + propager_les_secteurs(); |
|
| 290 | + |
|
| 291 | + // Deplacement d'une rubrique publiee ==> chgt general de leur statut |
|
| 292 | + if ($statut_ancien == 'publie') { |
|
| 293 | + calculer_rubriques_if($old_parent, ['id_rubrique' => $id_parent], ['statut_ancien' => $statut_ancien]); |
|
| 294 | + } |
|
| 295 | + // Creation ou deplacement d'une rubrique non publiee |
|
| 296 | + // invalider le cache de leur menu |
|
| 297 | + elseif (!$statut_ancien || $old_parent != $id_parent) { |
|
| 298 | + effacer_meta('date_calcul_rubriques'); |
|
| 299 | + } |
|
| 300 | + |
|
| 301 | + calculer_langues_rubriques(); |
|
| 302 | + |
|
| 303 | + // Appeler une notification |
|
| 304 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 305 | + $notifications( |
|
| 306 | + 'rubrique_instituer', |
|
| 307 | + $id_rubrique, |
|
| 308 | + [ |
|
| 309 | + 'statut_ancien' => $statut_ancien, |
|
| 310 | + 'id_parent_ancien' => $old_parent, |
|
| 311 | + ] |
|
| 312 | + ); |
|
| 313 | + $notifications( |
|
| 314 | + 'objet_instituer', |
|
| 315 | + $id_rubrique, |
|
| 316 | + [ |
|
| 317 | + 'objet' => 'rubrique', |
|
| 318 | + 'id_objet' => $id_rubrique, |
|
| 319 | + 'statut_ancien' => $statut_ancien, |
|
| 320 | + 'id_parent_ancien' => $old_parent, |
|
| 321 | + ] |
|
| 322 | + ); |
|
| 323 | + } |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + return ''; // pas d'erreur |
|
| 329 | 329 | } |
@@ -312,8 +312,7 @@ |
||
| 312 | 312 | ecrire_meta($casier, $serialized_store, null, $table); |
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | - } |
|
| 316 | - else { |
|
| 315 | + } else { |
|
| 317 | 316 | ecrire_meta($casier, $store, null, $table); |
| 318 | 317 | } |
| 319 | 318 | } |
@@ -303,9 +303,9 @@ |
||
| 303 | 303 | // et dans ce cas il faut verifier que l'ecriture en base a bien eu lieu a l'identique si il y a des planes dans la chaine |
| 304 | 304 | // car sinon ca casse le serialize PHP - par exemple si on est en mysql utf8 (non mb4) |
| 305 | 305 | if ($has_planes) { |
| 306 | - $check_store = sql_getfetsel('valeur', 'spip_' . $table, 'nom=' . sql_quote($casier)); |
|
| 306 | + $check_store = sql_getfetsel('valeur', 'spip_'.$table, 'nom='.sql_quote($casier)); |
|
| 307 | 307 | if ($check_store !== $serialized_store) { |
| 308 | - array_walk_recursive($store, function (&$value, $key) { |
|
| 308 | + array_walk_recursive($store, function(&$value, $key) { |
|
| 309 | 309 | if (is_string($value)) { |
| 310 | 310 | $value = utf8_noplanes($value); |
| 311 | 311 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | **/ |
| 17 | 17 | |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @return void |
| 28 | 28 | */ |
| 29 | 29 | function inc_config_dist() { |
| 30 | - actualise_metas(liste_metas()); |
|
| 30 | + actualise_metas(liste_metas()); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -44,32 +44,32 @@ discard block |
||
| 44 | 44 | * Liste (table, casier, sous_casier) |
| 45 | 45 | */ |
| 46 | 46 | function expliquer_config($cfg) { |
| 47 | - // par defaut, sur la table des meta |
|
| 48 | - $table = 'meta'; |
|
| 49 | - $casier = null; |
|
| 50 | - $sous_casier = []; |
|
| 51 | - $cfg = explode('/', $cfg); |
|
| 52 | - |
|
| 53 | - // si le premier argument est vide, c'est une syntaxe /table/ ou un appel vide '' |
|
| 54 | - if (!reset($cfg) && count($cfg) > 1) { |
|
| 55 | - array_shift($cfg); |
|
| 56 | - $table = array_shift($cfg); |
|
| 57 | - if (!isset($GLOBALS[$table])) { |
|
| 58 | - lire_metas($table); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - // si on a demande #CONFIG{/meta,'',0} |
|
| 63 | - // pas sur un appel vide '' |
|
| 64 | - if (count($cfg) && '' !== ($c = array_shift($cfg))) { |
|
| 65 | - $casier = $c; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - if ($cfg !== []) { |
|
| 69 | - $sous_casier = $cfg; |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - return [$table, $casier, $sous_casier]; |
|
| 47 | + // par defaut, sur la table des meta |
|
| 48 | + $table = 'meta'; |
|
| 49 | + $casier = null; |
|
| 50 | + $sous_casier = []; |
|
| 51 | + $cfg = explode('/', $cfg); |
|
| 52 | + |
|
| 53 | + // si le premier argument est vide, c'est une syntaxe /table/ ou un appel vide '' |
|
| 54 | + if (!reset($cfg) && count($cfg) > 1) { |
|
| 55 | + array_shift($cfg); |
|
| 56 | + $table = array_shift($cfg); |
|
| 57 | + if (!isset($GLOBALS[$table])) { |
|
| 58 | + lire_metas($table); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + // si on a demande #CONFIG{/meta,'',0} |
|
| 63 | + // pas sur un appel vide '' |
|
| 64 | + if (count($cfg) && '' !== ($c = array_shift($cfg))) { |
|
| 65 | + $casier = $c; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + if ($cfg !== []) { |
|
| 69 | + $sous_casier = $cfg; |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + return [$table, $casier, $sous_casier]; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -97,63 +97,63 @@ discard block |
||
| 97 | 97 | * Contenu de la configuration obtenue |
| 98 | 98 | */ |
| 99 | 99 | function lire_config($cfg = '', mixed $def = null, $unserialize = true) { |
| 100 | - // lire le stockage sous la forme /table/valeur |
|
| 101 | - // ou valeur qui est en fait implicitement /meta/valeur |
|
| 102 | - // ou casier/valeur qui est en fait implicitement /meta/casier/valeur |
|
| 103 | - |
|
| 104 | - // traiter en priorite le cas simple et frequent |
|
| 105 | - // de lecture direct $GLOBALS['meta']['truc'], si $cfg ne contient ni / ni : |
|
| 106 | - if ($cfg && strpbrk($cfg, '/:') === false) { |
|
| 107 | - return isset($GLOBALS['meta'][$cfg]) |
|
| 108 | - ? (!$unserialize |
|
| 109 | - // ne pas essayer de deserialiser autre chose qu'une chaine |
|
| 110 | - || !is_string($GLOBALS['meta'][$cfg]) |
|
| 111 | - // ne pas essayer de deserialiser si ce n'est visiblement pas une chaine serializee |
|
| 112 | - || !str_contains($GLOBALS['meta'][$cfg], ':') |
|
| 113 | - || ($t = @unserialize($GLOBALS['meta'][$cfg])) === false ? $GLOBALS['meta'][$cfg] : $t) |
|
| 114 | - : $def; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - // Brancher sur methodes externes si besoin |
|
| 118 | - if ($cfg && ($p = strpos($cfg, '::'))) { |
|
| 119 | - $methode = substr($cfg, 0, $p); |
|
| 120 | - $lire_config = charger_fonction($methode, 'lire_config'); |
|
| 121 | - |
|
| 122 | - return $lire_config(substr($cfg, $p + 2), $def, $unserialize); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - [$table, $casier, $sous_casier] = expliquer_config($cfg); |
|
| 126 | - |
|
| 127 | - if (!isset($GLOBALS[$table])) { |
|
| 128 | - return $def; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - $r = $GLOBALS[$table]; |
|
| 132 | - |
|
| 133 | - // si on a demande #CONFIG{/meta,'',0} |
|
| 134 | - if (!$casier) { |
|
| 135 | - return $unserialize ? $r : serialize($r); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - // casier principal : |
|
| 139 | - // le deserializer si demande |
|
| 140 | - // ou si on a besoin |
|
| 141 | - // d'un sous casier |
|
| 142 | - $r = $r[$casier] ?? null; |
|
| 143 | - if (($unserialize || (is_countable($sous_casier) ? count($sous_casier) : 0)) && $r && is_string($r)) { |
|
| 144 | - $r = (($t = @unserialize($r)) === false ? $r : $t); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - // aller chercher le sous_casier |
|
| 148 | - while (!is_null($r) && ($casier = array_shift($sous_casier))) { |
|
| 149 | - $r = $r[$casier] ?? null; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - if (is_null($r)) { |
|
| 153 | - return $def; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - return $r; |
|
| 100 | + // lire le stockage sous la forme /table/valeur |
|
| 101 | + // ou valeur qui est en fait implicitement /meta/valeur |
|
| 102 | + // ou casier/valeur qui est en fait implicitement /meta/casier/valeur |
|
| 103 | + |
|
| 104 | + // traiter en priorite le cas simple et frequent |
|
| 105 | + // de lecture direct $GLOBALS['meta']['truc'], si $cfg ne contient ni / ni : |
|
| 106 | + if ($cfg && strpbrk($cfg, '/:') === false) { |
|
| 107 | + return isset($GLOBALS['meta'][$cfg]) |
|
| 108 | + ? (!$unserialize |
|
| 109 | + // ne pas essayer de deserialiser autre chose qu'une chaine |
|
| 110 | + || !is_string($GLOBALS['meta'][$cfg]) |
|
| 111 | + // ne pas essayer de deserialiser si ce n'est visiblement pas une chaine serializee |
|
| 112 | + || !str_contains($GLOBALS['meta'][$cfg], ':') |
|
| 113 | + || ($t = @unserialize($GLOBALS['meta'][$cfg])) === false ? $GLOBALS['meta'][$cfg] : $t) |
|
| 114 | + : $def; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + // Brancher sur methodes externes si besoin |
|
| 118 | + if ($cfg && ($p = strpos($cfg, '::'))) { |
|
| 119 | + $methode = substr($cfg, 0, $p); |
|
| 120 | + $lire_config = charger_fonction($methode, 'lire_config'); |
|
| 121 | + |
|
| 122 | + return $lire_config(substr($cfg, $p + 2), $def, $unserialize); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + [$table, $casier, $sous_casier] = expliquer_config($cfg); |
|
| 126 | + |
|
| 127 | + if (!isset($GLOBALS[$table])) { |
|
| 128 | + return $def; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + $r = $GLOBALS[$table]; |
|
| 132 | + |
|
| 133 | + // si on a demande #CONFIG{/meta,'',0} |
|
| 134 | + if (!$casier) { |
|
| 135 | + return $unserialize ? $r : serialize($r); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + // casier principal : |
|
| 139 | + // le deserializer si demande |
|
| 140 | + // ou si on a besoin |
|
| 141 | + // d'un sous casier |
|
| 142 | + $r = $r[$casier] ?? null; |
|
| 143 | + if (($unserialize || (is_countable($sous_casier) ? count($sous_casier) : 0)) && $r && is_string($r)) { |
|
| 144 | + $r = (($t = @unserialize($r)) === false ? $r : $t); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + // aller chercher le sous_casier |
|
| 148 | + while (!is_null($r) && ($casier = array_shift($sous_casier))) { |
|
| 149 | + $r = $r[$casier] ?? null; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + if (is_null($r)) { |
|
| 153 | + return $def; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + return $r; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @return mixed |
| 167 | 167 | */ |
| 168 | 168 | function lire_config_metapack_dist($cfg = '', mixed $def = null, $unserialize = true) { |
| 169 | - return lire_config($cfg, $def, $unserialize); |
|
| 169 | + return lire_config($cfg, $def, $unserialize); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
@@ -177,144 +177,144 @@ discard block |
||
| 177 | 177 | * @return bool |
| 178 | 178 | */ |
| 179 | 179 | function ecrire_config($cfg, mixed $store) { |
| 180 | - // Brancher sur methodes externes si besoin |
|
| 181 | - if ($cfg && ($p = strpos($cfg, '::'))) { |
|
| 182 | - $methode = substr($cfg, 0, $p); |
|
| 183 | - $ecrire_config = charger_fonction($methode, 'ecrire_config'); |
|
| 184 | - |
|
| 185 | - return $ecrire_config(substr($cfg, $p + 2), $store); |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - [$table, $casier, $sous_casier] = expliquer_config($cfg); |
|
| 189 | - // il faut au moins un casier pour ecrire |
|
| 190 | - if (!$casier) { |
|
| 191 | - return false; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - // trouvons ou creons le pointeur sur le casier |
|
| 195 | - $st = $GLOBALS[$table][$casier] ?? null; |
|
| 196 | - if (!is_array($st) && ($sous_casier || is_array($store))) { |
|
| 197 | - if ($st === null) { |
|
| 198 | - // ne rien creer si c'est une demande d'effacement |
|
| 199 | - if ($store === null) { |
|
| 200 | - return false; |
|
| 201 | - } |
|
| 202 | - $st = []; |
|
| 203 | - } else { |
|
| 204 | - $st = unserialize($st); |
|
| 205 | - if ($st === false) { |
|
| 206 | - // ne rien creer si c'est une demande d'effacement |
|
| 207 | - if ($store === null) { |
|
| 208 | - return false; |
|
| 209 | - } |
|
| 210 | - $st = []; |
|
| 211 | - } |
|
| 212 | - } |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - $has_planes = false; |
|
| 216 | - // si on a affaire a un sous caiser |
|
| 217 | - // il faut ecrire au bon endroit sans perdre les autres sous casier freres |
|
| 218 | - if ($c = $sous_casier) { |
|
| 219 | - $sc = &$st; |
|
| 220 | - $pointeurs = []; |
|
| 221 | - while ((is_countable($c) ? count($c) : 0) && ($cc = array_shift($c))) { |
|
| 222 | - // creer l'entree si elle n'existe pas |
|
| 223 | - if (!isset($sc[$cc])) { |
|
| 224 | - // si on essaye d'effacer une config qui n'existe pas |
|
| 225 | - // ne rien creer mais sortir |
|
| 226 | - if (is_null($store)) { |
|
| 227 | - return false; |
|
| 228 | - } |
|
| 229 | - $sc[$cc] = []; |
|
| 230 | - } |
|
| 231 | - $pointeurs[$cc] = &$sc; |
|
| 232 | - $sc = &$sc[$cc]; |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - // si c'est une demande d'effacement |
|
| 236 | - if (is_null($store)) { |
|
| 237 | - $c = $sous_casier; |
|
| 238 | - $sous = array_pop($c); |
|
| 239 | - // effacer, et remonter pour effacer les parents vides |
|
| 240 | - do { |
|
| 241 | - unset($pointeurs[$sous][$sous]); |
|
| 242 | - } while (($sous = array_pop($c)) && !(is_countable($pointeurs[$sous][$sous]) ? count($pointeurs[$sous][$sous]) : 0)); |
|
| 243 | - |
|
| 244 | - // si on a vide tous les sous casiers, |
|
| 245 | - // et que le casier est vide |
|
| 246 | - // vider aussi la meta |
|
| 247 | - if (!$sous && !(is_countable($st) ? count($st) : 0)) { |
|
| 248 | - $st = null; |
|
| 249 | - } |
|
| 250 | - } // dans tous les autres cas, on ecrase |
|
| 251 | - else { |
|
| 252 | - if ( |
|
| 253 | - defined('_MYSQL_NOPLANES') |
|
| 254 | - && _MYSQL_NOPLANES |
|
| 255 | - && !empty($GLOBALS['meta']['charset_sql_connexion']) |
|
| 256 | - && $GLOBALS['meta']['charset_sql_connexion'] == 'utf8' |
|
| 257 | - ) { |
|
| 258 | - // detecter si la valeur qu'on veut ecrire a des planes |
|
| 259 | - // @see utf8_noplanes |
|
| 260 | - $serialized_store = (is_string($store) ? $store : serialize($store)); |
|
| 261 | - // un preg_match rapide pour voir si ca vaut le coup de lancer utf8_noplanes |
|
| 262 | - if (preg_match(',[\xF0-\xF4],ms', $serialized_store)) { |
|
| 263 | - if (!function_exists('utf8_noplanes')) { |
|
| 264 | - include_spip('inc/charsets'); |
|
| 265 | - } |
|
| 266 | - if ($serialized_store !== utf8_noplanes($serialized_store)) { |
|
| 267 | - $has_planes = true; |
|
| 268 | - } |
|
| 269 | - } |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - $sc = $store; |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - // Maintenant que $st est modifiee |
|
| 276 | - // reprenons la comme valeur a stocker dans le casier principal |
|
| 277 | - $store = $st; |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - if (is_null($store)) { |
|
| 281 | - if (is_null($st) && !$sous_casier) { |
|
| 282 | - return false; |
|
| 283 | - } // la config n'existait deja pas ! |
|
| 284 | - effacer_meta($casier, $table); |
|
| 285 | - supprimer_table_meta($table); // supprimons la table (si elle est bien vide) |
|
| 286 | - } // les meta ne peuvent etre que des chaines : il faut serializer le reste |
|
| 287 | - else { |
|
| 288 | - if (!isset($GLOBALS[$table])) { |
|
| 289 | - installer_table_meta($table); |
|
| 290 | - } |
|
| 291 | - // si ce n'est pas une chaine |
|
| 292 | - // il faut serializer |
|
| 293 | - if (!is_string($store)) { |
|
| 294 | - $serialized_store = serialize($store); |
|
| 295 | - ecrire_meta($casier, $serialized_store, null, $table); |
|
| 296 | - // et dans ce cas il faut verifier que l'ecriture en base a bien eu lieu a l'identique si il y a des planes dans la chaine |
|
| 297 | - // car sinon ca casse le serialize PHP - par exemple si on est en mysql utf8 (non mb4) |
|
| 298 | - if ($has_planes) { |
|
| 299 | - $check_store = sql_getfetsel('valeur', 'spip_' . $table, 'nom=' . sql_quote($casier)); |
|
| 300 | - if ($check_store !== $serialized_store) { |
|
| 301 | - array_walk_recursive($store, function (&$value, $key) { |
|
| 302 | - if (is_string($value)) { |
|
| 303 | - $value = utf8_noplanes($value); |
|
| 304 | - } |
|
| 305 | - }); |
|
| 306 | - $serialized_store = serialize($store); |
|
| 307 | - ecrire_meta($casier, $serialized_store, null, $table); |
|
| 308 | - } |
|
| 309 | - } |
|
| 310 | - } |
|
| 311 | - else { |
|
| 312 | - ecrire_meta($casier, $store, null, $table); |
|
| 313 | - } |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - // verifier que lire_config($cfg)==$store ? |
|
| 317 | - return true; |
|
| 180 | + // Brancher sur methodes externes si besoin |
|
| 181 | + if ($cfg && ($p = strpos($cfg, '::'))) { |
|
| 182 | + $methode = substr($cfg, 0, $p); |
|
| 183 | + $ecrire_config = charger_fonction($methode, 'ecrire_config'); |
|
| 184 | + |
|
| 185 | + return $ecrire_config(substr($cfg, $p + 2), $store); |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + [$table, $casier, $sous_casier] = expliquer_config($cfg); |
|
| 189 | + // il faut au moins un casier pour ecrire |
|
| 190 | + if (!$casier) { |
|
| 191 | + return false; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + // trouvons ou creons le pointeur sur le casier |
|
| 195 | + $st = $GLOBALS[$table][$casier] ?? null; |
|
| 196 | + if (!is_array($st) && ($sous_casier || is_array($store))) { |
|
| 197 | + if ($st === null) { |
|
| 198 | + // ne rien creer si c'est une demande d'effacement |
|
| 199 | + if ($store === null) { |
|
| 200 | + return false; |
|
| 201 | + } |
|
| 202 | + $st = []; |
|
| 203 | + } else { |
|
| 204 | + $st = unserialize($st); |
|
| 205 | + if ($st === false) { |
|
| 206 | + // ne rien creer si c'est une demande d'effacement |
|
| 207 | + if ($store === null) { |
|
| 208 | + return false; |
|
| 209 | + } |
|
| 210 | + $st = []; |
|
| 211 | + } |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + $has_planes = false; |
|
| 216 | + // si on a affaire a un sous caiser |
|
| 217 | + // il faut ecrire au bon endroit sans perdre les autres sous casier freres |
|
| 218 | + if ($c = $sous_casier) { |
|
| 219 | + $sc = &$st; |
|
| 220 | + $pointeurs = []; |
|
| 221 | + while ((is_countable($c) ? count($c) : 0) && ($cc = array_shift($c))) { |
|
| 222 | + // creer l'entree si elle n'existe pas |
|
| 223 | + if (!isset($sc[$cc])) { |
|
| 224 | + // si on essaye d'effacer une config qui n'existe pas |
|
| 225 | + // ne rien creer mais sortir |
|
| 226 | + if (is_null($store)) { |
|
| 227 | + return false; |
|
| 228 | + } |
|
| 229 | + $sc[$cc] = []; |
|
| 230 | + } |
|
| 231 | + $pointeurs[$cc] = &$sc; |
|
| 232 | + $sc = &$sc[$cc]; |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + // si c'est une demande d'effacement |
|
| 236 | + if (is_null($store)) { |
|
| 237 | + $c = $sous_casier; |
|
| 238 | + $sous = array_pop($c); |
|
| 239 | + // effacer, et remonter pour effacer les parents vides |
|
| 240 | + do { |
|
| 241 | + unset($pointeurs[$sous][$sous]); |
|
| 242 | + } while (($sous = array_pop($c)) && !(is_countable($pointeurs[$sous][$sous]) ? count($pointeurs[$sous][$sous]) : 0)); |
|
| 243 | + |
|
| 244 | + // si on a vide tous les sous casiers, |
|
| 245 | + // et que le casier est vide |
|
| 246 | + // vider aussi la meta |
|
| 247 | + if (!$sous && !(is_countable($st) ? count($st) : 0)) { |
|
| 248 | + $st = null; |
|
| 249 | + } |
|
| 250 | + } // dans tous les autres cas, on ecrase |
|
| 251 | + else { |
|
| 252 | + if ( |
|
| 253 | + defined('_MYSQL_NOPLANES') |
|
| 254 | + && _MYSQL_NOPLANES |
|
| 255 | + && !empty($GLOBALS['meta']['charset_sql_connexion']) |
|
| 256 | + && $GLOBALS['meta']['charset_sql_connexion'] == 'utf8' |
|
| 257 | + ) { |
|
| 258 | + // detecter si la valeur qu'on veut ecrire a des planes |
|
| 259 | + // @see utf8_noplanes |
|
| 260 | + $serialized_store = (is_string($store) ? $store : serialize($store)); |
|
| 261 | + // un preg_match rapide pour voir si ca vaut le coup de lancer utf8_noplanes |
|
| 262 | + if (preg_match(',[\xF0-\xF4],ms', $serialized_store)) { |
|
| 263 | + if (!function_exists('utf8_noplanes')) { |
|
| 264 | + include_spip('inc/charsets'); |
|
| 265 | + } |
|
| 266 | + if ($serialized_store !== utf8_noplanes($serialized_store)) { |
|
| 267 | + $has_planes = true; |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + $sc = $store; |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + // Maintenant que $st est modifiee |
|
| 276 | + // reprenons la comme valeur a stocker dans le casier principal |
|
| 277 | + $store = $st; |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + if (is_null($store)) { |
|
| 281 | + if (is_null($st) && !$sous_casier) { |
|
| 282 | + return false; |
|
| 283 | + } // la config n'existait deja pas ! |
|
| 284 | + effacer_meta($casier, $table); |
|
| 285 | + supprimer_table_meta($table); // supprimons la table (si elle est bien vide) |
|
| 286 | + } // les meta ne peuvent etre que des chaines : il faut serializer le reste |
|
| 287 | + else { |
|
| 288 | + if (!isset($GLOBALS[$table])) { |
|
| 289 | + installer_table_meta($table); |
|
| 290 | + } |
|
| 291 | + // si ce n'est pas une chaine |
|
| 292 | + // il faut serializer |
|
| 293 | + if (!is_string($store)) { |
|
| 294 | + $serialized_store = serialize($store); |
|
| 295 | + ecrire_meta($casier, $serialized_store, null, $table); |
|
| 296 | + // et dans ce cas il faut verifier que l'ecriture en base a bien eu lieu a l'identique si il y a des planes dans la chaine |
|
| 297 | + // car sinon ca casse le serialize PHP - par exemple si on est en mysql utf8 (non mb4) |
|
| 298 | + if ($has_planes) { |
|
| 299 | + $check_store = sql_getfetsel('valeur', 'spip_' . $table, 'nom=' . sql_quote($casier)); |
|
| 300 | + if ($check_store !== $serialized_store) { |
|
| 301 | + array_walk_recursive($store, function (&$value, $key) { |
|
| 302 | + if (is_string($value)) { |
|
| 303 | + $value = utf8_noplanes($value); |
|
| 304 | + } |
|
| 305 | + }); |
|
| 306 | + $serialized_store = serialize($store); |
|
| 307 | + ecrire_meta($casier, $serialized_store, null, $table); |
|
| 308 | + } |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | + else { |
|
| 312 | + ecrire_meta($casier, $store, null, $table); |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + // verifier que lire_config($cfg)==$store ? |
|
| 317 | + return true; |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | |
@@ -327,14 +327,14 @@ discard block |
||
| 327 | 327 | * @return bool |
| 328 | 328 | */ |
| 329 | 329 | function ecrire_config_metapack_dist($cfg, mixed $store) { |
| 330 | - // cas particulier en metapack:: |
|
| 331 | - // si on ecrit une chaine deja serializee, il faut la reserializer pour la rendre |
|
| 332 | - // intacte en sortie ... |
|
| 333 | - if (is_string($store) && strpos($store, ':') && unserialize($store)) { |
|
| 334 | - $store = serialize($store); |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - return ecrire_config($cfg, $store); |
|
| 330 | + // cas particulier en metapack:: |
|
| 331 | + // si on ecrit une chaine deja serializee, il faut la reserializer pour la rendre |
|
| 332 | + // intacte en sortie ... |
|
| 333 | + if (is_string($store) && strpos($store, ':') && unserialize($store)) { |
|
| 334 | + $store = serialize($store); |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + return ecrire_config($cfg, $store); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
@@ -344,9 +344,9 @@ discard block |
||
| 344 | 344 | * @return bool |
| 345 | 345 | */ |
| 346 | 346 | function effacer_config($cfg) { |
| 347 | - ecrire_config($cfg, null); |
|
| 347 | + ecrire_config($cfg, null); |
|
| 348 | 348 | |
| 349 | - return true; |
|
| 349 | + return true; |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | /** |
@@ -363,58 +363,58 @@ discard block |
||
| 363 | 363 | * Couples nom de la `meta` => valeur par défaut |
| 364 | 364 | */ |
| 365 | 365 | function liste_metas() { |
| 366 | - return pipeline('configurer_liste_metas', [ |
|
| 367 | - 'nom_site' => _T('info_mon_site_spip'), |
|
| 368 | - 'slogan_site' => '', |
|
| 369 | - 'adresse_site' => preg_replace(',/$,', '', (string) url_de_base()), |
|
| 370 | - 'descriptif_site' => '', |
|
| 371 | - 'activer_logos' => 'oui', |
|
| 372 | - 'activer_logos_survol' => 'non', |
|
| 373 | - 'articles_surtitre' => 'non', |
|
| 374 | - 'articles_soustitre' => 'non', |
|
| 375 | - 'articles_descriptif' => 'non', |
|
| 376 | - 'articles_chapeau' => 'non', |
|
| 377 | - 'articles_texte' => 'oui', |
|
| 378 | - 'articles_ps' => 'non', |
|
| 379 | - 'articles_redac' => 'non', |
|
| 380 | - 'post_dates' => 'non', |
|
| 381 | - 'articles_urlref' => 'non', |
|
| 382 | - 'articles_redirection' => 'non', |
|
| 383 | - 'creer_preview' => 'non', |
|
| 384 | - 'taille_preview' => 150, |
|
| 385 | - 'articles_modif' => 'non', |
|
| 386 | - |
|
| 387 | - 'rubriques_descriptif' => 'non', |
|
| 388 | - 'rubriques_texte' => 'oui', |
|
| 389 | - |
|
| 390 | - 'accepter_inscriptions' => 'non', |
|
| 391 | - 'accepter_visiteurs' => 'non', |
|
| 392 | - 'prevenir_auteurs' => 'non', |
|
| 393 | - 'suivi_edito' => 'non', |
|
| 394 | - 'adresse_suivi' => '', |
|
| 395 | - 'adresse_suivi_inscription' => '', |
|
| 396 | - 'adresse_neuf' => '', |
|
| 397 | - 'jours_neuf' => '', |
|
| 398 | - 'quoi_de_neuf' => 'non', |
|
| 399 | - 'preview' => ',0minirezo,1comite,', |
|
| 400 | - |
|
| 401 | - 'syndication_integrale' => 'oui', |
|
| 402 | - 'charset' => _DEFAULT_CHARSET, |
|
| 403 | - 'dir_img' => substr((string) _DIR_IMG, strlen(_DIR_RACINE)), |
|
| 404 | - |
|
| 405 | - 'multi_rubriques' => 'non', |
|
| 406 | - 'multi_secteurs' => 'non', |
|
| 407 | - 'gerer_trad' => 'non', |
|
| 408 | - 'langues_multilingue' => '', |
|
| 409 | - |
|
| 410 | - 'version_html_max' => 'html4', |
|
| 411 | - |
|
| 412 | - 'type_urls' => 'page', |
|
| 413 | - |
|
| 414 | - 'email_envoi' => '', |
|
| 415 | - 'email_webmaster' => '', |
|
| 416 | - 'auto_compress_http' => 'non', |
|
| 417 | - ]); |
|
| 366 | + return pipeline('configurer_liste_metas', [ |
|
| 367 | + 'nom_site' => _T('info_mon_site_spip'), |
|
| 368 | + 'slogan_site' => '', |
|
| 369 | + 'adresse_site' => preg_replace(',/$,', '', (string) url_de_base()), |
|
| 370 | + 'descriptif_site' => '', |
|
| 371 | + 'activer_logos' => 'oui', |
|
| 372 | + 'activer_logos_survol' => 'non', |
|
| 373 | + 'articles_surtitre' => 'non', |
|
| 374 | + 'articles_soustitre' => 'non', |
|
| 375 | + 'articles_descriptif' => 'non', |
|
| 376 | + 'articles_chapeau' => 'non', |
|
| 377 | + 'articles_texte' => 'oui', |
|
| 378 | + 'articles_ps' => 'non', |
|
| 379 | + 'articles_redac' => 'non', |
|
| 380 | + 'post_dates' => 'non', |
|
| 381 | + 'articles_urlref' => 'non', |
|
| 382 | + 'articles_redirection' => 'non', |
|
| 383 | + 'creer_preview' => 'non', |
|
| 384 | + 'taille_preview' => 150, |
|
| 385 | + 'articles_modif' => 'non', |
|
| 386 | + |
|
| 387 | + 'rubriques_descriptif' => 'non', |
|
| 388 | + 'rubriques_texte' => 'oui', |
|
| 389 | + |
|
| 390 | + 'accepter_inscriptions' => 'non', |
|
| 391 | + 'accepter_visiteurs' => 'non', |
|
| 392 | + 'prevenir_auteurs' => 'non', |
|
| 393 | + 'suivi_edito' => 'non', |
|
| 394 | + 'adresse_suivi' => '', |
|
| 395 | + 'adresse_suivi_inscription' => '', |
|
| 396 | + 'adresse_neuf' => '', |
|
| 397 | + 'jours_neuf' => '', |
|
| 398 | + 'quoi_de_neuf' => 'non', |
|
| 399 | + 'preview' => ',0minirezo,1comite,', |
|
| 400 | + |
|
| 401 | + 'syndication_integrale' => 'oui', |
|
| 402 | + 'charset' => _DEFAULT_CHARSET, |
|
| 403 | + 'dir_img' => substr((string) _DIR_IMG, strlen(_DIR_RACINE)), |
|
| 404 | + |
|
| 405 | + 'multi_rubriques' => 'non', |
|
| 406 | + 'multi_secteurs' => 'non', |
|
| 407 | + 'gerer_trad' => 'non', |
|
| 408 | + 'langues_multilingue' => '', |
|
| 409 | + |
|
| 410 | + 'version_html_max' => 'html4', |
|
| 411 | + |
|
| 412 | + 'type_urls' => 'page', |
|
| 413 | + |
|
| 414 | + 'email_envoi' => '', |
|
| 415 | + 'email_webmaster' => '', |
|
| 416 | + 'auto_compress_http' => 'non', |
|
| 417 | + ]); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | /** |
@@ -425,43 +425,43 @@ discard block |
||
| 425 | 425 | * @return void |
| 426 | 426 | */ |
| 427 | 427 | function actualise_metas($liste_meta) { |
| 428 | - $meta_serveur = |
|
| 429 | - [ |
|
| 430 | - 'version_installee', |
|
| 431 | - 'adresse_site', |
|
| 432 | - 'alea_ephemere_ancien', |
|
| 433 | - 'alea_ephemere', |
|
| 434 | - 'alea_ephemere_date', |
|
| 435 | - 'langue_site', |
|
| 436 | - 'langues_proposees', |
|
| 437 | - 'date_calcul_rubriques', |
|
| 438 | - 'derniere_modif', |
|
| 439 | - 'optimiser_table', |
|
| 440 | - 'drapeau_edition', |
|
| 441 | - 'creer_preview', |
|
| 442 | - 'taille_preview', |
|
| 443 | - 'creer_htpasswd', |
|
| 444 | - 'creer_htaccess', |
|
| 445 | - 'gd_formats_read', |
|
| 446 | - 'gd_formats', |
|
| 447 | - 'netpbm_formats', |
|
| 448 | - 'formats_graphiques', |
|
| 449 | - 'image_process', |
|
| 450 | - 'plugin_header', |
|
| 451 | - 'plugin' |
|
| 452 | - ]; |
|
| 453 | - // verifier le impt=non |
|
| 454 | - sql_updateq('spip_meta', ['impt' => 'non'], sql_in('nom', $meta_serveur)); |
|
| 455 | - |
|
| 456 | - foreach ($liste_meta as $nom => $valeur) { |
|
| 457 | - if (empty($GLOBALS['meta'][$nom])) { |
|
| 458 | - ecrire_meta($nom, $valeur); |
|
| 459 | - } |
|
| 460 | - } |
|
| 461 | - |
|
| 462 | - include_spip('inc/rubriques'); |
|
| 463 | - $langues = calculer_langues_utilisees(); |
|
| 464 | - ecrire_meta('langues_utilisees', $langues); |
|
| 428 | + $meta_serveur = |
|
| 429 | + [ |
|
| 430 | + 'version_installee', |
|
| 431 | + 'adresse_site', |
|
| 432 | + 'alea_ephemere_ancien', |
|
| 433 | + 'alea_ephemere', |
|
| 434 | + 'alea_ephemere_date', |
|
| 435 | + 'langue_site', |
|
| 436 | + 'langues_proposees', |
|
| 437 | + 'date_calcul_rubriques', |
|
| 438 | + 'derniere_modif', |
|
| 439 | + 'optimiser_table', |
|
| 440 | + 'drapeau_edition', |
|
| 441 | + 'creer_preview', |
|
| 442 | + 'taille_preview', |
|
| 443 | + 'creer_htpasswd', |
|
| 444 | + 'creer_htaccess', |
|
| 445 | + 'gd_formats_read', |
|
| 446 | + 'gd_formats', |
|
| 447 | + 'netpbm_formats', |
|
| 448 | + 'formats_graphiques', |
|
| 449 | + 'image_process', |
|
| 450 | + 'plugin_header', |
|
| 451 | + 'plugin' |
|
| 452 | + ]; |
|
| 453 | + // verifier le impt=non |
|
| 454 | + sql_updateq('spip_meta', ['impt' => 'non'], sql_in('nom', $meta_serveur)); |
|
| 455 | + |
|
| 456 | + foreach ($liste_meta as $nom => $valeur) { |
|
| 457 | + if (empty($GLOBALS['meta'][$nom])) { |
|
| 458 | + ecrire_meta($nom, $valeur); |
|
| 459 | + } |
|
| 460 | + } |
|
| 461 | + |
|
| 462 | + include_spip('inc/rubriques'); |
|
| 463 | + $langues = calculer_langues_utilisees(); |
|
| 464 | + ecrire_meta('langues_utilisees', $langues); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | |
@@ -483,18 +483,18 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | function appliquer_modifs_config($purger_skel = false) { |
| 485 | 485 | |
| 486 | - foreach (liste_metas() as $i => $v) { |
|
| 487 | - if (($x = _request($i)) !== null) { |
|
| 488 | - ecrire_meta($i, $x); |
|
| 489 | - } elseif (!isset($GLOBALS['meta'][$i])) { |
|
| 490 | - ecrire_meta($i, $v); |
|
| 491 | - } |
|
| 492 | - } |
|
| 493 | - |
|
| 494 | - if ($purger_skel) { |
|
| 495 | - include_spip('inc/invalideur'); |
|
| 496 | - purger_repertoire(_DIR_SKELS); |
|
| 497 | - } |
|
| 486 | + foreach (liste_metas() as $i => $v) { |
|
| 487 | + if (($x = _request($i)) !== null) { |
|
| 488 | + ecrire_meta($i, $x); |
|
| 489 | + } elseif (!isset($GLOBALS['meta'][$i])) { |
|
| 490 | + ecrire_meta($i, $v); |
|
| 491 | + } |
|
| 492 | + } |
|
| 493 | + |
|
| 494 | + if ($purger_skel) { |
|
| 495 | + include_spip('inc/invalideur'); |
|
| 496 | + purger_repertoire(_DIR_SKELS); |
|
| 497 | + } |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | /** |
@@ -505,21 +505,21 @@ discard block |
||
| 505 | 505 | * @return string |
| 506 | 506 | */ |
| 507 | 507 | function appliquer_adresse_site($adresse_site) { |
| 508 | - if ($adresse_site !== null) { |
|
| 509 | - if (!strlen($adresse_site)) { |
|
| 510 | - $GLOBALS['profondeur_url'] = _DIR_RESTREINT ? 0 : 1; |
|
| 511 | - $adresse_site = url_de_base(); |
|
| 512 | - } |
|
| 513 | - $adresse_site = preg_replace(',/?\s*$,', '', (string) $adresse_site); |
|
| 508 | + if ($adresse_site !== null) { |
|
| 509 | + if (!strlen($adresse_site)) { |
|
| 510 | + $GLOBALS['profondeur_url'] = _DIR_RESTREINT ? 0 : 1; |
|
| 511 | + $adresse_site = url_de_base(); |
|
| 512 | + } |
|
| 513 | + $adresse_site = preg_replace(',/?\s*$,', '', (string) $adresse_site); |
|
| 514 | 514 | |
| 515 | - if (!tester_url_absolue($adresse_site)) { |
|
| 516 | - $adresse_site = "http://$adresse_site"; |
|
| 517 | - } |
|
| 515 | + if (!tester_url_absolue($adresse_site)) { |
|
| 516 | + $adresse_site = "http://$adresse_site"; |
|
| 517 | + } |
|
| 518 | 518 | |
| 519 | - $adresse_site = entites_html($adresse_site); |
|
| 519 | + $adresse_site = entites_html($adresse_site); |
|
| 520 | 520 | |
| 521 | - ecrire_meta('adresse_site', $adresse_site); |
|
| 522 | - } |
|
| 521 | + ecrire_meta('adresse_site', $adresse_site); |
|
| 522 | + } |
|
| 523 | 523 | |
| 524 | - return $adresse_site; |
|
| 524 | + return $adresse_site; |
|
| 525 | 525 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $titre = '[' |
| 91 | 91 | . $nom_site_spip |
| 92 | 92 | . ']' |
| 93 | - . ($titre ? ' ' . textebrut(typo($titre)) : ''); |
|
| 93 | + . ($titre ? ' '.textebrut(typo($titre)) : ''); |
|
| 94 | 94 | |
| 95 | 95 | return _DOCTYPE_ECRIRE |
| 96 | 96 | . html_lang_attributes() |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | function init_body($rubrique = 'accueil', $sous_rubrique = 'accueil', $id_rubrique = '', $menu = true) { |
| 134 | 134 | |
| 135 | 135 | $res = pipeline('body_prive', "<body class='" |
| 136 | - . init_body_class() . ' ' . _request('exec') . "'" |
|
| 136 | + . init_body_class().' '._request('exec')."'" |
|
| 137 | 137 | . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '') |
| 138 | 138 | . '>'); |
| 139 | 139 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | **/ |
| 17 | 17 | |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -42,25 +42,25 @@ discard block |
||
| 42 | 42 | * @return string Code HTML |
| 43 | 43 | **/ |
| 44 | 44 | function inc_commencer_page_dist( |
| 45 | - $titre = '', |
|
| 46 | - $rubrique = 'accueil', |
|
| 47 | - $sous_rubrique = 'accueil', |
|
| 48 | - $id_rubrique = '', |
|
| 49 | - $menu = true, |
|
| 50 | - $minipres = false, |
|
| 51 | - $alertes = true |
|
| 45 | + $titre = '', |
|
| 46 | + $rubrique = 'accueil', |
|
| 47 | + $sous_rubrique = 'accueil', |
|
| 48 | + $id_rubrique = '', |
|
| 49 | + $menu = true, |
|
| 50 | + $minipres = false, |
|
| 51 | + $alertes = true |
|
| 52 | 52 | ) { |
| 53 | 53 | |
| 54 | - include_spip('inc/headers'); |
|
| 54 | + include_spip('inc/headers'); |
|
| 55 | 55 | |
| 56 | - http_no_cache(); |
|
| 56 | + http_no_cache(); |
|
| 57 | 57 | |
| 58 | - return init_entete($titre, $id_rubrique, $minipres) |
|
| 59 | - . init_body($rubrique, $sous_rubrique, $id_rubrique, $menu) |
|
| 60 | - . "<div id='page'>" |
|
| 61 | - . auteurs_recemment_connectes($GLOBALS['connect_id_auteur']) |
|
| 62 | - . ($alertes ? alertes_auteur($GLOBALS['connect_id_auteur']) : '') |
|
| 63 | - . '<div class="largeur">'; |
|
| 58 | + return init_entete($titre, $id_rubrique, $minipres) |
|
| 59 | + . init_body($rubrique, $sous_rubrique, $id_rubrique, $menu) |
|
| 60 | + . "<div id='page'>" |
|
| 61 | + . auteurs_recemment_connectes($GLOBALS['connect_id_auteur']) |
|
| 62 | + . ($alertes ? alertes_auteur($GLOBALS['connect_id_auteur']) : '') |
|
| 63 | + . '<div class="largeur">'; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -81,21 +81,21 @@ discard block |
||
| 81 | 81 | * Entête du fichier HTML avec le DOCTYPE |
| 82 | 82 | */ |
| 83 | 83 | function init_entete($titre = '', $dummy = 0, $minipres = false) { |
| 84 | - include_spip('inc/texte'); |
|
| 85 | - if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']['nom_site']))) { |
|
| 86 | - $nom_site_spip = _T('info_mon_site_spip'); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $titre = '[' |
|
| 90 | - . $nom_site_spip |
|
| 91 | - . ']' |
|
| 92 | - . ($titre ? ' ' . textebrut(typo($titre)) : ''); |
|
| 93 | - |
|
| 94 | - return _DOCTYPE_ECRIRE |
|
| 95 | - . html_lang_attributes() |
|
| 96 | - . "<head>\n" |
|
| 97 | - . init_head($titre, $dummy, $minipres) |
|
| 98 | - . "</head>\n"; |
|
| 84 | + include_spip('inc/texte'); |
|
| 85 | + if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']['nom_site']))) { |
|
| 86 | + $nom_site_spip = _T('info_mon_site_spip'); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $titre = '[' |
|
| 90 | + . $nom_site_spip |
|
| 91 | + . ']' |
|
| 92 | + . ($titre ? ' ' . textebrut(typo($titre)) : ''); |
|
| 93 | + |
|
| 94 | + return _DOCTYPE_ECRIRE |
|
| 95 | + . html_lang_attributes() |
|
| 96 | + . "<head>\n" |
|
| 97 | + . init_head($titre, $dummy, $minipres) |
|
| 98 | + . "</head>\n"; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | 111 | function init_head($titre = '', $dummy = 0, $minipres = false) { |
| 112 | - return recuperer_fond('prive/squelettes/head/dist', ['titre' => $titre, 'minipres' => $minipres ? ' ' : '']); |
|
| 112 | + return recuperer_fond('prive/squelettes/head/dist', ['titre' => $titre, 'minipres' => $minipres ? ' ' : '']); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -131,20 +131,20 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | function init_body($rubrique = 'accueil', $sous_rubrique = 'accueil', $id_rubrique = '', $menu = true) { |
| 133 | 133 | |
| 134 | - $res = pipeline('body_prive', "<body class='" |
|
| 135 | - . init_body_class() . ' ' . _request('exec') . "'" |
|
| 136 | - . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '') |
|
| 137 | - . '>'); |
|
| 134 | + $res = pipeline('body_prive', "<body class='" |
|
| 135 | + . init_body_class() . ' ' . _request('exec') . "'" |
|
| 136 | + . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '') |
|
| 137 | + . '>'); |
|
| 138 | 138 | |
| 139 | - if (!$menu) { |
|
| 140 | - return $res; |
|
| 141 | - } |
|
| 139 | + if (!$menu) { |
|
| 140 | + return $res; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | 143 | |
| 144 | - $bandeau = charger_fonction('bandeau', 'inc'); |
|
| 144 | + $bandeau = charger_fonction('bandeau', 'inc'); |
|
| 145 | 145 | |
| 146 | - return $res |
|
| 147 | - . $bandeau(); |
|
| 146 | + return $res |
|
| 147 | + . $bandeau(); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -156,23 +156,23 @@ discard block |
||
| 156 | 156 | * @return string Classes CSS (séparées par des espaces) |
| 157 | 157 | */ |
| 158 | 158 | function init_body_class() { |
| 159 | - $display_modes = [ |
|
| 160 | - 0 => 'icones_img_texte' // défaut. |
|
| 161 | - /*init*/, |
|
| 162 | - 1 => 'icones_texte', |
|
| 163 | - 2 => 'icones_img_texte', |
|
| 164 | - 3 => 'icones_img' |
|
| 165 | - ]; |
|
| 159 | + $display_modes = [ |
|
| 160 | + 0 => 'icones_img_texte' // défaut. |
|
| 161 | + /*init*/, |
|
| 162 | + 1 => 'icones_texte', |
|
| 163 | + 2 => 'icones_img_texte', |
|
| 164 | + 3 => 'icones_img' |
|
| 165 | + ]; |
|
| 166 | 166 | |
| 167 | - $prefs = $GLOBALS['visiteur_session']['prefs'] ?? []; |
|
| 167 | + $prefs = $GLOBALS['visiteur_session']['prefs'] ?? []; |
|
| 168 | 168 | |
| 169 | - $display_mode = $display_modes[(int) ($prefs['display'] ?? 0)] ?? $display_modes[0]; |
|
| 170 | - $spip_display_navigation = isset($prefs['display_navigation']) ? spip_sanitize_classname($prefs['display_navigation']) : 'navigation_avec_icones'; |
|
| 169 | + $display_mode = $display_modes[(int) ($prefs['display'] ?? 0)] ?? $display_modes[0]; |
|
| 170 | + $spip_display_navigation = isset($prefs['display_navigation']) ? spip_sanitize_classname($prefs['display_navigation']) : 'navigation_avec_icones'; |
|
| 171 | 171 | |
| 172 | - $couleur = (int) ($prefs['couleur'] ?? 2); |
|
| 172 | + $couleur = (int) ($prefs['couleur'] ?? 2); |
|
| 173 | 173 | |
| 174 | - $classes = "spip-theme-colors-$couleur $spip_display_navigation $display_mode"; |
|
| 175 | - return spip_sanitize_classname($classes); |
|
| 174 | + $classes = "spip-theme-colors-$couleur $spip_display_navigation $display_mode"; |
|
| 175 | + return spip_sanitize_classname($classes); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | |
@@ -183,5 +183,5 @@ discard block |
||
| 183 | 183 | * @return string |
| 184 | 184 | */ |
| 185 | 185 | function auteurs_recemment_connectes($id_auteur) { |
| 186 | - return recuperer_fond('prive/objets/liste/auteurs_enligne'); |
|
| 186 | + return recuperer_fond('prive/objets/liste/auteurs_enligne'); |
|
| 187 | 187 | } |
@@ -813,9 +813,9 @@ |
||
| 813 | 813 | if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) { |
| 814 | 814 | define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))'); |
| 815 | 815 | } |
| 816 | - $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')'; |
|
| 816 | + $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml('._TRAITEMENT_RACCOURCIS.')'; |
|
| 817 | 817 | $GLOBALS['table_des_traitements']['NOM_SITE']['auteurs'] = 'entites_html(%s)'; |
| 818 | - $GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml(' . _TRAITEMENT_TYPO_SANS_NUMERO . ')'; |
|
| 818 | + $GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml('._TRAITEMENT_TYPO_SANS_NUMERO.')'; |
|
| 819 | 819 | $GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS; |
| 820 | 820 | $GLOBALS['table_des_traitements']['DATE'][] = 'normaliser_date(%s)'; |
| 821 | 821 | $GLOBALS['table_des_traitements']['DATE_REDAC'][] = 'normaliser_date(%s)'; |
@@ -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 | |
@@ -48,90 +48,90 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | function declarer_interfaces() { |
| 50 | 50 | |
| 51 | - $GLOBALS['table_des_tables']['articles'] = 'articles'; |
|
| 52 | - $GLOBALS['table_des_tables']['auteurs'] = 'auteurs'; |
|
| 53 | - $GLOBALS['table_des_tables']['rubriques'] = 'rubriques'; |
|
| 54 | - $GLOBALS['table_des_tables']['hierarchie'] = 'rubriques'; |
|
| 55 | - |
|
| 56 | - // definition des statuts de publication |
|
| 57 | - $GLOBALS['table_statut'] = []; |
|
| 58 | - |
|
| 59 | - // |
|
| 60 | - // tableau des tables de jointures |
|
| 61 | - // Ex: gestion du critere {id_mot} dans la boucle(ARTICLES) |
|
| 62 | - $GLOBALS['tables_jointures'] = []; |
|
| 63 | - $GLOBALS['tables_jointures']['spip_jobs'][] = 'jobs_liens'; |
|
| 64 | - |
|
| 65 | - // $GLOBALS['exceptions_des_jointures']['titre_mot'] = array('spip_mots', 'titre'); // pour exemple |
|
| 66 | - $GLOBALS['exceptions_des_jointures']['profondeur'] = ['spip_rubriques', 'profondeur']; |
|
| 67 | - |
|
| 68 | - |
|
| 69 | - if (!defined('_TRAITEMENT_TYPO')) { |
|
| 70 | - define('_TRAITEMENT_TYPO', 'typo(%s, "TYPO", $connect, $Pile[0])'); |
|
| 71 | - } |
|
| 72 | - if (!defined('_TRAITEMENT_RACCOURCIS')) { |
|
| 73 | - define('_TRAITEMENT_RACCOURCIS', 'propre(%s, $connect, $Pile[0])'); |
|
| 74 | - } |
|
| 75 | - if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) { |
|
| 76 | - define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))'); |
|
| 77 | - } |
|
| 78 | - $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')'; |
|
| 79 | - $GLOBALS['table_des_traitements']['NOM_SITE']['auteurs'] = 'entites_html(%s)'; |
|
| 80 | - $GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml(' . _TRAITEMENT_TYPO_SANS_NUMERO . ')'; |
|
| 81 | - $GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS; |
|
| 82 | - $GLOBALS['table_des_traitements']['DATE'][] = 'normaliser_date(%s)'; |
|
| 83 | - $GLOBALS['table_des_traitements']['DATE_REDAC'][] = 'normaliser_date(%s)'; |
|
| 84 | - $GLOBALS['table_des_traitements']['DATE_MODIF'][] = 'normaliser_date(%s)'; |
|
| 85 | - $GLOBALS['table_des_traitements']['DATE_NOUVEAUTES'][] = 'normaliser_date(%s)'; |
|
| 86 | - $GLOBALS['table_des_traitements']['DESCRIPTIF'][] = _TRAITEMENT_RACCOURCIS; |
|
| 87 | - $GLOBALS['table_des_traitements']['INTRODUCTION'][] = _TRAITEMENT_RACCOURCIS; |
|
| 88 | - $GLOBALS['table_des_traitements']['NOM_SITE_SPIP'][] = _TRAITEMENT_TYPO; |
|
| 89 | - $GLOBALS['table_des_traitements']['NOM'][] = _TRAITEMENT_TYPO_SANS_NUMERO; |
|
| 90 | - $GLOBALS['table_des_traitements']['AUTEUR'][] = _TRAITEMENT_TYPO; |
|
| 91 | - $GLOBALS['table_des_traitements']['PS'][] = _TRAITEMENT_RACCOURCIS; |
|
| 92 | - $GLOBALS['table_des_traitements']['SOURCE'][] = _TRAITEMENT_TYPO; |
|
| 93 | - $GLOBALS['table_des_traitements']['SOUSTITRE'][] = _TRAITEMENT_TYPO; |
|
| 94 | - $GLOBALS['table_des_traitements']['SURTITRE'][] = _TRAITEMENT_TYPO; |
|
| 95 | - $GLOBALS['table_des_traitements']['TAGS'][] = '%s'; |
|
| 96 | - $GLOBALS['table_des_traitements']['TEXTE'][] = _TRAITEMENT_RACCOURCIS; |
|
| 97 | - $GLOBALS['table_des_traitements']['TITRE'][] = _TRAITEMENT_TYPO_SANS_NUMERO; |
|
| 98 | - $GLOBALS['table_des_traitements']['TYPE'][] = _TRAITEMENT_TYPO; |
|
| 99 | - $GLOBALS['table_des_traitements']['DESCRIPTIF_SITE_SPIP'][] = _TRAITEMENT_RACCOURCIS; |
|
| 100 | - $GLOBALS['table_des_traitements']['SLOGAN_SITE_SPIP'][] = _TRAITEMENT_TYPO; |
|
| 101 | - $GLOBALS['table_des_traitements']['ENV'][] = 'entites_html(%s,true)'; |
|
| 102 | - |
|
| 103 | - // valeur par defaut pour les balises non listees ci-dessus |
|
| 104 | - $GLOBALS['table_des_traitements']['*'][] = false; // pas de traitement, mais permet au compilo de trouver la declaration suivante |
|
| 105 | - // toujours securiser les DATA |
|
| 106 | - $GLOBALS['table_des_traitements']['*']['DATA'] = 'safehtml(%s)'; |
|
| 107 | - // expliciter pour VALEUR qui est un champ calcule et ne sera pas protege par le catch-all * |
|
| 108 | - $GLOBALS['table_des_traitements']['VALEUR']['DATA'] = 'safehtml(%s)'; |
|
| 109 | - |
|
| 110 | - |
|
| 111 | - // gerer l'affectation en 2 temps car si le pipe n'est pas encore declare, on ecrase les globales |
|
| 112 | - $interfaces = pipeline( |
|
| 113 | - 'declarer_tables_interfaces', |
|
| 114 | - [ |
|
| 115 | - 'table_des_tables' => $GLOBALS['table_des_tables'], |
|
| 116 | - 'exceptions_des_tables' => $GLOBALS['exceptions_des_tables'], |
|
| 117 | - 'table_date' => $GLOBALS['table_date'], |
|
| 118 | - 'table_titre' => $GLOBALS['table_titre'], |
|
| 119 | - 'tables_jointures' => $GLOBALS['tables_jointures'], |
|
| 120 | - 'exceptions_des_jointures' => $GLOBALS['exceptions_des_jointures'], |
|
| 121 | - 'table_des_traitements' => $GLOBALS['table_des_traitements'], |
|
| 122 | - 'table_statut' => $GLOBALS['table_statut'], |
|
| 123 | - ] |
|
| 124 | - ); |
|
| 125 | - if ($interfaces) { |
|
| 126 | - $GLOBALS['table_des_tables'] = $interfaces['table_des_tables']; |
|
| 127 | - $GLOBALS['exceptions_des_tables'] = $interfaces['exceptions_des_tables']; |
|
| 128 | - $GLOBALS['table_date'] = $interfaces['table_date']; |
|
| 129 | - $GLOBALS['table_titre'] = $interfaces['table_titre']; |
|
| 130 | - $GLOBALS['tables_jointures'] = $interfaces['tables_jointures']; |
|
| 131 | - $GLOBALS['exceptions_des_jointures'] = $interfaces['exceptions_des_jointures']; |
|
| 132 | - $GLOBALS['table_des_traitements'] = $interfaces['table_des_traitements']; |
|
| 133 | - $GLOBALS['table_statut'] = $interfaces['table_statut']; |
|
| 134 | - } |
|
| 51 | + $GLOBALS['table_des_tables']['articles'] = 'articles'; |
|
| 52 | + $GLOBALS['table_des_tables']['auteurs'] = 'auteurs'; |
|
| 53 | + $GLOBALS['table_des_tables']['rubriques'] = 'rubriques'; |
|
| 54 | + $GLOBALS['table_des_tables']['hierarchie'] = 'rubriques'; |
|
| 55 | + |
|
| 56 | + // definition des statuts de publication |
|
| 57 | + $GLOBALS['table_statut'] = []; |
|
| 58 | + |
|
| 59 | + // |
|
| 60 | + // tableau des tables de jointures |
|
| 61 | + // Ex: gestion du critere {id_mot} dans la boucle(ARTICLES) |
|
| 62 | + $GLOBALS['tables_jointures'] = []; |
|
| 63 | + $GLOBALS['tables_jointures']['spip_jobs'][] = 'jobs_liens'; |
|
| 64 | + |
|
| 65 | + // $GLOBALS['exceptions_des_jointures']['titre_mot'] = array('spip_mots', 'titre'); // pour exemple |
|
| 66 | + $GLOBALS['exceptions_des_jointures']['profondeur'] = ['spip_rubriques', 'profondeur']; |
|
| 67 | + |
|
| 68 | + |
|
| 69 | + if (!defined('_TRAITEMENT_TYPO')) { |
|
| 70 | + define('_TRAITEMENT_TYPO', 'typo(%s, "TYPO", $connect, $Pile[0])'); |
|
| 71 | + } |
|
| 72 | + if (!defined('_TRAITEMENT_RACCOURCIS')) { |
|
| 73 | + define('_TRAITEMENT_RACCOURCIS', 'propre(%s, $connect, $Pile[0])'); |
|
| 74 | + } |
|
| 75 | + if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) { |
|
| 76 | + define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))'); |
|
| 77 | + } |
|
| 78 | + $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')'; |
|
| 79 | + $GLOBALS['table_des_traitements']['NOM_SITE']['auteurs'] = 'entites_html(%s)'; |
|
| 80 | + $GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml(' . _TRAITEMENT_TYPO_SANS_NUMERO . ')'; |
|
| 81 | + $GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS; |
|
| 82 | + $GLOBALS['table_des_traitements']['DATE'][] = 'normaliser_date(%s)'; |
|
| 83 | + $GLOBALS['table_des_traitements']['DATE_REDAC'][] = 'normaliser_date(%s)'; |
|
| 84 | + $GLOBALS['table_des_traitements']['DATE_MODIF'][] = 'normaliser_date(%s)'; |
|
| 85 | + $GLOBALS['table_des_traitements']['DATE_NOUVEAUTES'][] = 'normaliser_date(%s)'; |
|
| 86 | + $GLOBALS['table_des_traitements']['DESCRIPTIF'][] = _TRAITEMENT_RACCOURCIS; |
|
| 87 | + $GLOBALS['table_des_traitements']['INTRODUCTION'][] = _TRAITEMENT_RACCOURCIS; |
|
| 88 | + $GLOBALS['table_des_traitements']['NOM_SITE_SPIP'][] = _TRAITEMENT_TYPO; |
|
| 89 | + $GLOBALS['table_des_traitements']['NOM'][] = _TRAITEMENT_TYPO_SANS_NUMERO; |
|
| 90 | + $GLOBALS['table_des_traitements']['AUTEUR'][] = _TRAITEMENT_TYPO; |
|
| 91 | + $GLOBALS['table_des_traitements']['PS'][] = _TRAITEMENT_RACCOURCIS; |
|
| 92 | + $GLOBALS['table_des_traitements']['SOURCE'][] = _TRAITEMENT_TYPO; |
|
| 93 | + $GLOBALS['table_des_traitements']['SOUSTITRE'][] = _TRAITEMENT_TYPO; |
|
| 94 | + $GLOBALS['table_des_traitements']['SURTITRE'][] = _TRAITEMENT_TYPO; |
|
| 95 | + $GLOBALS['table_des_traitements']['TAGS'][] = '%s'; |
|
| 96 | + $GLOBALS['table_des_traitements']['TEXTE'][] = _TRAITEMENT_RACCOURCIS; |
|
| 97 | + $GLOBALS['table_des_traitements']['TITRE'][] = _TRAITEMENT_TYPO_SANS_NUMERO; |
|
| 98 | + $GLOBALS['table_des_traitements']['TYPE'][] = _TRAITEMENT_TYPO; |
|
| 99 | + $GLOBALS['table_des_traitements']['DESCRIPTIF_SITE_SPIP'][] = _TRAITEMENT_RACCOURCIS; |
|
| 100 | + $GLOBALS['table_des_traitements']['SLOGAN_SITE_SPIP'][] = _TRAITEMENT_TYPO; |
|
| 101 | + $GLOBALS['table_des_traitements']['ENV'][] = 'entites_html(%s,true)'; |
|
| 102 | + |
|
| 103 | + // valeur par defaut pour les balises non listees ci-dessus |
|
| 104 | + $GLOBALS['table_des_traitements']['*'][] = false; // pas de traitement, mais permet au compilo de trouver la declaration suivante |
|
| 105 | + // toujours securiser les DATA |
|
| 106 | + $GLOBALS['table_des_traitements']['*']['DATA'] = 'safehtml(%s)'; |
|
| 107 | + // expliciter pour VALEUR qui est un champ calcule et ne sera pas protege par le catch-all * |
|
| 108 | + $GLOBALS['table_des_traitements']['VALEUR']['DATA'] = 'safehtml(%s)'; |
|
| 109 | + |
|
| 110 | + |
|
| 111 | + // gerer l'affectation en 2 temps car si le pipe n'est pas encore declare, on ecrase les globales |
|
| 112 | + $interfaces = pipeline( |
|
| 113 | + 'declarer_tables_interfaces', |
|
| 114 | + [ |
|
| 115 | + 'table_des_tables' => $GLOBALS['table_des_tables'], |
|
| 116 | + 'exceptions_des_tables' => $GLOBALS['exceptions_des_tables'], |
|
| 117 | + 'table_date' => $GLOBALS['table_date'], |
|
| 118 | + 'table_titre' => $GLOBALS['table_titre'], |
|
| 119 | + 'tables_jointures' => $GLOBALS['tables_jointures'], |
|
| 120 | + 'exceptions_des_jointures' => $GLOBALS['exceptions_des_jointures'], |
|
| 121 | + 'table_des_traitements' => $GLOBALS['table_des_traitements'], |
|
| 122 | + 'table_statut' => $GLOBALS['table_statut'], |
|
| 123 | + ] |
|
| 124 | + ); |
|
| 125 | + if ($interfaces) { |
|
| 126 | + $GLOBALS['table_des_tables'] = $interfaces['table_des_tables']; |
|
| 127 | + $GLOBALS['exceptions_des_tables'] = $interfaces['exceptions_des_tables']; |
|
| 128 | + $GLOBALS['table_date'] = $interfaces['table_date']; |
|
| 129 | + $GLOBALS['table_titre'] = $interfaces['table_titre']; |
|
| 130 | + $GLOBALS['tables_jointures'] = $interfaces['tables_jointures']; |
|
| 131 | + $GLOBALS['exceptions_des_jointures'] = $interfaces['exceptions_des_jointures']; |
|
| 132 | + $GLOBALS['table_des_traitements'] = $interfaces['table_des_traitements']; |
|
| 133 | + $GLOBALS['table_statut'] = $interfaces['table_statut']; |
|
| 134 | + } |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | declarer_interfaces(); |
@@ -19,21 +19,21 @@ discard block |
||
| 19 | 19 | * @package SPIP\Core\SQL\Upgrade |
| 20 | 20 | **/ |
| 21 | 21 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 22 | - return; |
|
| 22 | + return; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $GLOBALS['maj'][2021_02_18_00] = [ |
| 26 | - ['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL" ], |
|
| 27 | - ['sql_updateq', 'spip_auteurs', ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL" ], |
|
| 26 | + ['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL" ], |
|
| 27 | + ['sql_updateq', 'spip_auteurs', ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL" ], |
|
| 28 | 28 | ]; |
| 29 | 29 | |
| 30 | 30 | $GLOBALS['maj'][2022_02_23_02] = [ |
| 31 | - ['sql_alter', "TABLE spip_auteurs ADD backup_cles mediumtext DEFAULT '' NOT NULL" ], |
|
| 32 | - ['sql_delete', 'spip_meta', "nom='secret_du_site'" ], |
|
| 31 | + ['sql_alter', "TABLE spip_auteurs ADD backup_cles mediumtext DEFAULT '' NOT NULL" ], |
|
| 32 | + ['sql_delete', 'spip_meta', "nom='secret_du_site'" ], |
|
| 33 | 33 | ]; |
| 34 | 34 | |
| 35 | 35 | $GLOBALS['maj'][2022_02_23_03] = [ |
| 36 | - ['maj2021_supprimer_toutes_sessions_si_aucun_backup_cles'], |
|
| 36 | + ['maj2021_supprimer_toutes_sessions_si_aucun_backup_cles'], |
|
| 37 | 37 | ]; |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -44,15 +44,15 @@ discard block |
||
| 44 | 44 | * - les autres auteurs vont tous regénérer un mot de passe plus sécure au premier login |
| 45 | 45 | **/ |
| 46 | 46 | function maj2021_supprimer_toutes_sessions_si_aucun_backup_cles() { |
| 47 | - if (!sql_countsel('spip_auteurs', "webmestre='oui' AND backup_cles!=''")) { |
|
| 48 | - spip_log('supprimer sessions auteur', 'maj'); |
|
| 49 | - if ($dir = opendir(_DIR_SESSIONS)) { |
|
| 50 | - while (($f = readdir($dir)) !== false) { |
|
| 51 | - spip_unlink(_DIR_SESSIONS . $f); |
|
| 52 | - if (time() >= _TIME_OUT) { |
|
| 53 | - return; |
|
| 54 | - } |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - } |
|
| 47 | + if (!sql_countsel('spip_auteurs', "webmestre='oui' AND backup_cles!=''")) { |
|
| 48 | + spip_log('supprimer sessions auteur', 'maj'); |
|
| 49 | + if ($dir = opendir(_DIR_SESSIONS)) { |
|
| 50 | + while (($f = readdir($dir)) !== false) { |
|
| 51 | + spip_unlink(_DIR_SESSIONS . $f); |
|
| 52 | + if (time() >= _TIME_OUT) { |
|
| 53 | + return; |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $GLOBALS['maj'][2021_02_18_00] = [ |
| 26 | - ['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL" ], |
|
| 27 | - ['sql_updateq', 'spip_auteurs', ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL" ], |
|
| 26 | + ['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL"], |
|
| 27 | + ['sql_updateq', 'spip_auteurs', ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL"], |
|
| 28 | 28 | ]; |
| 29 | 29 | |
| 30 | 30 | $GLOBALS['maj'][2022_02_23_02] = [ |
| 31 | - ['sql_alter', "TABLE spip_auteurs ADD backup_cles mediumtext DEFAULT '' NOT NULL" ], |
|
| 32 | - ['sql_delete', 'spip_meta', "nom='secret_du_site'" ], |
|
| 31 | + ['sql_alter', "TABLE spip_auteurs ADD backup_cles mediumtext DEFAULT '' NOT NULL"], |
|
| 32 | + ['sql_delete', 'spip_meta', "nom='secret_du_site'"], |
|
| 33 | 33 | ]; |
| 34 | 34 | |
| 35 | 35 | $GLOBALS['maj'][2022_02_23_03] = [ |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | spip_log('supprimer sessions auteur', 'maj'); |
| 49 | 49 | if ($dir = opendir(_DIR_SESSIONS)) { |
| 50 | 50 | while (($f = readdir($dir)) !== false) { |
| 51 | - spip_unlink(_DIR_SESSIONS . $f); |
|
| 51 | + spip_unlink(_DIR_SESSIONS.$f); |
|
| 52 | 52 | if (time() >= _TIME_OUT) { |
| 53 | 53 | return; |
| 54 | 54 | } |