@@ -267,8 +267,7 @@ discard block |
||
| 267 | 267 | if ($id === '*') { |
| 268 | 268 | unset($GLOBALS['autoriser_exception'][$faire][$type]); |
| 269 | 269 | unset($autorisation[$faire][$type]); |
| 270 | - } |
|
| 271 | - else { |
|
| 270 | + } else { |
|
| 272 | 271 | unset($GLOBALS['autoriser_exception'][$faire][$type][$id]); |
| 273 | 272 | unset($autorisation[$faire][$type][$id]); |
| 274 | 273 | } |
@@ -652,8 +651,7 @@ discard block |
||
| 652 | 651 | function autoriser_rubrique_creer_dist(string $faire, string $type, $id, array $qui, array $opt): bool { |
| 653 | 652 | if (!empty($opt['id_parent'])) { |
| 654 | 653 | return autoriser('creerrubriquedans', 'rubrique', $opt['id_parent'], $qui); |
| 655 | - } |
|
| 656 | - else { |
|
| 654 | + } else { |
|
| 657 | 655 | return autoriser('defaut', null, 0, $qui, $opt); |
| 658 | 656 | } |
| 659 | 657 | } |
@@ -814,8 +812,7 @@ discard block |
||
| 814 | 812 | if (!empty($opt['id_parent'])) { |
| 815 | 813 | // creerarticledans rappelle autoriser(creer,article) sans id, donc on verifiera condition du else aussi |
| 816 | 814 | return autoriser('creerarticledans', 'rubrique', $opt['id_parent'], $qui); |
| 817 | - } |
|
| 818 | - else { |
|
| 815 | + } else { |
|
| 819 | 816 | return (sql_countsel('spip_rubriques') > 0 and in_array($qui['statut'], ['0minirezo', '1comite'])); |
| 820 | 817 | } |
| 821 | 818 | } |
@@ -339,8 +339,7 @@ |
||
| 339 | 339 | if (!autoriser('modifier', $type, intval($id))) { |
| 340 | 340 | $contexte['editable'] = ''; |
| 341 | 341 | } |
| 342 | - } |
|
| 343 | - else { |
|
| 342 | + } else { |
|
| 344 | 343 | if (!autoriser('creer', $type, 0, null, ['id_parent' => $id_parent])) { |
| 345 | 344 | $contexte['editable'] = ''; |
| 346 | 345 | } |
@@ -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 | |
@@ -121,8 +121,7 @@ discard block |
||
| 121 | 121 | if (!$res or (!$res['length'] and $res['status'] != 304)) { |
| 122 | 122 | spip_log("copie_locale : Echec recuperation $source sur $localrac_tmp status : " . ($res ? $res['status'] : '-'), 'distant' . _LOG_INFO_IMPORTANTE); |
| 123 | 123 | @unlink($localrac_tmp); |
| 124 | - } |
|
| 125 | - else { |
|
| 124 | + } else { |
|
| 126 | 125 | spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant'); |
| 127 | 126 | } |
| 128 | 127 | if (!$res or !$res['length']) { |
@@ -240,8 +239,7 @@ discard block |
||
| 240 | 239 | break; |
| 241 | 240 | } |
| 242 | 241 | } |
| 243 | - } |
|
| 244 | - else { |
|
| 242 | + } else { |
|
| 245 | 243 | $ip = false; |
| 246 | 244 | } |
| 247 | 245 | } |
@@ -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 | } |
@@ -42,8 +42,7 @@ |
||
| 42 | 42 | if ((is_countable($logo) ? count($logo) : 0) < 6) { |
| 43 | 43 | spip_log('Supprimer ancien logo ' . json_encode($logo, JSON_THROW_ON_ERROR), 'logo'); |
| 44 | 44 | spip_unlink($logo[0]); |
| 45 | - } |
|
| 46 | - elseif ( |
|
| 45 | + } elseif ( |
|
| 47 | 46 | $doc = $logo[5] |
| 48 | 47 | and isset($doc['id_document']) |
| 49 | 48 | and $id_document = $doc['id_document'] |
@@ -63,8 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | if (is_null($maxlen)) { |
| 65 | 65 | $image = file_get_contents($fichier); |
| 66 | - } |
|
| 67 | - else { |
|
| 66 | + } else { |
|
| 68 | 67 | $image = file_get_contents($fichier, false, null, 0, $maxlen); |
| 69 | 68 | } |
| 70 | 69 | // est-ce bien une image svg ? |
@@ -190,8 +189,7 @@ discard block |
||
| 190 | 189 | |
| 191 | 190 | if ($start === false or $start === 'end') { |
| 192 | 191 | $svg = str_replace('</svg>', $shapes . '</svg>', $svg); |
| 193 | - } |
|
| 194 | - else { |
|
| 192 | + } else { |
|
| 195 | 193 | $p = stripos($svg, '<svg'); |
| 196 | 194 | $p = strpos($svg, '>', $p); |
| 197 | 195 | $svg = substr_replace($svg, $shapes, $p + 1, 0); |
@@ -253,8 +251,7 @@ discard block |
||
| 253 | 251 | if (strpos($couleur, 'rgb(') === 0) { |
| 254 | 252 | $c = explode(',', substr($couleur, 4)); |
| 255 | 253 | $couleur = _couleur_dec_to_hex(intval($c[0]), intval($c[1]), intval($c[2])); |
| 256 | - } |
|
| 257 | - else { |
|
| 254 | + } else { |
|
| 258 | 255 | $couleur = couleur_html_to_hex($couleur); |
| 259 | 256 | } |
| 260 | 257 | $couleur = '#' . ltrim($couleur, '#'); |
@@ -311,17 +308,14 @@ discard block |
||
| 311 | 308 | // si pas de height valide, on suppose l'image carree |
| 312 | 309 | $viewBox[3] = $width; |
| 313 | 310 | } |
| 314 | - } |
|
| 315 | - else { |
|
| 311 | + } else { |
|
| 316 | 312 | // si on recupere la taille de la viewbox mais si la viewbox est petite on met un multiplicateur pour la taille finale |
| 317 | 313 | $width = $viewBox[2]; |
| 318 | 314 | if ($width < 1) { |
| 319 | 315 | $coeff = max($coeff, 1000); |
| 320 | - } |
|
| 321 | - elseif ($width < 10) { |
|
| 316 | + } elseif ($width < 10) { |
|
| 322 | 317 | $coeff = max($coeff, 100); |
| 323 | - } |
|
| 324 | - elseif ($width < 100) { |
|
| 318 | + } elseif ($width < 100) { |
|
| 325 | 319 | $coeff = max($coeff, 10); |
| 326 | 320 | } |
| 327 | 321 | } |
@@ -334,16 +328,13 @@ discard block |
||
| 334 | 328 | if (empty($attributs['viewBox'])) { |
| 335 | 329 | $viewBox[3] = $height; |
| 336 | 330 | } |
| 337 | - } |
|
| 338 | - else { |
|
| 331 | + } else { |
|
| 339 | 332 | $height = $viewBox[3]; |
| 340 | 333 | if ($height < 1) { |
| 341 | 334 | $coeff = max($coeff, 1000); |
| 342 | - } |
|
| 343 | - elseif ($height < 10) { |
|
| 335 | + } elseif ($height < 10) { |
|
| 344 | 336 | $coeff = max($coeff, 100); |
| 345 | - } |
|
| 346 | - elseif ($height < 100) { |
|
| 337 | + } elseif ($height < 100) { |
|
| 347 | 338 | $coeff = max($coeff, 10); |
| 348 | 339 | } |
| 349 | 340 | } |
@@ -485,8 +476,7 @@ discard block |
||
| 485 | 476 | if (isset($attributs['viewBox'])) { |
| 486 | 477 | $viewBox = explode(' ', $attributs['viewBox']); |
| 487 | 478 | $rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\"/>"; |
| 488 | - } |
|
| 489 | - else { |
|
| 479 | + } else { |
|
| 490 | 480 | $rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>"; |
| 491 | 481 | } |
| 492 | 482 | $svg = svg_insert_shapes($svg, $rect); |
@@ -515,8 +505,7 @@ discard block |
||
| 515 | 505 | if (isset($attributs['viewBox'])) { |
| 516 | 506 | $viewBox = explode(' ', $attributs['viewBox']); |
| 517 | 507 | $rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\" opacity=\"$opacity\"/>"; |
| 518 | - } |
|
| 519 | - else { |
|
| 508 | + } else { |
|
| 520 | 509 | $rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>"; |
| 521 | 510 | } |
| 522 | 511 | $svg = svg_insert_shapes($svg, $rect, false); |
@@ -637,8 +626,7 @@ discard block |
||
| 637 | 626 | $x = intval($viewBox[0]) + intval($viewBox[2] / 2); |
| 638 | 627 | $mx = -$x; |
| 639 | 628 | $transform = "translate($x, 0) $transform translate($mx, 0)"; |
| 640 | - } |
|
| 641 | - else { |
|
| 629 | + } else { |
|
| 642 | 630 | $transform = 'scale(1,-1)'; |
| 643 | 631 | |
| 644 | 632 | $y = intval($viewBox[1]) + intval($viewBox[3] / 2); |
@@ -699,8 +687,7 @@ discard block |
||
| 699 | 687 | $c = array_shift($colors); |
| 700 | 688 | if (strlen($c) == 4) { |
| 701 | 689 | $short[] = $c; |
| 702 | - } |
|
| 703 | - else { |
|
| 690 | + } else { |
|
| 704 | 691 | $long[] = $c; |
| 705 | 692 | } |
| 706 | 693 | } |
@@ -648,8 +648,7 @@ discard block |
||
| 648 | 648 | if (!$srcSize) { |
| 649 | 649 | $poids_img[$src] = filesize($src); |
| 650 | 650 | } |
| 651 | - } |
|
| 652 | - elseif (strpos($src, '<svg') !== false) { |
|
| 651 | + } elseif (strpos($src, '<svg') !== false) { |
|
| 653 | 652 | include_spip('inc/svg'); |
| 654 | 653 | if ($attrs = svg_lire_attributs($src)) { |
| 655 | 654 | [$width, $height, $viewbox] = svg_getimagesize_from_attr($attrs); |
@@ -3507,8 +3506,7 @@ discard block |
||
| 3507 | 3506 | ) { |
| 3508 | 3507 | if ($variante_svg_size = substr($variante_svg_generique, 0, -6) . $m[1] . '.svg' and file_exists($variante_svg_size)) { |
| 3509 | 3508 | $img_file = $variante_svg_size; |
| 3510 | - } |
|
| 3511 | - else { |
|
| 3509 | + } else { |
|
| 3512 | 3510 | $img_file = $variante_svg_generique; |
| 3513 | 3511 | } |
| 3514 | 3512 | } |
@@ -3540,8 +3538,7 @@ discard block |
||
| 3540 | 3538 | } |
| 3541 | 3539 | if (!isset($options['chemin_image']) or $options['chemin_image'] == true) { |
| 3542 | 3540 | $img_file = chemin_image($img); |
| 3543 | - } |
|
| 3544 | - else { |
|
| 3541 | + } else { |
|
| 3545 | 3542 | if (!isset($options['variante_svg_si_possible']) or $options['variante_svg_si_possible'] == true) { |
| 3546 | 3543 | $img_file = http_img_variante_svg_si_possible($img_file); |
| 3547 | 3544 | } |
@@ -3571,11 +3568,9 @@ discard block |
||
| 3571 | 3568 | } |
| 3572 | 3569 | if ($alt === false) { |
| 3573 | 3570 | $alt = ''; |
| 3574 | - } |
|
| 3575 | - elseif ($alt or $alt === '') { |
|
| 3571 | + } elseif ($alt or $alt === '') { |
|
| 3576 | 3572 | $alt = " alt='" . attribut_html($alt) . "'"; |
| 3577 | - } |
|
| 3578 | - else { |
|
| 3573 | + } else { |
|
| 3579 | 3574 | $alt = " alt='" . attribut_html($title) . "'"; |
| 3580 | 3575 | } |
| 3581 | 3576 | return "<img src='" . attribut_html($img_file) . "'$alt" |
@@ -3702,13 +3697,11 @@ discard block |
||
| 3702 | 3697 | if (!is_null($class)) { |
| 3703 | 3698 | if (strlen($class)) { |
| 3704 | 3699 | $img = inserer_attribut($img, 'class', $class); |
| 3705 | - } |
|
| 3706 | - else { |
|
| 3700 | + } else { |
|
| 3707 | 3701 | $img = vider_attribut($img, 'class'); |
| 3708 | 3702 | } |
| 3709 | 3703 | } |
| 3710 | - } |
|
| 3711 | - else { |
|
| 3704 | + } else { |
|
| 3712 | 3705 | $img = http_img_pack( |
| 3713 | 3706 | $img, |
| 3714 | 3707 | $alt, |
@@ -3806,8 +3799,7 @@ discard block |
||
| 3806 | 3799 | if (!is_null($class)) { |
| 3807 | 3800 | if (strlen($class)) { |
| 3808 | 3801 | $balise_svg = inserer_attribut($balise_svg, 'class', $class); |
| 3809 | - } |
|
| 3810 | - else { |
|
| 3802 | + } else { |
|
| 3811 | 3803 | $balise_svg = vider_attribut($balise_svg, 'class'); |
| 3812 | 3804 | } |
| 3813 | 3805 | } |
@@ -3819,8 +3811,7 @@ discard block |
||
| 3819 | 3811 | $balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id); |
| 3820 | 3812 | $title = "<title id=\"$id\">" . entites_html($alt) . "</title>\n"; |
| 3821 | 3813 | $balise_svg .= $title; |
| 3822 | - } |
|
| 3823 | - else { |
|
| 3814 | + } else { |
|
| 3824 | 3815 | $balise_svg = inserer_attribut($balise_svg, 'aria-hidden', 'true'); |
| 3825 | 3816 | } |
| 3826 | 3817 | |
@@ -5231,8 +5222,7 @@ discard block |
||
| 5231 | 5222 | // reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine |
| 5232 | 5223 | if (isset($options['hash_on_content']) and $options['hash_on_content']) { |
| 5233 | 5224 | $hash = md5($contexte_implicite['host'] . '::' . $cache); |
| 5234 | - } |
|
| 5235 | - else { |
|
| 5225 | + } else { |
|
| 5236 | 5226 | unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js |
| 5237 | 5227 | ksort($contexte); |
| 5238 | 5228 | $hash = md5($fond . json_encode($contexte_implicite, JSON_THROW_ON_ERROR) . json_encode($contexte, JSON_THROW_ON_ERROR) . $connect); |
@@ -111,14 +111,12 @@ discard block |
||
| 111 | 111 | spip_log('Les cles secretes ont ete restaurées avec le backup du webmestre #' . $row['id_auteur'], 'auth' . _LOG_INFO_IMPORTANTE); |
| 112 | 112 | if ($cles->save()) { |
| 113 | 113 | $secret = $cles->getSecretAuth(); |
| 114 | - } |
|
| 115 | - else { |
|
| 114 | + } else { |
|
| 116 | 115 | spip_log("Echec restauration des cles : verifier les droits d'ecriture ?", 'auth' . _LOG_ERREUR); |
| 117 | 116 | // et on echoue car on ne veut pas que la situation reste telle quelle |
| 118 | 117 | raler_fichier(_DIR_ETC . 'cles.php'); |
| 119 | 118 | } |
| 120 | - } |
|
| 121 | - else { |
|
| 119 | + } else { |
|
| 122 | 120 | spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) mais le backup du webmestre #' . $row['id_auteur'] . " n'est pas valide", 'auth' . _LOG_ERREUR); |
| 123 | 121 | sql_updateq('spip_auteurs', ['backup_cles' => ''], 'id_auteur=' . intval($row['id_auteur'])); |
| 124 | 122 | } |
@@ -126,8 +124,7 @@ discard block |
||
| 126 | 124 | |
| 127 | 125 | if (!$secret or !Password::verifier($pass, $row['pass'], $secret)) { |
| 128 | 126 | unset($row); |
| 129 | - } |
|
| 130 | - else { |
|
| 127 | + } else { |
|
| 131 | 128 | spip_log("validation du mot de passe pour l'auteur #" . $row['id_auteur'] . " $login via Password::verifier", 'auth' . _LOG_DEBUG); |
| 132 | 129 | } |
| 133 | 130 | break; |
@@ -238,8 +235,7 @@ discard block |
||
| 238 | 235 | spip_log("Echec generation d'une nouvelle cle : verifier les droits d'ecriture ?", 'auth' . _LOG_ERREUR); |
| 239 | 236 | // et on echoue car on ne veut pas que la situation reste telle quelle |
| 240 | 237 | raler_fichier(_DIR_ETC . 'cles.php'); |
| 241 | - } |
|
| 242 | - else { |
|
| 238 | + } else { |
|
| 243 | 239 | spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) un des webmestres #' . implode(', #', $has_backup) . ' doit se connecter pour restaurer son backup des cles', 'auth' . _LOG_ERREUR); |
| 244 | 240 | } |
| 245 | 241 | return false; |
@@ -479,8 +475,7 @@ discard block |
||
| 479 | 475 | if (!$secret) { |
| 480 | 476 | if (auth_spip_initialiser_secret()) { |
| 481 | 477 | $secret = $cles->getSecretAuth(); |
| 482 | - } |
|
| 483 | - else { |
|
| 478 | + } else { |
|
| 484 | 479 | return false; |
| 485 | 480 | } |
| 486 | 481 | } |