@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | if (is_null($liste_langues)) { |
| 46 | - $liste_langues = ($GLOBALS['meta']['langues_proposees'] ?? '') . ',' . ($GLOBALS['meta']['langues_multilingue'] ?? ''); |
|
| 46 | + $liste_langues = ($GLOBALS['meta']['langues_proposees'] ?? '').','.($GLOBALS['meta']['langues_multilingue'] ?? ''); |
|
| 47 | 47 | } else { |
| 48 | 48 | if (is_array($liste_langues)) { |
| 49 | 49 | $liste_langues = implode(',', $liste_langues); |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | - $liste_langues = ',' . $liste_langues . ','; |
|
| 52 | + $liste_langues = ','.$liste_langues.','; |
|
| 53 | 53 | |
| 54 | 54 | // Si la langue demandee n'existe pas, on essaie d'autres variantes |
| 55 | 55 | // Exemple : 'pt-br' => 'pt_br' => 'pt' |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | foreach ($langues as $l) { |
| 193 | 193 | $selected = ($l == $default) ? ' selected=\'selected\'' : ''; |
| 194 | - $ret .= "<option value='$l'$selected>[" . $l . '] ' . traduire_nom_langue($l) . "</option>\n"; |
|
| 194 | + $ret .= "<option value='$l'$selected>[".$l.'] '.traduire_nom_langue($l)."</option>\n"; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (!test_espace_prive()) { |
@@ -209,21 +209,20 @@ discard block |
||
| 209 | 209 | $base, |
| 210 | 210 | $cible, |
| 211 | 211 | (select_langues($nom_select, $change, $ret) |
| 212 | - . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='" . _T('bouton_changer') . "' /></div></noscript>"), |
|
| 212 | + . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='"._T('bouton_changer')."' /></div></noscript>"), |
|
| 213 | 213 | " method='post'" |
| 214 | 214 | ); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | function select_langues($nom_select, $change, $options, $label = '') { |
| 218 | 218 | static $cpt = 0; |
| 219 | - $id = 'menu_langues' . $cpt++; |
|
| 219 | + $id = 'menu_langues'.$cpt++; |
|
| 220 | 220 | |
| 221 | 221 | return |
| 222 | - "<label for='$id'>" . ($label ?: _T('info_langues')) . '</label> ' . |
|
| 222 | + "<label for='$id'>".($label ?: _T('info_langues')).'</label> '. |
|
| 223 | 223 | "<select name='$nom_select' id='$id' " |
| 224 | 224 | . ((test_espace_prive()) ? |
| 225 | - (($nom_select == 'var_lang_ecrire' ? "class='lang_ecrire'" : "class='fondl'")) : |
|
| 226 | - ("class='forml menu_langues'")) |
|
| 225 | + (($nom_select == 'var_lang_ecrire' ? "class='lang_ecrire'" : "class='fondl'")) : ("class='forml menu_langues'")) |
|
| 227 | 226 | . $change |
| 228 | 227 | . ">\n" |
| 229 | 228 | . $options |
@@ -346,7 +345,7 @@ discard block |
||
| 346 | 345 | isset($GLOBALS['meta']['langue_site']) |
| 347 | 346 | && (!isset($GLOBALS['spip_lang']) || $GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site']) |
| 348 | 347 | ) { |
| 349 | - return changer_langue($GLOBALS['meta']['langue_site'], $liste_langues);//@:install |
|
| 348 | + return changer_langue($GLOBALS['meta']['langue_site'], $liste_langues); //@:install |
|
| 350 | 349 | } |
| 351 | 350 | // en theorie là, la globale est définie, sinon c'est un problème. |
| 352 | 351 | if (!isset($GLOBALS['spip_lang'])) { |
@@ -458,7 +457,7 @@ discard block |
||
| 458 | 457 | if (!isset($GLOBALS['meta']['langue_site'])) { |
| 459 | 458 | // Initialisation : le francais si dispo, sinon la premiere langue trouvee |
| 460 | 459 | $GLOBALS['meta']['langue_site'] = $tout = |
| 461 | - (!$all_langs || str_contains(',' . _LANGUE_PAR_DEFAUT . ',', (string) ",$all_langs,")) |
|
| 460 | + (!$all_langs || str_contains(','._LANGUE_PAR_DEFAUT.',', (string) ",$all_langs,")) |
|
| 462 | 461 | ? _LANGUE_PAR_DEFAUT |
| 463 | 462 | : substr((string) $all_langs, 0, strpos((string) $all_langs, ',')); |
| 464 | 463 | ecrire_meta('langue_site', $tout); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - return $x . $texte; |
|
| 66 | + return $x.$texte; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if (!str_contains(substr($texte, 0, $pos), '<!-- insert_head -->')) { |
| 141 | - $insert = "\n" . pipeline('insert_head', '<!-- f_insert_head -->') . "\n"; |
|
| 141 | + $insert = "\n".pipeline('insert_head', '<!-- f_insert_head -->')."\n"; |
|
| 142 | 142 | $texte = substr_replace($texte, $insert, $pos, 0); |
| 143 | 143 | } |
| 144 | 144 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | $texte = substr_replace($texte, $x, $pos, 0); |
| 172 | 172 | // pas de preview en fenetre enfant |
| 173 | - $x = "<script type='text/javascript'>const frameEl = window.frameElement;if (frameEl) {frameEl.sandbox='sandbox';window.location.href='" . addslashes((string) $GLOBALS['meta']['adresse_site']) . "';}</script>"; |
|
| 173 | + $x = "<script type='text/javascript'>const frameEl = window.frameElement;if (frameEl) {frameEl.sandbox='sandbox';window.location.href='".addslashes((string) $GLOBALS['meta']['adresse_site'])."';}</script>"; |
|
| 174 | 174 | if ((!$pos = stripos($texte, '<head')) || (!$pos = strpos($texte, '>', $pos))) { |
| 175 | 175 | $pos = -1; |
| 176 | 176 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | // inserer avant le </body> fermant si on peut, a la fin de la page sinon |
| 243 | 243 | if (($p = strpos($texte, '</body>')) !== false) { |
| 244 | - $texte = substr($texte, 0, $p) . $code . substr($texte, $p); |
|
| 244 | + $texte = substr($texte, 0, $p).$code.substr($texte, $p); |
|
| 245 | 245 | } else { |
| 246 | 246 | $texte .= $code; |
| 247 | 247 | } |
@@ -106,12 +106,12 @@ discard block |
||
| 106 | 106 | foreach (['script', 'iframe'] as $tag) { |
| 107 | 107 | if ( |
| 108 | 108 | stripos($t, (string) "<$tag") !== false |
| 109 | - && preg_match_all(',<' . $tag . '.*?($|</' . $tag . '.),isS', $t, $r, PREG_SET_ORDER) |
|
| 109 | + && preg_match_all(',<'.$tag.'.*?($|</'.$tag.'.),isS', $t, $r, PREG_SET_ORDER) |
|
| 110 | 110 | ) { |
| 111 | 111 | foreach ($r as $regs) { |
| 112 | 112 | $t = str_replace( |
| 113 | 113 | $regs[0], |
| 114 | - "<code$class>" . nl2br(spip_htmlspecialchars($regs[0])) . '</code>', |
|
| 114 | + "<code$class>".nl2br(spip_htmlspecialchars($regs[0])).'</code>', |
|
| 115 | 115 | $t |
| 116 | 116 | ); |
| 117 | 117 | } |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // echapper les tags asp/php |
| 167 | - $t = str_replace('<' . '%', '<%', $arg); |
|
| 167 | + $t = str_replace('<'.'%', '<%', $arg); |
|
| 168 | 168 | |
| 169 | 169 | // echapper le php |
| 170 | - $t = str_replace('<' . '?', '<?', $t); |
|
| 170 | + $t = str_replace('<'.'?', '<?', $t); |
|
| 171 | 171 | |
| 172 | 172 | // echapper le < script language=php > |
| 173 | 173 | $t = preg_replace(',<(script\b[^>]+\blanguage\b[^\w>]+php\b),UimsS', '<\1', $t); |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | // Reinserer les echappements des modeles |
| 191 | 191 | if (defined('_PROTEGE_JS_MODELES')) { |
| 192 | - $t = echappe_retour($t, 'javascript' . _PROTEGE_JS_MODELES); |
|
| 192 | + $t = echappe_retour($t, 'javascript'._PROTEGE_JS_MODELES); |
|
| 193 | 193 | } |
| 194 | 194 | if (defined('_PROTEGE_PHP_MODELES')) { |
| 195 | - $t = echappe_retour($t, 'php' . _PROTEGE_PHP_MODELES); |
|
| 195 | + $t = echappe_retour($t, 'php'._PROTEGE_PHP_MODELES); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | return $dejavu[$mode_filtre][$arg] = $t; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | define('_TYPO_PROTEGER', "!':;?~%-"); |
| 291 | 291 | define('_TYPO_PROTECTEUR', "\x1\x2\x3\x4\x5\x6\x7\x8"); |
| 292 | 292 | |
| 293 | -define('_TYPO_BALISE', ',</?[a-z!][^<>]*[' . preg_quote(_TYPO_PROTEGER) . '][^<>]*>,imsS'); |
|
| 293 | +define('_TYPO_BALISE', ',</?[a-z!][^<>]*['.preg_quote(_TYPO_PROTEGER).'][^<>]*>,imsS'); |
|
| 294 | 294 | |
| 295 | 295 | /** |
| 296 | 296 | * Corrige la typographie |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | function spip_setcookie( |
| 53 | 53 | string $name = '', |
| 54 | 54 | string $value = '', |
| 55 | - int|array $expires_or_options = 0, |
|
| 55 | + int | array $expires_or_options = 0, |
|
| 56 | 56 | string $path = '', |
| 57 | 57 | string $domain = '', |
| 58 | 58 | bool $secure = false, |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | // in fine renommer le prefixe si besoin |
| 103 | 103 | if (str_starts_with($name, 'spip_')) { |
| 104 | - $name = $GLOBALS['cookie_prefix'] . '_' . substr($name, 5); |
|
| 104 | + $name = $GLOBALS['cookie_prefix'].'_'.substr($name, 5); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | #spip_log("cookie('$name', '$value', " . json_encode($options, true) . ")", "cookies"); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | foreach ($_COOKIE as $name => $value) { |
| 161 | 161 | if (substr($name, 0, $prefix_long) == $cookie_prefix) { |
| 162 | - $spipname = preg_replace('/^' . $cookie_prefix . '_/', 'spip_', $name); |
|
| 162 | + $spipname = preg_replace('/^'.$cookie_prefix.'_/', 'spip_', $name); |
|
| 163 | 163 | $_COOKIE[$spipname] = $value; |
| 164 | 164 | $GLOBALS[$spipname] = $value; |
| 165 | 165 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | // confirmation du deplacement |
| 117 | 117 | if ( |
| 118 | 118 | sql_table_exists('spip_breves') |
| 119 | - && ($contient_breves = sql_countsel('spip_breves', 'id_rubrique=' . (int) $id_objet)) |
|
| 119 | + && ($contient_breves = sql_countsel('spip_breves', 'id_rubrique='.(int) $id_objet)) |
|
| 120 | 120 | && $contient_breves > 0 |
| 121 | 121 | ) { |
| 122 | 122 | // FIXME: utiliser singulier_ou_pluriel, migrer dans plugin Brèves |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | ); |
| 131 | 131 | $confirm .= "\n<div class='confirmer_deplacement verdana2'>" |
| 132 | 132 | . "<div class='choix'><input type='checkbox' name='confirme_deplace' value='oui' id='confirme-deplace' /><label for='confirme-deplace'>" |
| 133 | - . $scb . |
|
| 133 | + . $scb. |
|
| 134 | 134 | "</label></div></div>\n"; |
| 135 | 135 | } else { |
| 136 | 136 | $confirm .= "<input type='hidden' name='confirme_deplace' value='oui' />\n"; |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | $form .= $confirm; |
| 140 | 140 | if ($actionable) { |
| 141 | 141 | if (str_contains($form, '<select')) { |
| 142 | - $form .= "<div style='text-align: " . $GLOBALS['spip_lang_right'] . ";'>" |
|
| 143 | - . '<input class="fondo submit btn" type="submit" value="' . _T('bouton_choisir') . '"/>' |
|
| 142 | + $form .= "<div style='text-align: ".$GLOBALS['spip_lang_right'].";'>" |
|
| 143 | + . '<input class="fondo submit btn" type="submit" value="'._T('bouton_choisir').'"/>' |
|
| 144 | 144 | . '</div>'; |
| 145 | 145 | } |
| 146 | - $form = "<input type='hidden' name='editer_$objet' value='oui' />\n" . $form; |
|
| 146 | + $form = "<input type='hidden' name='editer_$objet' value='oui' />\n".$form; |
|
| 147 | 147 | if ($action = charger_fonction("editer_$objet", 'action', true)) { |
| 148 | 148 | $form = generer_action_auteur( |
| 149 | 149 | "editer_$objet", |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | include_spip('inc/presentation'); |
| 171 | 171 | |
| 172 | - return debut_cadre_couleur($logo, true, '', $titre) . $form . fin_cadre_couleur(); |
|
| 172 | + return debut_cadre_couleur($logo, true, '', $titre).$form.fin_cadre_couleur(); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | if ($statut == 'nouveau') { |
| 246 | 246 | if ($attente) { |
| 247 | 247 | $statut = $attente; |
| 248 | - $plus = ' (' . _T('info_statut_auteur_a_confirmer') . ')'; |
|
| 248 | + $plus = ' ('._T('info_statut_auteur_a_confirmer').')'; |
|
| 249 | 249 | } else { |
| 250 | 250 | return _T('info_statut_auteur_a_confirmer'); |
| 251 | 251 | } |
@@ -258,16 +258,16 @@ discard block |
||
| 258 | 258 | '5poubelle' => _T('texte_statut_poubelle'), // bouh |
| 259 | 259 | ]; |
| 260 | 260 | if (isset($recom[$statut])) { |
| 261 | - return $recom[$statut] . $plus; |
|
| 261 | + return $recom[$statut].$plus; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | // retrouver directement par le statut sinon |
| 265 | 265 | if ($t = array_search($statut, $GLOBALS['liste_des_statuts'])) { |
| 266 | 266 | if (isset($recom[$t])) { |
| 267 | - return $recom[$t] . $plus; |
|
| 267 | + return $recom[$t].$plus; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - return _T($t) . $plus; |
|
| 270 | + return _T($t).$plus; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // si on a pas reussi a le traduire, retournons la chaine telle quelle |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | |
| 388 | 388 | if (!$id_rubrique && defined('_CHOIX_RUBRIQUE_PAR_DEFAUT') && _CHOIX_RUBRIQUE_PAR_DEFAUT) { |
| 389 | 389 | $in = (is_countable($GLOBALS['connect_id_rubrique']) ? count($GLOBALS['connect_id_rubrique']) : 0) |
| 390 | - ? ' AND ' . sql_in('id_rubrique', $GLOBALS['connect_id_rubrique']) |
|
| 390 | + ? ' AND '.sql_in('id_rubrique', $GLOBALS['connect_id_rubrique']) |
|
| 391 | 391 | : ''; |
| 392 | 392 | |
| 393 | 393 | // on tente d'abord l'ecriture a la racine dans le cas des rubriques uniquement |
@@ -426,13 +426,13 @@ discard block |
||
| 426 | 426 | $parts = parse_url($virtuel); |
| 427 | 427 | if (!empty($parts['query']) && str_contains($parts['query'], ']')) { |
| 428 | 428 | $query = str_replace(['[', ']'], [urlencode('['), urlencode(']')], $parts['query']); |
| 429 | - $virtuel = str_replace('?' . $parts['query'], "?$query", $virtuel); |
|
| 429 | + $virtuel = str_replace('?'.$parts['query'], "?$query", $virtuel); |
|
| 430 | 430 | } |
| 431 | 431 | if ($virtuel !== $joli) { |
| 432 | - $joli = propre('[' . $joli . ' -> ' . $virtuel . ']'); |
|
| 432 | + $joli = propre('['.$joli.' -> '.$virtuel.']'); |
|
| 433 | 433 | } |
| 434 | 434 | else { |
| 435 | - $joli = propre('[->' . $virtuel . ']'); |
|
| 435 | + $joli = propre('[->'.$virtuel.']'); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | return $joli; |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | $clic = http_img_pack('rss-16.png', 'RSS', '', $title); |
| 463 | 463 | |
| 464 | 464 | $url = generer_url_api_low_sec('transmettre', 'rss', $op, '', http_build_query($args), false, true); |
| 465 | - return "<a style='float: " . $GLOBALS['spip_lang_right'] . ";' href='$url'>$clic</a>"; |
|
| 465 | + return "<a style='float: ".$GLOBALS['spip_lang_right'].";' href='$url'>$clic</a>"; |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | ); |
| 535 | 535 | |
| 536 | 536 | if ($alertes = array_filter($alertes)) { |
| 537 | - return "<div class='wrap-messages-alertes'><div class='messages-alertes'>" . |
|
| 537 | + return "<div class='wrap-messages-alertes'><div class='messages-alertes'>". |
|
| 538 | 538 | implode(' | ', $alertes) |
| 539 | 539 | . '</div></div>'; |
| 540 | 540 | } |
@@ -570,13 +570,13 @@ discard block |
||
| 570 | 570 | */ |
| 571 | 571 | function afficher_plus_info($lien, $titre = '+', $titre_lien = '') { |
| 572 | 572 | $titre = attribut_html($titre); |
| 573 | - $icone = "\n<a href='$lien' title='$titre' class='plus_info'>" . |
|
| 574 | - http_img_pack('information-16.png', $titre) . '</a>'; |
|
| 573 | + $icone = "\n<a href='$lien' title='$titre' class='plus_info'>". |
|
| 574 | + http_img_pack('information-16.png', $titre).'</a>'; |
|
| 575 | 575 | |
| 576 | 576 | if (!$titre_lien) { |
| 577 | 577 | return $icone; |
| 578 | 578 | } else { |
| 579 | - return $icone . "\n<a href='$lien'>$titre_lien</a>"; |
|
| 579 | + return $icone."\n<a href='$lien'>$titre_lien</a>"; |
|
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | |
@@ -37,15 +37,15 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Regarder dans le repertoire local des images TeX et blocs MathML |
| 40 | - if (!@is_dir($dir_tex = _DIR_VAR . 'cache-TeX/')) { |
|
| 40 | + if (!@is_dir($dir_tex = _DIR_VAR.'cache-TeX/')) { |
|
| 41 | 41 | @mkdir($dir_tex, _SPIP_CHMOD); |
| 42 | 42 | } |
| 43 | - $fichier = $dir_tex . md5(trim((string) $tex)) . $ext; |
|
| 43 | + $fichier = $dir_tex.md5(trim((string) $tex)).$ext; |
|
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | // Aller chercher l'image sur le serveur |
| 47 | 47 | if (!@file_exists($fichier) && $server) { |
| 48 | - spip_log($url = $server . '?' . rawurlencode((string) $tex)); |
|
| 48 | + spip_log($url = $server.'?'.rawurlencode((string) $tex)); |
|
| 49 | 49 | include_spip('inc/distant'); |
| 50 | 50 | recuperer_url($url, ['file' => $fichier]); |
| 51 | 51 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | return implode('', file($fichier)); |
| 60 | 60 | } // TeX |
| 61 | 61 | else { |
| 62 | - [, , , $size] = @spip_getimagesize($fichier); |
|
| 62 | + [,,, $size] = @spip_getimagesize($fichier); |
|
| 63 | 63 | $alt = "alt=\"$tex\" title=\"$tex\""; |
| 64 | 64 | |
| 65 | 65 | return "<img src=\"$fichier\" style=\"vertical-align:middle;\" $size $alt />"; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $expression = str_replace('&', '&', $expression); |
| 126 | 126 | } |
| 127 | 127 | $echap = produire_image_math($expression); |
| 128 | - $echap = ($t['pre'] ?? '') . $echap . ($t['post'] ?? ''); |
|
| 128 | + $echap = ($t['pre'] ?? '').$echap.($t['post'] ?? ''); |
|
| 129 | 129 | $echap = CollecteurHtmlTag::echappementHtmlBase64($echap, $source); |
| 130 | 130 | |
| 131 | 131 | $pos = strpos($texte_milieu, (string) $regs[0]); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * Mot de passe |
| 31 | 31 | **/ |
| 32 | 32 | function creer_pass_aleatoire($longueur = 16, $sel = '') { |
| 33 | - $seed = (int)round(((float)microtime() + 1) * time()); |
|
| 33 | + $seed = (int) round(((float) microtime() + 1) * time()); |
|
| 34 | 34 | |
| 35 | 35 | mt_srand($seed); |
| 36 | 36 | $s = ''; |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | if (!$s) { |
| 42 | 42 | $s = random_int(0, mt_getrandmax()); |
| 43 | 43 | } |
| 44 | - $s = substr(md5(uniqid($s) . $sel), 0, 16); |
|
| 44 | + $s = substr(md5(uniqid($s).$sel), 0, 16); |
|
| 45 | 45 | } |
| 46 | - $r = unpack('Cr', pack('H2', $s . $s)); |
|
| 46 | + $r = unpack('Cr', pack('H2', $s.$s)); |
|
| 47 | 47 | $x = $r['r'] & 63; |
| 48 | 48 | if ($x < 10) { |
| 49 | 49 | $x = chr($x + 48); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | static $seeded; |
| 77 | 77 | |
| 78 | 78 | if (!$seeded) { |
| 79 | - $seed = (int)round(((float)microtime() + 1) * time()); |
|
| 79 | + $seed = (int) round(((float) microtime() + 1) * time()); |
|
| 80 | 80 | mt_srand($seed); |
| 81 | 81 | $seeded = true; |
| 82 | 82 | } |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | ecrire_meta('low_sec', $low_sec = creer_pass_aleatoire()); |
| 163 | 163 | } |
| 164 | 164 | } else { |
| 165 | - $low_sec = sql_getfetsel('low_sec', 'spip_auteurs', 'id_auteur = ' . (int) $id_auteur); |
|
| 165 | + $low_sec = sql_getfetsel('low_sec', 'spip_auteurs', 'id_auteur = '.(int) $id_auteur); |
|
| 166 | 166 | if (!$low_sec) { |
| 167 | 167 | $low_sec = creer_pass_aleatoire(); |
| 168 | - sql_updateq('spip_auteurs', ['low_sec' => $low_sec], 'id_auteur = ' . (int) $id_auteur); |
|
| 168 | + sql_updateq('spip_auteurs', ['low_sec' => $low_sec], 'id_auteur = '.(int) $id_auteur); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | function generer_url_api_low_sec(string $script, string $format, string $fond, string $path, string $args, bool $no_entities = false, ?bool $public = null) { |
| 217 | 217 | $id_auteur = $GLOBALS['visiteur_session']['id_auteur'] ?? 0; |
| 218 | 218 | $cle = afficher_low_sec($id_auteur, "$script/$format $fond $args"); |
| 219 | - $path = "$id_auteur/$cle/$format/$fond" . ($path ? "/$path" : ''); |
|
| 219 | + $path = "$id_auteur/$cle/$format/$fond".($path ? "/$path" : ''); |
|
| 220 | 220 | |
| 221 | 221 | return generer_url_api($script, $path, $args, $no_entities, $public); |
| 222 | 222 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * Clé |
| 235 | 235 | **/ |
| 236 | 236 | function afficher_low_sec($id_auteur, $action = '') { |
| 237 | - return substr(md5($action . low_sec($id_auteur)), 0, 8); |
|
| 237 | + return substr(md5($action.low_sec($id_auteur)), 0, 8); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | if (!$id_auteur = (int) $id_auteur) { |
| 266 | 266 | return; |
| 267 | 267 | } // jamais trop prudent ;) |
| 268 | - sql_updateq('spip_auteurs', ['low_sec' => ''], 'id_auteur = ' . (int) $id_auteur); |
|
| 268 | + sql_updateq('spip_auteurs', ['low_sec' => ''], 'id_auteur = '.(int) $id_auteur); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | |
@@ -283,8 +283,8 @@ discard block |
||
| 283 | 283 | * - void sinon. |
| 284 | 284 | **/ |
| 285 | 285 | function ecrire_acces() { |
| 286 | - $htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME; |
|
| 287 | - $htpasswd = _DIR_TMP . _AUTH_USER_FILE; |
|
| 286 | + $htaccess = _DIR_RESTREINT._ACCESS_FILE_NAME; |
|
| 287 | + $htpasswd = _DIR_TMP._AUTH_USER_FILE; |
|
| 288 | 288 | |
| 289 | 289 | // Cette variable de configuration peut etre posee par un plugin |
| 290 | 290 | // par exemple acces_restreint ; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | (!isset($GLOBALS['meta']['creer_htpasswd']) || $GLOBALS['meta']['creer_htpasswd'] != 'oui') && !@file_exists($htaccess) |
| 294 | 294 | ) { |
| 295 | 295 | spip_unlink($htpasswd); |
| 296 | - spip_unlink($htpasswd . '-admin'); |
|
| 296 | + spip_unlink($htpasswd.'-admin'); |
|
| 297 | 297 | return; |
| 298 | 298 | } |
| 299 | 299 | |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | $pwd_all = ''; // login:htpass pour tous |
| 322 | 322 | $pwd_admin = ''; // login:htpass pour les admins |
| 323 | 323 | |
| 324 | - $res = sql_select('login, htpass, statut', 'spip_auteurs', "htpass!='' AND login!='' AND " . sql_in('statut', ['1comite', '0minirezo', 'nouveau'])); |
|
| 324 | + $res = sql_select('login, htpass, statut', 'spip_auteurs', "htpass!='' AND login!='' AND ".sql_in('statut', ['1comite', '0minirezo', 'nouveau'])); |
|
| 325 | 325 | while ($row = sql_fetch($res)) { |
| 326 | 326 | if (strlen((string) $row['login']) && strlen((string) $row['htpass'])) { |
| 327 | - $ligne = $row['login'] . ':' . $row['htpass'] . "\n"; |
|
| 327 | + $ligne = $row['login'].':'.$row['htpass']."\n"; |
|
| 328 | 328 | $pwd_all .= $ligne; |
| 329 | 329 | if ($row['statut'] == '0minirezo') { |
| 330 | 330 | $pwd_admin .= $ligne; |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | * @return boolean |
| 368 | 368 | */ |
| 369 | 369 | function verifier_htaccess($rep, $force = false) { |
| 370 | - $htaccess = rtrim($rep, '/') . '/' . _ACCESS_FILE_NAME; |
|
| 370 | + $htaccess = rtrim($rep, '/').'/'._ACCESS_FILE_NAME; |
|
| 371 | 371 | if ((@file_exists($htaccess) || defined('_TEST_DIRS')) && !$force) { |
| 372 | 372 | return true; |
| 373 | 373 | } |
@@ -394,17 +394,17 @@ discard block |
||
| 394 | 394 | fwrite($ht, $deny); |
| 395 | 395 | fclose($ht); |
| 396 | 396 | @chmod($htaccess, _SPIP_CHMOD & 0666); |
| 397 | - $t = rtrim($rep, '/') . '/.ok'; |
|
| 397 | + $t = rtrim($rep, '/').'/.ok'; |
|
| 398 | 398 | if ($ht = @fopen($t, 'w')) { |
| 399 | 399 | @fclose($ht); |
| 400 | 400 | include_spip('inc/distant'); |
| 401 | 401 | $t = substr($t, strlen(_DIR_RACINE)); |
| 402 | - $t = url_de_base() . $t; |
|
| 402 | + $t = url_de_base().$t; |
|
| 403 | 403 | $ht = recuperer_url($t, ['methode' => 'HEAD', 'taille_max' => 0, 'follow_location' => false]); |
| 404 | 404 | $ht = ($ht['status'] ?? null) === 403; |
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | - spip_log("Creation de $htaccess " . ($ht ? ' reussie' : ' manquee')); |
|
| 407 | + spip_log("Creation de $htaccess ".($ht ? ' reussie' : ' manquee')); |
|
| 408 | 408 | |
| 409 | 409 | return $ht; |
| 410 | 410 | } |
@@ -430,11 +430,11 @@ discard block |
||
| 430 | 430 | $dirs = sql_allfetsel('extension', 'spip_types_documents'); |
| 431 | 431 | $dirs[] = ['extension' => 'distant']; |
| 432 | 432 | foreach ($dirs as $e) { |
| 433 | - if (is_dir($dir = _DIR_IMG . $e['extension'])) { |
|
| 433 | + if (is_dir($dir = _DIR_IMG.$e['extension'])) { |
|
| 434 | 434 | if ($f) { |
| 435 | 435 | verifier_htaccess($dir); |
| 436 | 436 | } else { |
| 437 | - spip_unlink($dir . '/' . _ACCESS_FILE_NAME); |
|
| 437 | + spip_unlink($dir.'/'._ACCESS_FILE_NAME); |
|
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | 440 | } |
@@ -81,13 +81,13 @@ discard block |
||
| 81 | 81 | spip_log("supprimer sessions auteur $id_auteur", 'session'); |
| 82 | 82 | if ($toutes || $id_auteur !== $GLOBALS['visiteur_session']['id_auteur']) { |
| 83 | 83 | if ($dir = opendir(_DIR_SESSIONS)) { |
| 84 | - $t = $_SERVER['REQUEST_TIME'] - (4 * _RENOUVELLE_ALEA); // 48h par defaut |
|
| 85 | - $t_short = $_SERVER['REQUEST_TIME'] - max(_RENOUVELLE_ALEA / 4, 3 * 3600); // 3h par defaut |
|
| 84 | + $t = $_SERVER['REQUEST_TIME'] - (4 * _RENOUVELLE_ALEA); // 48h par defaut |
|
| 85 | + $t_short = $_SERVER['REQUEST_TIME'] - max(_RENOUVELLE_ALEA / 4, 3 * 3600); // 3h par defaut |
|
| 86 | 86 | $t = time() - (4 * _RENOUVELLE_ALEA); |
| 87 | 87 | while (($f = readdir($dir)) !== false) { |
| 88 | 88 | $nb_files++; |
| 89 | 89 | if (preg_match(',^[^\d-]*(-?\d+)_\w{32}\.php[3]?$,', $f, $regs)) { |
| 90 | - $f = _DIR_SESSIONS . $f; |
|
| 90 | + $f = _DIR_SESSIONS.$f; |
|
| 91 | 91 | if ($actives && $regs[1] == $id_auteur || $t > filemtime($f)) { |
| 92 | 92 | spip_unlink($f); |
| 93 | 93 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | (!$cookie = lire_cookie_session()) |
| 175 | 175 | || intval($cookie) !== $id_auteur |
| 176 | 176 | ) { |
| 177 | - $cookie = $id_auteur . '_' . md5(uniqid(random_int(0, mt_getrandmax()), true)); |
|
| 177 | + $cookie = $id_auteur.'_'.md5(uniqid(random_int(0, mt_getrandmax()), true)); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | // Maintenant on sait qu'on a des choses à écrire |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | } else { |
| 208 | 208 | $fichier_session = chemin_fichier_session('alea_ephemere', $cookie); |
| 209 | 209 | if (!ecrire_fichier_session($fichier_session, $auteur)) { |
| 210 | - spip_log('Echec ecriture fichier session ' . $fichier_session, 'session' . _LOG_HS); |
|
| 210 | + spip_log('Echec ecriture fichier session '.$fichier_session, 'session'._LOG_HS); |
|
| 211 | 211 | include_spip('inc/minipres'); |
| 212 | 212 | echo minipres(); |
| 213 | 213 | exit; |
@@ -230,9 +230,9 @@ discard block |
||
| 230 | 230 | if (autoriser('ecrire', '', '', $auteur) && _DUREE_COOKIE_ADMIN) { |
| 231 | 231 | spip_setcookie( |
| 232 | 232 | 'spip_admin', |
| 233 | - '@' . ($auteur['email'] ?: $auteur['login']), |
|
| 233 | + '@'.($auteur['email'] ?: $auteur['login']), |
|
| 234 | 234 | time() + max(_DUREE_COOKIE_ADMIN, $duree), |
| 235 | - httponly: true |
|
| 235 | + httponly : true |
|
| 236 | 236 | ); |
| 237 | 237 | } else { |
| 238 | 238 | // sinon le supprimer ... |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $coef = 20; |
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | - return (int)(_RENOUVELLE_ALEA * $coef); |
|
| 273 | + return (int) (_RENOUVELLE_ALEA * $coef); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | |
| 383 | 383 | // Renouveler la session avec l'alea courant |
| 384 | 384 | include($fichier_session); |
| 385 | - spip_log('renouvelle session ' . $GLOBALS['visiteur_session']['id_auteur'], 'session'); |
|
| 385 | + spip_log('renouvelle session '.$GLOBALS['visiteur_session']['id_auteur'], 'session'); |
|
| 386 | 386 | spip_unlink($fichier_session); |
| 387 | 387 | ajouter_session($GLOBALS['visiteur_session']); |
| 388 | 388 | } |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | // liste des sessions |
| 634 | - $sessions = preg_files(_DIR_SESSIONS, '/' . $id_auteur . '_.*\.php$'); |
|
| 634 | + $sessions = preg_files(_DIR_SESSIONS, '/'.$id_auteur.'_.*\.php$'); |
|
| 635 | 635 | |
| 636 | 636 | // si on en a plus que la limite, supprimer les plus vieilles |
| 637 | 637 | // si ce ne sont pas des sessions anonymes car elles sont alors chacune differentes |
@@ -709,12 +709,12 @@ discard block |
||
| 709 | 709 | $auteur = preparer_ecriture_session($auteur); |
| 710 | 710 | |
| 711 | 711 | // enregistrer les autres donnees du visiteur |
| 712 | - $texte = '<' . "?php\n"; |
|
| 712 | + $texte = '<'."?php\n"; |
|
| 713 | 713 | foreach ($auteur as $var => $val) { |
| 714 | - $texte .= '$GLOBALS[\'visiteur_session\'][' . var_export($var, true) . '] = ' |
|
| 715 | - . var_export($val, true) . ";\n"; |
|
| 714 | + $texte .= '$GLOBALS[\'visiteur_session\']['.var_export($var, true).'] = ' |
|
| 715 | + . var_export($val, true).";\n"; |
|
| 716 | 716 | } |
| 717 | - $texte .= '?' . ">\n"; |
|
| 717 | + $texte .= '?'.">\n"; |
|
| 718 | 718 | |
| 719 | 719 | return ecrire_fichier($fichier, $texte); |
| 720 | 720 | } |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | |
| 739 | 739 | $repertoire = sous_repertoire(_DIR_SESSIONS, '', false, $tantpis); |
| 740 | 740 | $id_auteur = intval($cookie_session); |
| 741 | - return $repertoire . $id_auteur . '_' . md5($cookie_session . ' ' . $GLOBALS['meta'][$alea]) . '.php'; |
|
| 741 | + return $repertoire.$id_auteur.'_'.md5($cookie_session.' '.$GLOBALS['meta'][$alea]).'.php'; |
|
| 742 | 742 | } |
| 743 | 743 | |
| 744 | 744 | /** |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | * @return string |
| 767 | 767 | */ |
| 768 | 768 | function rejouer_session() { |
| 769 | - return '<img src="' . generer_url_action('cookie', 'change_session=oui', true) . '" width="0" height="0" alt="" />'; |
|
| 769 | + return '<img src="'.generer_url_action('cookie', 'change_session=oui', true).'" width="0" height="0" alt="" />'; |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | return $res; |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | - return $res = md5($GLOBALS['ip'] . ($_SERVER['HTTP_USER_AGENT'] ?? '')); |
|
| 784 | + return $res = md5($GLOBALS['ip'].($_SERVER['HTTP_USER_AGENT'] ?? '')); |
|
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | ) { |
| 193 | 193 | $r = nettoyer_url_page($url, $contexte); |
| 194 | 194 | if ($r) { |
| 195 | - [$contexte, $type, , , $suite] = $r; |
|
| 195 | + [$contexte, $type,,, $suite] = $r; |
|
| 196 | 196 | $_id = id_table_objet($type); |
| 197 | 197 | $id_objet = $contexte[$_id]; |
| 198 | 198 | $url_propre = generer_objet_url($id_objet, $type); |
@@ -263,9 +263,9 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | function nettoyer_url_page($url, $contexte = []) { |
| 265 | 265 | $url_objets = urls_liste_objets(); |
| 266 | - $raccourci_url_page_html = ',^(?:[^?]*/)?(' . $url_objets . ')([0-9]+)(?:\.html)?([?&].*)?$,'; |
|
| 267 | - $raccourci_url_page_id = ',^(?:[^?]*/)?(' . $url_objets . ')\.php3?[?]id_\1=([0-9]+)([?&].*)?$,'; |
|
| 268 | - $raccourci_url_page_spip = ',^(?:[^?]*/)?(?:spip[.]php)?[?](' . $url_objets . ')([0-9]+)=?(&.*)?$,'; |
|
| 266 | + $raccourci_url_page_html = ',^(?:[^?]*/)?('.$url_objets.')([0-9]+)(?:\.html)?([?&].*)?$,'; |
|
| 267 | + $raccourci_url_page_id = ',^(?:[^?]*/)?('.$url_objets.')\.php3?[?]id_\1=([0-9]+)([?&].*)?$,'; |
|
| 268 | + $raccourci_url_page_spip = ',^(?:[^?]*/)?(?:spip[.]php)?[?]('.$url_objets.')([0-9]+)=?(&.*)?$,'; |
|
| 269 | 269 | |
| 270 | 270 | if ( |
| 271 | 271 | preg_match($raccourci_url_page_html, $url, $regs) |
@@ -303,9 +303,9 @@ discard block |
||
| 303 | 303 | $id = intval($id); |
| 304 | 304 | if (!isset($furls[$objet])) { |
| 305 | 305 | if ( |
| 306 | - function_exists($f = 'generer_' . $objet . '_url_ecrire') |
|
| 306 | + function_exists($f = 'generer_'.$objet.'_url_ecrire') |
|
| 307 | 307 | || ($f = charger_fonction($f, 'urls', true)) |
| 308 | - || function_exists($f = 'generer_url_ecrire_' . $objet) // deprecated |
|
| 308 | + || function_exists($f = 'generer_url_ecrire_'.$objet) // deprecated |
|
| 309 | 309 | || ($f = charger_fonction($f, 'urls', true)) // deprecated |
| 310 | 310 | ) { |
| 311 | 311 | $furls[$objet] = $f; |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | if ($public || $connect) { |
| 325 | 325 | return generer_objet_url_absolue($id, $objet, $args, $ancre, $public, '', $connect); |
| 326 | 326 | } |
| 327 | - $a = id_table_objet($objet) . '=' . intval($id); |
|
| 327 | + $a = id_table_objet($objet).'='.intval($id); |
|
| 328 | 328 | if (!function_exists('objet_info')) { |
| 329 | 329 | include_spip('inc/filtres'); |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - return generer_url_ecrire(objet_info($objet, 'url_voir'), $a . ($args ? "&$args" : '')) . ($ancre ? "#$ancre" : ''); |
|
| 332 | + return generer_url_ecrire(objet_info($objet, 'url_voir'), $a.($args ? "&$args" : '')).($ancre ? "#$ancre" : ''); |
|
| 333 | 333 | } |