Overview
Comment: | Merge avec trunk |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
22c90a3c3f1ccbd763b13ecb8750e0a7 |
User & Date: | bohwaz on 2020-02-29 23:17:57 |
Other Links: | branch diff | manifest | tags |
Context
2020-02-29
| ||
23:18 | Nouvelle version seulement compatible avec PHP 7.2+ check-in: 2f79c24d5f user: bohwaz tags: dev | |
23:17 | Merge avec trunk check-in: 22c90a3c3f user: bohwaz tags: dev | |
23:15 | Limiter la taille des blobs check-in: 1c80667228 user: bohwaz tags: trunk, stable | |
2020-01-31
| ||
00:23 | Correctif PHP 7.4: référence à une variable nulle check-in: 83f694001d user: bohwaz tags: dev | |
Changes
Modified .travis.yml from [0926a200f2] to [ab9c965cec].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
language: php php: - '5.4' - '5.5' - '5.6' - '7.0' - '7.1' - hhvm install: - make -C src deps script: - php tests/run.php |
< < | > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
language: php php: - '5.6' - '7.0' - '7.1' - '7.2' - '7.3' - '7.4' install: - make -C src deps script: - php tests/run.php |
Modified src/include/lib/Garradin/Fichiers.php from [da93696715] to [630c28763b].
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
throw new UserException('Fichier reçu invalide : vide ou sans nom de fichier.'); } if (!is_uploaded_file($file['tmp_name'])) { throw new \RuntimeException('Le fichier n\'a pas été envoyé de manière conventionnelle.'); } $name = preg_replace('/\s+/', '_', $file['name']); $name = preg_replace('/[^\d\w._-]/ui', '', $name); return self::storeFile($name, $file['tmp_name']); } /** * Upload de fichier à partir d'une chaîne en base64 * @param string $name * @param string $content * @return Fichiers */ |
> > > > > > > > > > > > > > > > > > > > > > > |
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
throw new UserException('Fichier reçu invalide : vide ou sans nom de fichier.'); } if (!is_uploaded_file($file['tmp_name'])) { throw new \RuntimeException('Le fichier n\'a pas été envoyé de manière conventionnelle.'); } $max_blob_size = self::getMaxBlobSize(); // Vérifier que le fichier peut rentrer en base de données (dans PHP < 7.2 on n'utilise pas openBlob) if (null !== $max_blob_size && $file['size'] > $max_blob_size) { unlink($file['tmp_name']); throw new UserException('Taille du fichier supérieure au maximum autorisé en base de données'); } $name = preg_replace('/\s+/', '_', $file['name']); $name = preg_replace('/[^\d\w._-]/ui', '', $name); return self::storeFile($name, $file['tmp_name']); } /** * Returns the maximum value size that can be handled by a bindValue * @return null|integer */ static public function getMaxBlobSize() { $memory_limit = Utils::return_bytes(ini_get('memory_limit')); if (!$memory_limit) { return null; } return round(($memory_limit - memory_get_usage()) * 0.9); } /** * Upload de fichier à partir d'une chaîne en base64 * @param string $name * @param string $content * @return Fichiers */ |
Modified src/include/lib/Garradin/Membres/Cotisations.php from [faff4a2165] to [181b05f93d].
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
...
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
default:
$order = 'cm.id_membre';
break;
}
$desc = $desc ? 'DESC' : 'ASC';
return $db->get('SELECT cm.id_membre, cm.date, cm.id, m.numero,
m.'.$champ_id.' AS nom, c.montant,
CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\') >= date()
WHEN c.fin IS NOT NULL THEN (cm.date <= c.fin AND cm.date >= c.debut)
ELSE 1 END AS a_jour
FROM cotisations_membres AS cm
INNER JOIN cotisations AS c ON c.id = cm.id_cotisation
INNER JOIN membres AS m ON m.id = cm.id_membre
................................................................................
* @param integer $id Numéro de membre
* @return array Liste des cotisations en cours de validité
*/
public function listSubscriptionsForMember($id)
{
$db = DB::getInstance();
return $db->get('SELECT c.*,
CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\') >= date()
WHEN c.fin IS NOT NULL THEN (cm.id IS NOT NULL AND cm.date <= c.fin AND cm.date >= c.debut)
WHEN cm.id IS NOT NULL THEN 1 ELSE 0 END AS a_jour,
CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\')
WHEN c.fin IS NOT NULL THEN c.fin ELSE 1 END AS expiration,
(julianday(date()) - julianday(CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\')
WHEN c.fin IS NOT NULL THEN c.fin END)) AS nb_jours
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
...
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
|
default: $order = 'cm.id_membre'; break; } $desc = $desc ? 'DESC' : 'ASC'; // Renvoyer la liste avec tous les membres des catégories dont la cotisation obligatoire est celle-ci if ($include_category) { $cats_obligatoires = $db->getAssoc('SELECT id, id FROM membres_categories WHERE id_cotisation_obligatoire = ? AND cacher = 0;', $id); return $db->get('SELECT m.id AS id_membre, MAX(cm.date), cm.id, m.numero, m.'.$champ_id.' AS nom, c.montant, CASE WHEN cm.id IS NULL THEN 0 WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\') >= date() WHEN c.fin IS NOT NULL THEN (cm.date <= c.fin AND cm.date >= c.debut) ELSE 1 END AS a_jour FROM membres AS m LEFT JOIN cotisations_membres AS cm ON cm.id_membre = m.id AND cm.id_cotisation = ? LEFT JOIN cotisations AS c ON c.id = cm.id_cotisation WHERE '.$db->where('m.id_categorie', $cats_obligatoires) . ' GROUP BY m.id ORDER BY '.$order.' '.$desc.' LIMIT ?,?;', $id, $begin, self::ITEMS_PER_PAGE); } return $db->get('SELECT cm.id_membre, MAX(cm.date), cm.id, m.numero, m.'.$champ_id.' AS nom, c.montant, CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\') >= date() WHEN c.fin IS NOT NULL THEN (cm.date <= c.fin AND cm.date >= c.debut) ELSE 1 END AS a_jour FROM cotisations_membres AS cm INNER JOIN cotisations AS c ON c.id = cm.id_cotisation INNER JOIN membres AS m ON m.id = cm.id_membre ................................................................................ * @param integer $id Numéro de membre * @return array Liste des cotisations en cours de validité */ public function listSubscriptionsForMember($id) { $db = DB::getInstance(); return $db->get('SELECT c.*, MAX(cm.date), CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\') >= date() WHEN c.fin IS NOT NULL THEN (cm.id IS NOT NULL AND cm.date <= c.fin AND cm.date >= c.debut) WHEN cm.id IS NOT NULL THEN 1 ELSE 0 END AS a_jour, CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\') WHEN c.fin IS NOT NULL THEN c.fin ELSE 1 END AS expiration, (julianday(date()) - julianday(CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\') WHEN c.fin IS NOT NULL THEN c.fin END)) AS nb_jours |
Modified src/include/lib/Garradin/Squelette_Filtres.php from [719077c361] to [4ef78402d4].
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
...
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
} // Compatibilité SPIP static public function egal_a($value, $test) { if ($value == $test) return $value; else return false; } static public function different_de($value, $test) { if ($value != $test) return $value; else return false; } // disponible aussi avec : | ?{sioui, sinon} static public function choixsivide($value, $un, $deux = '') { ................................................................................ static public function date_w3c($date) { return date(DATE_W3C, $date); } static public function et($value, $test) { return ($value && $test) ? $value : false; } static public function ou($value, $test) { return ($value || $test) ? $value : false; } static public function xou($value, $test) { return ($value XOR $test) ? $value : false; } static public function oui($value) { return $value ? ' ' : false; } static public function non($value) { return !$value ? ' ' : false; } static public function superieur_a($value, $test) { return ($value > $test) ? $value : false; } static public function superieur_ou_egal_a($value, $test) { return ($value >= $test) ? $value : false; } static public function inferieur_a($value, $test) { return ($value < $test) ? $value : false; } static public function inferieur_ou_egal_a($value, $test) { return ($value <= $test) ? $value : false; } static public function euros($value) { return str_replace(' ', ' ', number_format($value, (round($value) == round($value, 2) ? 0 : 2), ',', ' ')) . ' €'; } static public function taille_en_octets($value) { return Utils::format_bytes($value); } } |
|
|
|
|
|
|
|
|
|
|
|
|
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
...
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
} // Compatibilité SPIP static public function egal_a($value, $test) { if ($value == $test) return true; else return false; } static public function different_de($value, $test) { if ($value != $test) return true; else return false; } // disponible aussi avec : | ?{sioui, sinon} static public function choixsivide($value, $un, $deux = '') { ................................................................................ static public function date_w3c($date) { return date(DATE_W3C, $date); } static public function et($value, $test) { return ($value && $test) ? true : false; } static public function ou($value, $test) { return ($value || $test) ? true : false; } static public function xou($value, $test) { return ($value XOR $test) ? true : false; } static public function oui($value) { return $value ? true : false; } static public function non($value) { return !$value ? true : false; } static public function superieur_a($value, $test) { return ($value > $test) ? true : false; } static public function superieur_ou_egal_a($value, $test) { return ($value >= $test) ? true : false; } static public function inferieur_a($value, $test) { return ($value < $test) ? true : false; } static public function inferieur_ou_egal_a($value, $test) { return ($value <= $test) ? true : false; } static public function euros($value) { return str_replace(' ', ' ', number_format($value, (round($value) == round($value, 2) ? 0 : 2), ',', ' ')) . ' €'; } static public function taille_en_octets($value) { return Utils::format_bytes($value); } } |