@@ -512,12 +512,14 @@ |
||
| 512 | 512 | ) |
| 513 | 513 | ); |
| 514 | 514 | |
| 515 | -if ($GLOBALS['meta']['version_installee'] > 1.950) // 1.950 lisait un bug dans auxiliaires.php corrige a present |
|
| 515 | +if ($GLOBALS['meta']['version_installee'] > 1.950) { |
|
| 516 | + // 1.950 lisait un bug dans auxiliaires.php corrige a present |
|
| 516 | 517 | { |
| 517 | 518 | $GLOBALS['maj'][1955] = array( |
| 518 | 519 | array('sql_alter', "TABLE spip_urls CHANGE `maj` date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL") |
| 519 | 520 | ); |
| 520 | 521 | } |
| 522 | +} |
|
| 521 | 523 | |
| 522 | 524 | // la mise a jour vers 1.938 contient une erreur |
| 523 | 525 | // il faut supprimer l'autoincrement avant de supprimer la PRIMARY KEY |
@@ -22,8 +22,7 @@ |
||
| 22 | 22 | // A fortiori quand on demande une trace |
| 23 | 23 | if (defined('_DEBUG_TRACE_QUERIES') and _DEBUG_TRACE_QUERIES) { |
| 24 | 24 | $trace = true; |
| 25 | - } |
|
| 26 | - else { |
|
| 25 | + } else { |
|
| 27 | 26 | include_spip('inc/autoriser'); |
| 28 | 27 | $trace = (isset($_GET['var_profile']) and autoriser('debug')); |
| 29 | 28 | } |
@@ -791,8 +791,7 @@ discard block |
||
| 791 | 791 | function public_compte_ligne($texte, $debut = 0, $fin = null) { |
| 792 | 792 | if (is_null($fin)) { |
| 793 | 793 | return substr_count($texte, "\n", $debut); |
| 794 | - } |
|
| 795 | - else { |
|
| 794 | + } else { |
|
| 796 | 795 | return substr_count($texte, "\n", $debut, $fin - $debut); |
| 797 | 796 | } |
| 798 | 797 | } |
@@ -838,8 +837,7 @@ discard block |
||
| 838 | 837 | erreur_squelette($err_b, $result); |
| 839 | 838 | |
| 840 | 839 | continue; |
| 841 | - } |
|
| 842 | - else { |
|
| 840 | + } else { |
|
| 843 | 841 | $boucle = [ |
| 844 | 842 | 'id_boucle' => $id_boucle, |
| 845 | 843 | 'id_boucle_err' => $id_boucle, |
@@ -969,8 +967,7 @@ discard block |
||
| 969 | 967 | // si c'est un appel pour memoriser une boucle, memorisons la |
| 970 | 968 | if (is_string($champ) and !empty($boucle_placeholder) and !empty($boucle)) { |
| 971 | 969 | $boucles_connues[$boucle_placeholder][$champ] = &$boucle; |
| 972 | - } |
|
| 973 | - else { |
|
| 970 | + } else { |
|
| 974 | 971 | if (!empty($champ->nom_champ) and !empty($boucles_connues[$champ->nom_champ])) { |
| 975 | 972 | $placeholder = $champ->nom_champ; |
| 976 | 973 | $id = reset($champ->param[0][1]); |
@@ -1114,8 +1111,7 @@ discard block |
||
| 1114 | 1111 | ); |
| 1115 | 1112 | erreur_squelette($err_b, $result); |
| 1116 | 1113 | $pos_courante += strlen($fin_boucle); |
| 1117 | - } |
|
| 1118 | - else { |
|
| 1114 | + } else { |
|
| 1119 | 1115 | // verifier une eventuelle imbrication d'une boucle homonyme |
| 1120 | 1116 | // (interdite, generera une erreur plus loin, mais permet de signaler la bonne erreur) |
| 1121 | 1117 | $search_debut_boucle = BALISE_BOUCLE . $id_boucle_search . '('; |
@@ -329,8 +329,7 @@ |
||
| 329 | 329 | if (!autoriser('modifier', $type, intval($id))){ |
| 330 | 330 | $valeurs['editable'] = ''; |
| 331 | 331 | } |
| 332 | - } |
|
| 333 | - else { |
|
| 332 | + } else { |
|
| 334 | 333 | if (!autoriser('creer', $type, 0, null, ['id_parent' => $id_parent])) { |
| 335 | 334 | $valeurs['editable'] = ''; |
| 336 | 335 | } |
@@ -237,8 +237,7 @@ discard block |
||
| 237 | 237 | if ($id === '*') { |
| 238 | 238 | unset($GLOBALS['autoriser_exception'][$faire][$type]); |
| 239 | 239 | unset($autorisation[$faire][$type]); |
| 240 | - } |
|
| 241 | - else { |
|
| 240 | + } else { |
|
| 242 | 241 | unset($GLOBALS['autoriser_exception'][$faire][$type][$id]); |
| 243 | 242 | unset($autorisation[$faire][$type][$id]); |
| 244 | 243 | } |
@@ -592,8 +591,7 @@ discard block |
||
| 592 | 591 | function autoriser_rubrique_creer_dist($faire, $type, $id, $qui, $opt) { |
| 593 | 592 | if (!empty($opt['id_parent'])) { |
| 594 | 593 | return autoriser('creerrubriquedans', 'rubrique', $opt['id_parent'], $qui); |
| 595 | - } |
|
| 596 | - else { |
|
| 594 | + } else { |
|
| 597 | 595 | return autoriser('defaut', null, null, $qui, $opt); |
| 598 | 596 | } |
| 599 | 597 | } |
@@ -739,8 +737,7 @@ discard block |
||
| 739 | 737 | if (!empty($opt['id_parent'])) { |
| 740 | 738 | // creerarticledans rappelle autoriser(creer,article) sans id, donc on verifiera condition du else aussi |
| 741 | 739 | return autoriser('creerarticledans', 'rubrique', $opt['id_parent'], $qui); |
| 742 | - } |
|
| 743 | - else { |
|
| 740 | + } else { |
|
| 744 | 741 | return (sql_countsel('spip_rubriques') > 0 and in_array($qui['statut'], array('0minirezo', '1comite'))); |
| 745 | 742 | } |
| 746 | 743 | } |
@@ -606,8 +606,7 @@ discard block |
||
| 606 | 606 | if (!$srcHeight) { |
| 607 | 607 | $hauteur_img[$src] = $srcHeight = $srcsize[1]; |
| 608 | 608 | } |
| 609 | - } |
|
| 610 | - elseif(strpos($src, "<svg") !== false) { |
|
| 609 | + } elseif(strpos($src, "<svg") !== false) { |
|
| 611 | 610 | include_spip('inc/svg'); |
| 612 | 611 | if ($attrs = svg_lire_attributs($src)){ |
| 613 | 612 | list($width, $height, $viewbox) = svg_getimagesize_from_attr($attrs); |
@@ -2072,8 +2071,7 @@ discard block |
||
| 2072 | 2071 | if (in_array($operation, ['ajouter', 'commuter']) |
| 2073 | 2072 | and !$is_class_presente) { |
| 2074 | 2073 | $class_new = rtrim($class_new) . " " . $c; |
| 2075 | - } |
|
| 2076 | - elseif (in_array($operation, ['supprimer', 'commuter']) |
|
| 2074 | + } elseif (in_array($operation, ['supprimer', 'commuter']) |
|
| 2077 | 2075 | and $is_class_presente) { |
| 2078 | 2076 | $class_new = trim(preg_replace("/(^|\s)".preg_quote($c)."($|\s)/", "\\1", $class_new)); |
| 2079 | 2077 | } |
@@ -2083,8 +2081,7 @@ discard block |
||
| 2083 | 2081 | if ($class_new !== $class_courante) { |
| 2084 | 2082 | if (strlen($class_new)) { |
| 2085 | 2083 | $balise = inserer_attribut($balise, 'class', $class_new); |
| 2086 | - } |
|
| 2087 | - elseif ($class_courante) { |
|
| 2084 | + } elseif ($class_courante) { |
|
| 2088 | 2085 | $balise = vider_attribut($balise, 'class'); |
| 2089 | 2086 | } |
| 2090 | 2087 | } |
@@ -3383,8 +3380,7 @@ discard block |
||
| 3383 | 3380 | } |
| 3384 | 3381 | if (!isset($options['chemin_image']) or $options['chemin_image'] == true) { |
| 3385 | 3382 | $img_file = chemin_image($img); |
| 3386 | - } |
|
| 3387 | - else { |
|
| 3383 | + } else { |
|
| 3388 | 3384 | if (!isset($options['variante_svg_si_possible']) or $options['variante_svg_si_possible'] == true){ |
| 3389 | 3385 | // on peut fournir une icone generique -xx.svg qui fera le job dans toutes les tailles, et qui est prioritaire sur le png |
| 3390 | 3386 | // si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png |
@@ -3393,8 +3389,7 @@ discard block |
||
| 3393 | 3389 | and file_exists($variante_svg_generique)) { |
| 3394 | 3390 | if ($variante_svg_size = substr($variante_svg_generique,0,-6) . $m[1] . ".svg" and file_exists($variante_svg_size)) { |
| 3395 | 3391 | $img_file = $variante_svg_size; |
| 3396 | - } |
|
| 3397 | - else { |
|
| 3392 | + } else { |
|
| 3398 | 3393 | $img_file = $variante_svg_generique; |
| 3399 | 3394 | } |
| 3400 | 3395 | } |
@@ -3424,11 +3419,9 @@ discard block |
||
| 3424 | 3419 | } |
| 3425 | 3420 | if ($alt === false) { |
| 3426 | 3421 | $alt = ''; |
| 3427 | - } |
|
| 3428 | - elseif($alt or $alt==='') { |
|
| 3422 | + } elseif($alt or $alt==='') { |
|
| 3429 | 3423 | $alt = " alt='".attribut_html($alt)."'"; |
| 3430 | - } |
|
| 3431 | - else { |
|
| 3424 | + } else { |
|
| 3432 | 3425 | $alt = " alt='".attribut_html($title)."'"; |
| 3433 | 3426 | } |
| 3434 | 3427 | return "<img src='$img_file'$alt" |
@@ -3553,13 +3546,11 @@ discard block |
||
| 3553 | 3546 | if (!is_null($class)) { |
| 3554 | 3547 | if (strlen($class)) { |
| 3555 | 3548 | $img = inserer_attribut($img, 'class', $class); |
| 3556 | - } |
|
| 3557 | - else { |
|
| 3549 | + } else { |
|
| 3558 | 3550 | $img = vider_attribut($img, 'class'); |
| 3559 | 3551 | } |
| 3560 | 3552 | } |
| 3561 | - } |
|
| 3562 | - else { |
|
| 3553 | + } else { |
|
| 3563 | 3554 | $img = http_img_pack($img, $alt, $class ? " class='" . attribut_html($class) . "'" : '', '', |
| 3564 | 3555 | array('chemin_image' => false, 'utiliser_suffixe_size' => false)); |
| 3565 | 3556 | if (is_null($alt)) { |
@@ -3639,8 +3630,7 @@ discard block |
||
| 3639 | 3630 | if (!is_null($class)) { |
| 3640 | 3631 | if (strlen($class)) { |
| 3641 | 3632 | $balise_svg = inserer_attribut($balise_svg, 'class', $class); |
| 3642 | - } |
|
| 3643 | - else { |
|
| 3633 | + } else { |
|
| 3644 | 3634 | $balise_svg = vider_attribut($balise_svg, 'class'); |
| 3645 | 3635 | } |
| 3646 | 3636 | } |
@@ -3652,8 +3642,7 @@ discard block |
||
| 3652 | 3642 | $balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id); |
| 3653 | 3643 | $title = "<title id=\"$id\">" . entites_html($alt)."</title>\n"; |
| 3654 | 3644 | $balise_svg .= $title; |
| 3655 | - } |
|
| 3656 | - else { |
|
| 3645 | + } else { |
|
| 3657 | 3646 | $balise_svg = inserer_attribut($balise_svg, 'aria-hidden', 'true'); |
| 3658 | 3647 | } |
| 3659 | 3648 | |
@@ -4895,8 +4884,7 @@ discard block |
||
| 4895 | 4884 | // reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine |
| 4896 | 4885 | if (isset($options['hash_on_content']) and $options['hash_on_content']) { |
| 4897 | 4886 | $hash = md5($contexte_implicite['host'] . '::'. $cache); |
| 4898 | - } |
|
| 4899 | - else { |
|
| 4887 | + } else { |
|
| 4900 | 4888 | unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js |
| 4901 | 4889 | ksort($contexte); |
| 4902 | 4890 | $hash = md5($fond . json_encode($contexte_implicite) . json_encode($contexte) . $connect); |
@@ -192,11 +192,9 @@ |
||
| 192 | 192 | |
| 193 | 193 | if ($statut AND test_espace_prive()) { |
| 194 | 194 | $corps = bouton_action(_T('public:accueil_site'),generer_url_ecrire('accueil')); |
| 195 | - } |
|
| 196 | - elseif (!empty($_COOKIE['spip_admin'])) { |
|
| 195 | + } elseif (!empty($_COOKIE['spip_admin'])) { |
|
| 197 | 196 | $corps = bouton_action(_T('public:lien_connecter'),generer_url_public('login')); |
| 198 | - } |
|
| 199 | - else { |
|
| 197 | + } else { |
|
| 200 | 198 | $corps = bouton_action(_T('public:accueil_site'),$GLOBALS['meta']['adresse_site']); |
| 201 | 199 | } |
| 202 | 200 | $corps = "<div class='boutons'>$corps</div>"; |
@@ -85,8 +85,7 @@ |
||
| 85 | 85 | $url_action = self(); |
| 86 | 86 | $action = _request('action'); |
| 87 | 87 | $url_action = parametre_url($url_action, 'action', $action, '&'); |
| 88 | - } |
|
| 89 | - else { |
|
| 88 | + } else { |
|
| 90 | 89 | $action = parametre_url($url_action, 'action'); |
| 91 | 90 | } |
| 92 | 91 | |
@@ -555,11 +555,9 @@ discard block |
||
| 555 | 555 | if (!isset($msg[$p])) { |
| 556 | 556 | if (isset($resume['erreur']) and $resume['erreur']) { |
| 557 | 557 | $msg[$p] = array($resume['erreur']); |
| 558 | - } |
|
| 559 | - elseif (!plugin_version_compatible($k['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) { |
|
| 558 | + } elseif (!plugin_version_compatible($k['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) { |
|
| 560 | 559 | $msg[$p] = array(plugin_message_incompatibilite($k['compatibilite'], $GLOBALS['spip_version_branche'], 'SPIP', 'necessite')); |
| 561 | - } |
|
| 562 | - elseif (!$msg[$p] = plugin_necessite($k['necessite'], $liste, 'necessite')) { |
|
| 560 | + } elseif (!$msg[$p] = plugin_necessite($k['necessite'], $liste, 'necessite')) { |
|
| 563 | 561 | $msg[$p] = plugin_necessite($k['utilise'], $liste, 'utilise'); |
| 564 | 562 | } |
| 565 | 563 | } else { |
@@ -942,8 +940,7 @@ discard block |
||
| 942 | 940 | if (is_dir(constant($dir_type) . $plug . '/squelettes/')) { |
| 943 | 941 | $chemins['public'][] = "_DIR_PLUGIN_{$prefix}.'squelettes/'"; |
| 944 | 942 | } |
| 945 | - } |
|
| 946 | - else{ |
|
| 943 | + } else{ |
|
| 947 | 944 | foreach ($info['chemin'] as $chemin) { |
| 948 | 945 | if (!isset($chemin['version']) or plugin_version_compatible($chemin['version'], |
| 949 | 946 | $GLOBALS['spip_version_branche'], 'spip') |
@@ -1166,10 +1163,12 @@ discard block |
||
| 1166 | 1163 | } |
| 1167 | 1164 | $nom = $nomlower; |
| 1168 | 1165 | // une action vide est une declaration qui ne doit pas etre compilee ! |
| 1169 | - if (!isset($GLOBALS['spip_pipeline'][$nom])) // creer le pipeline eventuel |
|
| 1166 | + if (!isset($GLOBALS['spip_pipeline'][$nom])) { |
|
| 1167 | + // creer le pipeline eventuel |
|
| 1170 | 1168 | { |
| 1171 | 1169 | $GLOBALS['spip_pipeline'][$nom] = ""; |
| 1172 | 1170 | } |
| 1171 | + } |
|
| 1173 | 1172 | if ($action) { |
| 1174 | 1173 | if (strpos($GLOBALS['spip_pipeline'][$nom], "|$prefix$action") === false) { |
| 1175 | 1174 | $GLOBALS['spip_pipeline'][$nom] = preg_replace(",(\|\||$),", "|$prefix$action\\1", |
@@ -1430,8 +1429,7 @@ discard block |
||
| 1430 | 1429 | if (file_exists($nom)) { |
| 1431 | 1430 | if (substr($nom, -4) == '.php') { |
| 1432 | 1431 | $fichier_tmp = substr($nom, 0, -4) . '.tmp.php'; |
| 1433 | - } |
|
| 1434 | - else { |
|
| 1432 | + } else { |
|
| 1435 | 1433 | $fichier_tmp = $nom . '.tmp'; |
| 1436 | 1434 | } |
| 1437 | 1435 | file_put_contents($fichier_tmp, $contenu); |