Overview
Comment: | Correction avertissements PHPstan |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
72996fb296685a6343bde83f27bbb9a8 |
User & Date: | bohwaz on 2019-02-20 11:27:17 |
Other Links: | branch diff | manifest | tags |
Context
2019-02-20
| ||
14:52 | Amélioration CSS impression des comptes check-in: e051639aca user: bohwaz tags: dev | |
11:27 | Correction avertissements PHPstan check-in: 72996fb296 user: bohwaz tags: dev | |
2019-02-19
| ||
16:55 | Corrections mineures check-in: acf4eb6f46 user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Fichiers.php from [a7b430ca57] to [da93696715].
︙ | ︙ | |||
583 584 585 586 587 588 589 | } /** * Récupère la liste des fichiers liés à une ressource * * @param string $type Type de ressource * @param integer $id Numéro de ressource | | | | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | } /** * Récupère la liste des fichiers liés à une ressource * * @param string $type Type de ressource * @param integer $id Numéro de ressource * @param boolean|null $images TRUE pour retourner seulement les images, * FALSE pour retourner les fichiers sans images, NULL pour tout retourner * @return array Liste des fichiers */ static public function listLinkedFiles($type, $id, $images = null) { $check = [self::LIEN_MEMBRES, self::LIEN_WIKI, self::LIEN_COMPTA]; if (!in_array($type, $check)) { throw new \LogicException('Type de lien de fichier inconnu.'); } |
︙ | ︙ |
Modified src/include/lib/Garradin/Plugin.php from [c8fa206532] to [12668c1cfe].
︙ | ︙ | |||
528 529 530 531 532 533 534 | 'disable_compression' => true, ] ]; $context = stream_context_create($context_options); try { | | | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | 'disable_compression' => true, ] ]; $context = stream_context_create($context_options); try { $result = file_get_contents(PLUGINS_URL, false, $context); } catch (\Exception $e) { throw new UserException('Le téléchargement de la liste des plugins a échoué : ' . $e->getMessage()); } Static_Cache::store('plugins_list', $result); |
︙ | ︙ |
Modified src/include/lib/Garradin/Sauvegarde.php from [df83bd896f] to [7513189b78].
︙ | ︙ | |||
235 236 237 238 239 240 241 | } return $r; } /** * Vérifie l'intégrité d'une sauvegarde Garradin | | | | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | } return $r; } /** * Vérifie l'intégrité d'une sauvegarde Garradin * @param string $file_path Chemin absolu vers la base de donnée * @return boolean|null */ protected function checkIntegrity($file_path, $remove_hash = true) { $size = filesize($file_path); $fp = fopen($file_path, 'r+'); $header = fread($fp, 16); |
︙ | ︙ |
Modified src/include/lib/Garradin/Utils.php from [1256acee6e] to [ac43981659].
︙ | ︙ | |||
214 215 216 217 218 219 220 | * $listLength représente la longueur d'items de la pagination à génerer * * @param int $current * @param int $total * @param int $bypage * @param int $listLength * @param bool $showLast Toggle l'affichage du dernier élément de la pagination | | | | | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | * $listLength représente la longueur d'items de la pagination à génerer * * @param int $current * @param int $total * @param int $bypage * @param int $listLength * @param bool $showLast Toggle l'affichage du dernier élément de la pagination * @return array|null */ public static function getGenericPagination($current, $total, $bypage, $listLength=11, $showLast = true) { if ($total <= $bypage) return null; $total = ceil($total / $bypage); if ($total < $current) return null; $length = ($listLength / 2); $begin = $current - ceil($length); if ($begin < 1) { $begin = 1; |
︙ | ︙ | |||
406 407 408 409 410 411 412 | static public function safe_unlink($path) { if (!@unlink($path)) { return true; } | | | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | static public function safe_unlink($path) { if (!@unlink($path)) { return true; } if (!file_exists($path)) { return true; } throw new \RuntimeException(sprintf('Impossible de supprimer le fichier %s: %s', $path, error_get_last())); |
︙ | ︙ | |||
431 432 433 434 435 436 437 | return Security::getRandomPassphrase(ROOT . '/include/data/dictionary.fr'); } static public function checkIBAN($value) { // Enlever les caractères indésirables (espaces, tirets), $value = preg_replace('/[^A-Z0-9]/', '', strtoupper($value)); | | | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | return Security::getRandomPassphrase(ROOT . '/include/data/dictionary.fr'); } static public function checkIBAN($value) { // Enlever les caractères indésirables (espaces, tirets), $value = preg_replace('/[^A-Z0-9]/', '', strtoupper($value)); // Supprimer les 4 premiers caractères et les replacer à la fin du compte $value = substr($value, 4) . substr($value, 0, 4); // Remplacer les lettres par des chiffres au moyen d'une table de conversion (A=10, B=11, C=12 etc.) $value = str_replace(range('A', 'Z'), range(10, 35), $value); // Diviser le nombre ainsi obtenu par 97 |
︙ | ︙ | |||
564 565 566 567 568 569 570 | case 'G': case 'g': return (int)$size_str * pow(1024, 3); case 'M': case 'm': return (int)$size_str * pow(1024, 2); case 'K': case 'k': return (int)$size_str * 1024; default: return $size_str; } } | | > | | | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | case 'G': case 'g': return (int)$size_str * pow(1024, 3); case 'M': case 'm': return (int)$size_str * pow(1024, 2); case 'K': case 'k': return (int)$size_str * 1024; default: return $size_str; } } static public function format_bytes($size) { if ($size > (1024 * 1024)) return number_format(round($size / 1024 / 1024, 2), 2, ',', '') . ' Mo'; elseif ($size > 1024) return round($size / 1024) . ' Ko'; else return $size . ' o'; } static public function deleteRecursive($path) { if (!file_exists($path)) |
︙ | ︙ |