@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | include_spip('base/abstract_sql'); |
| 61 | - $res = sql_select('statut, id_auteur, login, email, nom', 'spip_auteurs', 'email=' . sql_quote($desc['email'])); |
|
| 61 | + $res = sql_select('statut, id_auteur, login, email, nom', 'spip_auteurs', 'email='.sql_quote($desc['email'])); |
|
| 62 | 62 | // erreur ? |
| 63 | 63 | if (!$res) { |
| 64 | 64 | return _T('titre_probleme_technique'); |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | $login = $login_base; |
| 211 | 211 | |
| 212 | - for ($i = 1;; $i++) { |
|
| 212 | + for ($i = 1; ; $i++) { |
|
| 213 | 213 | if (!sql_countsel('spip_auteurs', "login='$login'")) { |
| 214 | 214 | return $login; |
| 215 | 215 | } |
| 216 | - $login = $login_base . $i; |
|
| 216 | + $login = $login_base.$i; |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
@@ -353,11 +353,11 @@ discard block |
||
| 353 | 353 | do { |
| 354 | 354 | // Un morceau du jeton est lisible en bdd pour éviter de devoir déchiffrer |
| 355 | 355 | // tous les jetons connus pour vérifier le jeton d’un auteur. |
| 356 | - $public = substr((string) creer_uniqid(), 0, 7) . '.'; |
|
| 357 | - $jeton = $public . creer_uniqid(); |
|
| 358 | - $jeton_chiffre_prefixe = $public . Chiffrement::chiffrer($jeton, SpipCles::secret_du_site()); |
|
| 359 | - sql_updateq('spip_auteurs', ['cookie_oubli' => $jeton_chiffre_prefixe], 'id_auteur=' . (int) $id_auteur); |
|
| 360 | - } while (sql_countsel('spip_auteurs', 'cookie_oubli=' . sql_quote($jeton_chiffre_prefixe, '', 'string')) > 1); |
|
| 356 | + $public = substr((string) creer_uniqid(), 0, 7).'.'; |
|
| 357 | + $jeton = $public.creer_uniqid(); |
|
| 358 | + $jeton_chiffre_prefixe = $public.Chiffrement::chiffrer($jeton, SpipCles::secret_du_site()); |
|
| 359 | + sql_updateq('spip_auteurs', ['cookie_oubli' => $jeton_chiffre_prefixe], 'id_auteur='.(int) $id_auteur); |
|
| 360 | + } while (sql_countsel('spip_auteurs', 'cookie_oubli='.sql_quote($jeton_chiffre_prefixe, '', 'string')) > 1); |
|
| 361 | 361 | |
| 362 | 362 | return $jeton; |
| 363 | 363 | } |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | function auteur_lire_jeton(int $id_auteur, bool $autoInit = false): ?string { |
| 376 | 376 | include_spip('base/abstract_sql'); |
| 377 | - $jeton_chiffre_prefixe = sql_getfetsel('cookie_oubli', 'spip_auteurs', 'id_auteur=' . $id_auteur); |
|
| 377 | + $jeton_chiffre_prefixe = sql_getfetsel('cookie_oubli', 'spip_auteurs', 'id_auteur='.$id_auteur); |
|
| 378 | 378 | if ($jeton_chiffre_prefixe) { |
| 379 | 379 | $jeton_chiffre = substr((string) $jeton_chiffre_prefixe, 8); |
| 380 | 380 | $jeton = Chiffrement::dechiffrer($jeton_chiffre, SpipCles::secret_du_site()); |
@@ -404,13 +404,13 @@ discard block |
||
| 404 | 404 | $public = substr($jeton, 0, 8); |
| 405 | 405 | |
| 406 | 406 | // Les auteurs qui ont un jetons ressemblant |
| 407 | - $auteurs = sql_allfetsel('*', 'spip_auteurs', 'cookie_oubli LIKE ' . sql_quote($public . '%')); |
|
| 407 | + $auteurs = sql_allfetsel('*', 'spip_auteurs', 'cookie_oubli LIKE '.sql_quote($public.'%')); |
|
| 408 | 408 | foreach ($auteurs as $auteur) { |
| 409 | 409 | $jeton_chiffre = substr((string) $auteur['cookie_oubli'], 8); |
| 410 | 410 | try { |
| 411 | 411 | $_jeton = Chiffrement::dechiffrer($jeton_chiffre, SpipCles::secret_du_site()); |
| 412 | 412 | } catch (\Exception $e) { |
| 413 | - spip_log('Échec du déchiffrage du jeton d’auteur: ' . $e->getMessage(), 'chiffrer.' . _LOG_ERREUR); |
|
| 413 | + spip_log('Échec du déchiffrage du jeton d’auteur: '.$e->getMessage(), 'chiffrer.'._LOG_ERREUR); |
|
| 414 | 414 | return false; |
| 415 | 415 | } |
| 416 | 416 | if ($_jeton && hash_equals($jeton, $_jeton)) { |
@@ -428,5 +428,5 @@ discard block |
||
| 428 | 428 | */ |
| 429 | 429 | function auteur_effacer_jeton($id_auteur) { |
| 430 | 430 | include_spip('base/abstract_sql'); |
| 431 | - return sql_updateq('spip_auteurs', ['cookie_oubli' => ''], 'id_auteur=' . (int) $id_auteur); |
|
| 431 | + return sql_updateq('spip_auteurs', ['cookie_oubli' => ''], 'id_auteur='.(int) $id_auteur); |
|
| 432 | 432 | } |
@@ -81,12 +81,12 @@ 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 | while (($f = readdir($dir)) !== false) { |
| 87 | 87 | $nb_files++; |
| 88 | 88 | if (preg_match(',^[^\d-]*(-?\d+)_\w{32}\.php[3]?$,', $f, $regs)) { |
| 89 | - $f = _DIR_SESSIONS . $f; |
|
| 89 | + $f = _DIR_SESSIONS.$f; |
|
| 90 | 90 | if ($actives && $regs[1] == $id_auteur || $t > filemtime($f)) { |
| 91 | 91 | spip_unlink($f); |
| 92 | 92 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | (!$cookie = lire_cookie_session()) |
| 174 | 174 | || intval($cookie) !== $id_auteur |
| 175 | 175 | ) { |
| 176 | - $cookie = $id_auteur . '_' . md5(uniqid(random_int(0, mt_getrandmax()), true)); |
|
| 176 | + $cookie = $id_auteur.'_'.md5(uniqid(random_int(0, mt_getrandmax()), true)); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // Maintenant on sait qu'on a des choses à écrire |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | } else { |
| 207 | 207 | $fichier_session = chemin_fichier_session('alea_ephemere', $cookie); |
| 208 | 208 | if (!ecrire_fichier_session($fichier_session, $auteur)) { |
| 209 | - spip_log('Echec ecriture fichier session ' . $fichier_session, 'session' . _LOG_HS); |
|
| 209 | + spip_log('Echec ecriture fichier session '.$fichier_session, 'session'._LOG_HS); |
|
| 210 | 210 | include_spip('inc/minipres'); |
| 211 | 211 | echo minipres(); |
| 212 | 212 | exit; |
@@ -229,9 +229,9 @@ discard block |
||
| 229 | 229 | if (autoriser('ecrire', '', '', $auteur) && _DUREE_COOKIE_ADMIN) { |
| 230 | 230 | spip_setcookie( |
| 231 | 231 | 'spip_admin', |
| 232 | - '@' . ($auteur['email'] ?: $auteur['login']), |
|
| 232 | + '@'.($auteur['email'] ?: $auteur['login']), |
|
| 233 | 233 | time() + max(_DUREE_COOKIE_ADMIN, $duree), |
| 234 | - httponly: true |
|
| 234 | + httponly : true |
|
| 235 | 235 | ); |
| 236 | 236 | } else { |
| 237 | 237 | // sinon le supprimer ... |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $coef = 20; |
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | - return (int)(_RENOUVELLE_ALEA * $coef); |
|
| 272 | + return (int) (_RENOUVELLE_ALEA * $coef); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | |
| 382 | 382 | // Renouveler la session avec l'alea courant |
| 383 | 383 | include($fichier_session); |
| 384 | - spip_log('renouvelle session ' . $GLOBALS['visiteur_session']['id_auteur'], 'session'); |
|
| 384 | + spip_log('renouvelle session '.$GLOBALS['visiteur_session']['id_auteur'], 'session'); |
|
| 385 | 385 | spip_unlink($fichier_session); |
| 386 | 386 | ajouter_session($GLOBALS['visiteur_session']); |
| 387 | 387 | } |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | // liste des sessions |
| 633 | - $sessions = preg_files(_DIR_SESSIONS, '/' . $id_auteur . '_.*\.php$'); |
|
| 633 | + $sessions = preg_files(_DIR_SESSIONS, '/'.$id_auteur.'_.*\.php$'); |
|
| 634 | 634 | |
| 635 | 635 | // si on en a plus que la limite, supprimer les plus vieilles |
| 636 | 636 | // si ce ne sont pas des sessions anonymes car elles sont alors chacune differentes |
@@ -708,12 +708,12 @@ discard block |
||
| 708 | 708 | $auteur = preparer_ecriture_session($auteur); |
| 709 | 709 | |
| 710 | 710 | // enregistrer les autres donnees du visiteur |
| 711 | - $texte = '<' . "?php\n"; |
|
| 711 | + $texte = '<'."?php\n"; |
|
| 712 | 712 | foreach ($auteur as $var => $val) { |
| 713 | - $texte .= '$GLOBALS[\'visiteur_session\'][' . var_export($var, true) . '] = ' |
|
| 714 | - . var_export($val, true) . ";\n"; |
|
| 713 | + $texte .= '$GLOBALS[\'visiteur_session\']['.var_export($var, true).'] = ' |
|
| 714 | + . var_export($val, true).";\n"; |
|
| 715 | 715 | } |
| 716 | - $texte .= '?' . ">\n"; |
|
| 716 | + $texte .= '?'.">\n"; |
|
| 717 | 717 | |
| 718 | 718 | return ecrire_fichier($fichier, $texte); |
| 719 | 719 | } |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | |
| 738 | 738 | $repertoire = sous_repertoire(_DIR_SESSIONS, '', false, $tantpis); |
| 739 | 739 | $id_auteur = intval($cookie_session); |
| 740 | - return $repertoire . $id_auteur . '_' . md5($cookie_session . ' ' . $GLOBALS['meta'][$alea]) . '.php'; |
|
| 740 | + return $repertoire.$id_auteur.'_'.md5($cookie_session.' '.$GLOBALS['meta'][$alea]).'.php'; |
|
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | /** |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | * @return string |
| 766 | 766 | */ |
| 767 | 767 | function rejouer_session() { |
| 768 | - return '<img src="' . generer_url_action('cookie', 'change_session=oui', true) . '" width="0" height="0" alt="" />'; |
|
| 768 | + return '<img src="'.generer_url_action('cookie', 'change_session=oui', true).'" width="0" height="0" alt="" />'; |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | return $res; |
| 781 | 781 | } |
| 782 | 782 | |
| 783 | - return $res = md5($GLOBALS['ip'] . ($_SERVER['HTTP_USER_AGENT'] ?? '')); |
|
| 783 | + return $res = md5($GLOBALS['ip'].($_SERVER['HTTP_USER_AGENT'] ?? '')); |
|
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | define('_INC_DISTANT_CONTENT_ENCODING', 'gzip'); |
| 28 | 28 | } |
| 29 | 29 | if (!defined('_INC_DISTANT_USER_AGENT')) { |
| 30 | - define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')'); |
|
| 30 | + define('_INC_DISTANT_USER_AGENT', 'SPIP-'.$GLOBALS['spip_version_affichee'].' ('.$GLOBALS['home_server'].')'); |
|
| 31 | 31 | } |
| 32 | 32 | if (!defined('_INC_DISTANT_MAX_SIZE')) { |
| 33 | 33 | define('_INC_DISTANT_MAX_SIZE', 2_097_152); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | define('_INC_DISTANT_CONNECT_TIMEOUT', 10); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | -define('_REGEXP_COPIE_LOCALE', ',' . |
|
| 39 | +define('_REGEXP_COPIE_LOCALE', ','. |
|
| 40 | 40 | preg_replace( |
| 41 | 41 | '@^https?:@', |
| 42 | 42 | 'https?:', |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | // si c'est la protection de soi-meme, retourner le path |
| 75 | 75 | if ($mode !== 'force' && preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) { |
| 76 | - $source = substr((string) _DIR_IMG, strlen((string) _DIR_RACINE)) . urldecode($match[1]); |
|
| 76 | + $source = substr((string) _DIR_IMG, strlen((string) _DIR_RACINE)).urldecode($match[1]); |
|
| 77 | 77 | |
| 78 | 78 | return @file_exists($source) ? $source : false; |
| 79 | 79 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | return false; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $localrac = _DIR_RACINE . $local; |
|
| 96 | + $localrac = _DIR_RACINE.$local; |
|
| 97 | 97 | $t = ($mode === 'force') ? false : @file_exists($localrac); |
| 98 | 98 | |
| 99 | 99 | // test d'existence du fichier |
@@ -113,17 +113,17 @@ discard block |
||
| 113 | 113 | if (!$taille_max) { |
| 114 | 114 | $taille_max = _COPIE_LOCALE_MAX_SIZE; |
| 115 | 115 | } |
| 116 | - $localrac_tmp = $localrac . '.tmp'; |
|
| 116 | + $localrac_tmp = $localrac.'.tmp'; |
|
| 117 | 117 | $res = recuperer_url( |
| 118 | 118 | $source, |
| 119 | 119 | ['file' => $localrac_tmp, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : ''] |
| 120 | 120 | ); |
| 121 | 121 | |
| 122 | 122 | if (!$res || !$res['length'] && $res['status'] != 304) { |
| 123 | - spip_log("copie_locale : Echec recuperation $source sur $localrac_tmp status : " . ($res ? $res['status'] : '-'), 'distant' . _LOG_INFO_IMPORTANTE); |
|
| 123 | + spip_log("copie_locale : Echec recuperation $source sur $localrac_tmp status : ".($res ? $res['status'] : '-'), 'distant'._LOG_INFO_IMPORTANTE); |
|
| 124 | 124 | @unlink($localrac_tmp); |
| 125 | 125 | } else { |
| 126 | - spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant'); |
|
| 126 | + spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille ".$res['length'].' status '.$res['status'], 'distant'); |
|
| 127 | 127 | } |
| 128 | 128 | if (!$res || !$res['length']) { |
| 129 | 129 | // si $t c'est sans doute juste un not-modified-since |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | && is_callable($callback_valider_url) |
| 137 | 137 | && !$callback_valider_url($res['url']) |
| 138 | 138 | ) { |
| 139 | - spip_log('copie_locale : url finale ' . $res['url'] . " non valide, on refuse le fichier $localrac_tmp", 'distant' . _LOG_INFO_IMPORTANTE); |
|
| 139 | + spip_log('copie_locale : url finale '.$res['url']." non valide, on refuse le fichier $localrac_tmp", 'distant'._LOG_INFO_IMPORTANTE); |
|
| 140 | 140 | @unlink($localrac_tmp); |
| 141 | 141 | return $t ? $local : false; |
| 142 | 142 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | if (!$is_known_host) { |
| 228 | 228 | $host = trim($parsed_url['host'], '.'); |
| 229 | - if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) { |
|
| 229 | + if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) { |
|
| 230 | 230 | $ip = gethostbyname($host); |
| 231 | 231 | if ($ip === $host) { |
| 232 | 232 | // Error condition for gethostbyname() |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $ip = false; |
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | - if ($ip && ! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
| 249 | + if ($ip && !filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
| 250 | 250 | return false; |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | if ($taille > 500) { |
| 330 | - $boundary = substr(md5(random_int(0, mt_getrandmax()) . 'spip'), 0, 8); |
|
| 330 | + $boundary = substr(md5(random_int(0, mt_getrandmax()).'spip'), 0, 8); |
|
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | |
@@ -360,10 +360,10 @@ discard block |
||
| 360 | 360 | foreach ($donnees as $cle => $valeur) { |
| 361 | 361 | if (is_array($valeur)) { |
| 362 | 362 | foreach ($valeur as $val2) { |
| 363 | - $chaines[] = rawurlencode($cle) . '[]=' . rawurlencode((string) $val2); |
|
| 363 | + $chaines[] = rawurlencode($cle).'[]='.rawurlencode((string) $val2); |
|
| 364 | 364 | } |
| 365 | 365 | } else { |
| 366 | - $chaines[] = rawurlencode($cle) . '=' . rawurlencode((string) $valeur); |
|
| 366 | + $chaines[] = rawurlencode($cle).'='.rawurlencode((string) $valeur); |
|
| 367 | 367 | } |
| 368 | 368 | } |
| 369 | 369 | $chaine = implode('&', $chaines); |
@@ -465,13 +465,13 @@ discard block |
||
| 465 | 465 | $options['taille_max'] = $copy ? _COPIE_LOCALE_MAX_SIZE : _INC_DISTANT_MAX_SIZE; |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - spip_log('recuperer_url ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG); |
|
| 468 | + spip_log('recuperer_url '.$options['methode']." sur $url", 'distant'._LOG_DEBUG); |
|
| 469 | 469 | |
| 470 | 470 | // Ajout des en-têtes spécifiques si besoin |
| 471 | 471 | $formatted_data = ''; |
| 472 | 472 | if (!empty($options['headers'])) { |
| 473 | 473 | foreach ($options['headers'] as $champ => $valeur) { |
| 474 | - $formatted_data .= $champ . ': ' . $valeur . "\r\n"; |
|
| 474 | + $formatted_data .= $champ.': '.$valeur."\r\n"; |
|
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | 477 | |
@@ -479,9 +479,9 @@ discard block |
||
| 479 | 479 | [$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']); |
| 480 | 480 | $head .= $formatted_data; |
| 481 | 481 | if (stripos($head, 'Content-Length:') === false) { |
| 482 | - $head .= 'Content-Length: ' . strlen((string) $postdata) . "\r\n"; |
|
| 482 | + $head .= 'Content-Length: '.strlen((string) $postdata)."\r\n"; |
|
| 483 | 483 | } |
| 484 | - $formatted_data = $head . "\r\n" . $postdata; |
|
| 484 | + $formatted_data = $head."\r\n".$postdata; |
|
| 485 | 485 | if ( |
| 486 | 486 | strlen((string) $postdata) && !$methode_demandee |
| 487 | 487 | ) { |
@@ -494,9 +494,9 @@ discard block |
||
| 494 | 494 | // Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole |
| 495 | 495 | $url = preg_replace(',^feed://,i', 'http://', $url); |
| 496 | 496 | if (!tester_url_absolue($url)) { |
| 497 | - $url = 'http://' . $url; |
|
| 497 | + $url = 'http://'.$url; |
|
| 498 | 498 | } elseif (str_starts_with($url, '//')) { |
| 499 | - $url = 'http:' . $url; |
|
| 499 | + $url = 'http:'.$url; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | $url = url_to_ascii($url); |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | $options['if_modified_since'] |
| 526 | 526 | ); |
| 527 | 527 | if (!$handle) { |
| 528 | - spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR); |
|
| 528 | + spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR); |
|
| 529 | 529 | |
| 530 | 530 | return false; |
| 531 | 531 | } |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | 'status' => 200, |
| 556 | 556 | ]; |
| 557 | 557 | } else { |
| 558 | - spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR); |
|
| 558 | + spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR); |
|
| 559 | 559 | return false; |
| 560 | 560 | } |
| 561 | 561 | } elseif ($res['location'] && $options['follow_location']) { |
@@ -572,11 +572,11 @@ discard block |
||
| 572 | 572 | $options['methode'] = 'GET'; |
| 573 | 573 | $options['datas'] = ''; |
| 574 | 574 | } |
| 575 | - spip_log('recuperer_url recommence ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG); |
|
| 575 | + spip_log('recuperer_url recommence '.$options['methode']." sur $url", 'distant'._LOG_DEBUG); |
|
| 576 | 576 | |
| 577 | 577 | return recuperer_url($url, $options); |
| 578 | 578 | } elseif ($res['status'] !== 200) { |
| 579 | - spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant'); |
|
| 579 | + spip_log('HTTP status '.$res['status']." pour $url", 'distant'); |
|
| 580 | 580 | } |
| 581 | 581 | $result['status'] = $res['status']; |
| 582 | 582 | if (isset($res['headers'])) { |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | // on ne veut que les entetes |
| 594 | 594 | if (!$options['taille_max'] || $options['methode'] == 'HEAD' || $result['status'] == '304') { |
| 595 | - spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($result, JSON_THROW_ON_ERROR), 'distant' . _LOG_DEBUG); |
|
| 595 | + spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($result, JSON_THROW_ON_ERROR), 'distant'._LOG_DEBUG); |
|
| 596 | 596 | return $result; |
| 597 | 597 | } |
| 598 | 598 | |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | $gz = false; |
| 604 | 604 | if (preg_match(",\bContent-Encoding: .*gzip,is", (string) $result['headers'])) { |
| 605 | - $gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz'); |
|
| 605 | + $gz = (_DIR_TMP.md5(uniqid(random_int(0, mt_getrandmax()))).'.tmp.gz'); |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | // si on a pas deja recuperer le contenu par une methode detournee |
@@ -640,10 +640,10 @@ discard block |
||
| 640 | 640 | $trace = json_decode(json_encode($result, JSON_THROW_ON_ERROR), true, 512, JSON_THROW_ON_ERROR); |
| 641 | 641 | } catch (JsonException $e) { |
| 642 | 642 | $trace = []; |
| 643 | - spip_log('Failed to parse Json data : ' . $e->getMessage(), _LOG_ERREUR); |
|
| 643 | + spip_log('Failed to parse Json data : '.$e->getMessage(), _LOG_ERREUR); |
|
| 644 | 644 | } |
| 645 | 645 | $trace['page'] = '...'; |
| 646 | - spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($trace, JSON_THROW_ON_ERROR), 'distant' . _LOG_DEBUG); |
|
| 646 | + spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($trace, JSON_THROW_ON_ERROR), 'distant'._LOG_DEBUG); |
|
| 647 | 647 | |
| 648 | 648 | return $result; |
| 649 | 649 | } |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | $sig['url'] = $url; |
| 698 | 698 | |
| 699 | 699 | $dir = sous_repertoire(_DIR_CACHE, 'curl'); |
| 700 | - $cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 700 | + $cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 701 | 701 | $sub = sous_repertoire($dir, substr($cache, 0, 2)); |
| 702 | 702 | $cache = "$sub$cache"; |
| 703 | 703 | |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | $fp = false; |
| 752 | 752 | if ($fichier) { |
| 753 | 753 | include_spip('inc/acces'); |
| 754 | - $tmpfile = "$fichier." . creer_uniqid() . '.tmp'; |
|
| 754 | + $tmpfile = "$fichier.".creer_uniqid().'.tmp'; |
|
| 755 | 755 | $fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX); |
| 756 | 756 | if (!$fp && file_exists($fichier)) { |
| 757 | 757 | return filesize($fichier); |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | } |
| 811 | 811 | $result['status'] = (int) $r[1]; |
| 812 | 812 | while ($s = trim(fgets($handle, 16384))) { |
| 813 | - $result['headers'][] = $s . "\n"; |
|
| 813 | + $result['headers'][] = $s."\n"; |
|
| 814 | 814 | preg_match(',^([^:]*): *(.*)$,i', $s, $r); |
| 815 | 815 | [, $d, $v] = $r; |
| 816 | 816 | if (strtolower(trim($d)) == 'location' && $result['status'] >= 300 && $result['status'] < 400) { |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | |
| 860 | 860 | // on se place tout le temps comme si on était a la racine |
| 861 | 861 | if (_DIR_RACINE) { |
| 862 | - $d = preg_replace(',^' . preg_quote((string) _DIR_RACINE, ',') . ',', '', (string) $d); |
|
| 862 | + $d = preg_replace(',^'.preg_quote((string) _DIR_RACINE, ',').',', '', (string) $d); |
|
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | $m = md5($source); |
@@ -867,18 +867,18 @@ discard block |
||
| 867 | 867 | $filename = |
| 868 | 868 | $d |
| 869 | 869 | . substr(preg_replace(',[^\w-],', '', basename($source, $extension)), 0, 16) |
| 870 | - . '-' . substr($m, 0, 8) |
|
| 870 | + . '-'.substr($m, 0, 8) |
|
| 871 | 871 | . ".$extension"; |
| 872 | 872 | |
| 873 | 873 | // ancien nommage des fichiers distants : renommer le fichier a la volee si besoin pour eviter de dupliquer les caches |
| 874 | 874 | $legacy_filename = |
| 875 | 875 | $d |
| 876 | - . substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12) |
|
| 876 | + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12) |
|
| 877 | 877 | . substr($m, 0, 4) |
| 878 | 878 | . ".$extension"; |
| 879 | 879 | |
| 880 | - if (file_exists(_DIR_RACINE . $legacy_filename)) { |
|
| 881 | - @rename(_DIR_RACINE . $legacy_filename, $filename); |
|
| 880 | + if (file_exists(_DIR_RACINE.$legacy_filename)) { |
|
| 881 | + @rename(_DIR_RACINE.$legacy_filename, $filename); |
|
| 882 | 882 | } |
| 883 | 883 | |
| 884 | 884 | return $filename; |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | // Si c'est deja local pas de souci |
| 904 | 904 | if (!tester_url_absolue($source)) { |
| 905 | 905 | if (_DIR_RACINE) { |
| 906 | - $source = preg_replace(',^' . preg_quote((string) _DIR_RACINE, ',') . ',', '', $source); |
|
| 906 | + $source = preg_replace(',^'.preg_quote((string) _DIR_RACINE, ',').',', '', $source); |
|
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | return $source; |
@@ -921,7 +921,7 @@ discard block |
||
| 921 | 921 | $ext |
| 922 | 922 | && preg_match(',^\w+$,', $ext) |
| 923 | 923 | && ($f = nom_fichier_copie_locale($source, $ext)) |
| 924 | - && file_exists(_DIR_RACINE . $f) |
|
| 924 | + && file_exists(_DIR_RACINE.$f) |
|
| 925 | 925 | ) { |
| 926 | 926 | return $f; |
| 927 | 927 | } |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | |
| 930 | 930 | // Si c'est deja dans la table des documents, |
| 931 | 931 | // ramener le nom de sa copie potentielle |
| 932 | - $ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''"); |
|
| 932 | + $ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''"); |
|
| 933 | 933 | |
| 934 | 934 | if ($ext) { |
| 935 | 935 | return nom_fichier_copie_locale($source, $ext); |
@@ -940,9 +940,9 @@ discard block |
||
| 940 | 940 | |
| 941 | 941 | $ext = $path_parts ? $path_parts['extension'] : ''; |
| 942 | 942 | |
| 943 | - if ($ext && sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 943 | + if ($ext && sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 944 | 944 | $f = nom_fichier_copie_locale($source, $ext); |
| 945 | - if (file_exists(_DIR_RACINE . $f)) { |
|
| 945 | + if (file_exists(_DIR_RACINE.$f)) { |
|
| 946 | 946 | return $f; |
| 947 | 947 | } |
| 948 | 948 | } |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | // Ping pour voir si son extension est connue et autorisee |
| 951 | 951 | // avec mise en cache du resultat du ping |
| 952 | 952 | |
| 953 | - $cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source); |
|
| 953 | + $cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source); |
|
| 954 | 954 | if ( |
| 955 | 955 | !@file_exists($cache) |
| 956 | 956 | || !($path_parts = @unserialize(spip_file_get_contents($cache))) |
@@ -960,11 +960,11 @@ discard block |
||
| 960 | 960 | ecrire_fichier($cache, serialize($path_parts)); |
| 961 | 961 | } |
| 962 | 962 | $ext = empty($path_parts['extension']) ? '' : $path_parts['extension']; |
| 963 | - if ($ext && sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 963 | + if ($ext && sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 964 | 964 | return nom_fichier_copie_locale($source, $ext); |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | - spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR); |
|
| 967 | + spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR); |
|
| 968 | 968 | return null; |
| 969 | 969 | } |
| 970 | 970 | |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | } else { |
| 1067 | 1067 | if ($a['body']) { |
| 1068 | 1068 | $a['extension'] = corriger_extension($extension); |
| 1069 | - $a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension); |
|
| 1069 | + $a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension); |
|
| 1070 | 1070 | ecrire_fichier($a['fichier'], $a['body']); |
| 1071 | 1071 | $size_image = @spip_getimagesize($a['fichier']); |
| 1072 | 1072 | $a['largeur'] = (int) $size_image[0]; |
@@ -1138,20 +1138,20 @@ discard block |
||
| 1138 | 1138 | $t = null; |
| 1139 | 1139 | if (in_array($mime_type, ['text/plain', '', 'application/octet-stream'])) { |
| 1140 | 1140 | if (!$t && preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)) { |
| 1141 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1141 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1142 | 1142 | } |
| 1143 | 1143 | if ( |
| 1144 | 1144 | !$t |
| 1145 | 1145 | && preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m) |
| 1146 | 1146 | && preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext) |
| 1147 | 1147 | ) { |
| 1148 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1148 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1149 | 1149 | } |
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | // Autre mime/type (ou text/plain avec fichier d'extension inconnue) |
| 1153 | 1153 | if (!$t) { |
| 1154 | - $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type)); |
|
| 1154 | + $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type)); |
|
| 1155 | 1155 | } |
| 1156 | 1156 | |
| 1157 | 1157 | // Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg) |
@@ -1162,11 +1162,11 @@ discard block |
||
| 1162 | 1162 | && preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1163 | 1163 | ) { |
| 1164 | 1164 | # eviter xxx.3 => 3gp (> SPIP 3) |
| 1165 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1165 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | 1168 | if ($t) { |
| 1169 | - spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant'); |
|
| 1169 | + spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant'); |
|
| 1170 | 1170 | return $t['extension']; |
| 1171 | 1171 | } else { |
| 1172 | 1172 | # par defaut on retombe sur '.bin' si c'est autorise |
@@ -1269,7 +1269,7 @@ discard block |
||
| 1269 | 1269 | } |
| 1270 | 1270 | } else { |
| 1271 | 1271 | $scheme = $t['scheme']; |
| 1272 | - $noproxy = $scheme . '://'; |
|
| 1272 | + $noproxy = $scheme.'://'; |
|
| 1273 | 1273 | } |
| 1274 | 1274 | if (isset($t['user'])) { |
| 1275 | 1275 | // user et pass doivent être passés en urlencodé dans l'URL, on redecode ici |
@@ -1284,7 +1284,7 @@ discard block |
||
| 1284 | 1284 | } |
| 1285 | 1285 | |
| 1286 | 1286 | if (!empty($t['query'])) { |
| 1287 | - $path .= '?' . $t['query']; |
|
| 1287 | + $path .= '?'.$t['query']; |
|
| 1288 | 1288 | } |
| 1289 | 1289 | |
| 1290 | 1290 | $f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date); |
@@ -1358,29 +1358,29 @@ discard block |
||
| 1358 | 1358 | $proxy_user = ''; |
| 1359 | 1359 | $http_proxy = need_proxy($host); |
| 1360 | 1360 | if ($user) { |
| 1361 | - $user = urlencode((string) $user[0]) . ':' . urlencode((string) $user[1]); |
|
| 1361 | + $user = urlencode((string) $user[0]).':'.urlencode((string) $user[1]); |
|
| 1362 | 1362 | } |
| 1363 | 1363 | |
| 1364 | 1364 | $connect = ''; |
| 1365 | 1365 | if ($http_proxy) { |
| 1366 | - if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') && in_array($scheme, ['tls','ssl'])) { |
|
| 1367 | - $path_host = ($user ? "$user@" : '') . $host . (($port != 80) ? ":$port" : ''); |
|
| 1368 | - $connect = 'CONNECT ' . $path_host . " $vers\r\n" |
|
| 1366 | + if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') && in_array($scheme, ['tls', 'ssl'])) { |
|
| 1367 | + $path_host = ($user ? "$user@" : '').$host.(($port != 80) ? ":$port" : ''); |
|
| 1368 | + $connect = 'CONNECT '.$path_host." $vers\r\n" |
|
| 1369 | 1369 | . "Host: $path_host\r\n" |
| 1370 | 1370 | . "Proxy-Connection: Keep-Alive\r\n"; |
| 1371 | 1371 | } else { |
| 1372 | - $path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://") |
|
| 1372 | + $path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://") |
|
| 1373 | 1373 | . ($user ? "$user@" : '') |
| 1374 | - . "$host" . (($port != 80) ? ":$port" : '') . $path; |
|
| 1374 | + . "$host".(($port != 80) ? ":$port" : '').$path; |
|
| 1375 | 1375 | } |
| 1376 | 1376 | $t2 = @parse_url($http_proxy); |
| 1377 | 1377 | $first_host = $t2['host']; |
| 1378 | 1378 | $first_port = ($t2['port'] ?? null) ?: 80; |
| 1379 | 1379 | if ($t2['user'] ?? null) { |
| 1380 | - $proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']); |
|
| 1380 | + $proxy_user = base64_encode($t2['user'].':'.$t2['pass']); |
|
| 1381 | 1381 | } |
| 1382 | 1382 | } else { |
| 1383 | - $first_host = $noproxy . $host; |
|
| 1383 | + $first_host = $noproxy.$host; |
|
| 1384 | 1384 | $first_port = $port; |
| 1385 | 1385 | } |
| 1386 | 1386 | |
@@ -1403,7 +1403,7 @@ discard block |
||
| 1403 | 1403 | ); |
| 1404 | 1404 | spip_log("Recuperer $path sur $first_host:$first_port par $f (via CONNECT)", 'connect'); |
| 1405 | 1405 | if (!$f) { |
| 1406 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1406 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1407 | 1407 | return $errno; |
| 1408 | 1408 | } |
| 1409 | 1409 | stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT); |
@@ -1416,7 +1416,7 @@ discard block |
||
| 1416 | 1416 | || ($res = explode(' ', $res)) === [] |
| 1417 | 1417 | || $res[1] !== '200' |
| 1418 | 1418 | ) { |
| 1419 | - spip_log("Echec CONNECT sur $first_host:$first_port", 'connect' . _LOG_INFO_IMPORTANTE); |
|
| 1419 | + spip_log("Echec CONNECT sur $first_host:$first_port", 'connect'._LOG_INFO_IMPORTANTE); |
|
| 1420 | 1420 | fclose($f); |
| 1421 | 1421 | |
| 1422 | 1422 | return false; |
@@ -1433,7 +1433,7 @@ discard block |
||
| 1433 | 1433 | } while (!$f && $ntry-- && $errno !== 110 && sleep(1)); |
| 1434 | 1434 | spip_log("Recuperer $path sur $first_host:$first_port par $f"); |
| 1435 | 1435 | if (!$f) { |
| 1436 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1436 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1437 | 1437 | |
| 1438 | 1438 | return $errno; |
| 1439 | 1439 | } |
@@ -1443,16 +1443,16 @@ discard block |
||
| 1443 | 1443 | $site = $GLOBALS['meta']['adresse_site'] ?? ''; |
| 1444 | 1444 | |
| 1445 | 1445 | $host_port = $host; |
| 1446 | - if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) { |
|
| 1446 | + if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) { |
|
| 1447 | 1447 | $host_port .= ":$port"; |
| 1448 | 1448 | } |
| 1449 | 1449 | $req = "$method $path $vers\r\n" |
| 1450 | 1450 | . "Host: $host_port\r\n" |
| 1451 | - . 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n" |
|
| 1452 | - . ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n")) |
|
| 1451 | + . 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n" |
|
| 1452 | + . ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n")) |
|
| 1453 | 1453 | . ($site ? "Referer: $site/$referer\r\n" : '') |
| 1454 | - . ($date ? 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n") : '') |
|
| 1455 | - . ($user ? 'Authorization: Basic ' . base64_encode(urldecode($user)) . "\r\n" : '') |
|
| 1454 | + . ($date ? 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n") : '') |
|
| 1455 | + . ($user ? 'Authorization: Basic '.base64_encode(urldecode($user))."\r\n" : '') |
|
| 1456 | 1456 | . ($proxy_user ? "Proxy-Authorization: Basic $proxy_user\r\n" : '') |
| 1457 | 1457 | . (strpos($vers, '1.1') ? "Keep-Alive: 300\r\nConnection: keep-alive\r\n" : ''); |
| 1458 | 1458 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $GLOBALS['contexte'] = calculer_contexte(); |
| 40 | 40 | $page = ['contexte_implicite' => calculer_contexte_implicite()]; |
| 41 | - $page['contexte_implicite']['cache'] = $fond . preg_replace( |
|
| 41 | + $page['contexte_implicite']['cache'] = $fond.preg_replace( |
|
| 42 | 42 | ',\.[a-zA-Z0-9]*$,', |
| 43 | 43 | '', |
| 44 | 44 | preg_replace('/[?].*$/', '', $GLOBALS['REQUEST_URI']) |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | if ($page === '') { |
| 139 | 139 | $erreur = _T( |
| 140 | 140 | 'info_erreur_squelette2', |
| 141 | - ['fichier' => spip_htmlspecialchars($fond) . '.' . _EXTENSION_SQUELETTES] |
|
| 141 | + ['fichier' => spip_htmlspecialchars($fond).'.'._EXTENSION_SQUELETTES] |
|
| 142 | 142 | ); |
| 143 | 143 | erreur_squelette($erreur); |
| 144 | 144 | // eviter des erreurs strictes ensuite sur $page['cle'] en PHP >= 5.4 |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | if ( |
| 180 | 180 | $lastmodified && !isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && !isset($page['entetes']['Last-Modified']) |
| 181 | 181 | ) { |
| 182 | - $page['entetes']['Last-Modified'] = gmdate('D, d M Y H:i:s', $lastmodified) . ' GMT'; |
|
| 182 | + $page['entetes']['Last-Modified'] = gmdate('D, d M Y H:i:s', $lastmodified).' GMT'; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // fermer la connexion apres les headers si requete HEAD |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | 'spip_version_code' => $GLOBALS['spip_version_code'], |
| 243 | 243 | ]; |
| 244 | 244 | if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) { |
| 245 | - $contexte_implicite['host'] .= '|' . $_SERVER['HTTP_X_FORWARDED_HOST']; |
|
| 245 | + $contexte_implicite['host'] .= '|'.$_SERVER['HTTP_X_FORWARDED_HOST']; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | return $contexte_implicite; |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | 579 | if (is_null($id)) { |
| 580 | - $msg = "modeles/$modele : " . _T('zbug_parametres_inclus_incorrects', ['param' => "id/$primary"]); |
|
| 580 | + $msg = "modeles/$modele : "._T('zbug_parametres_inclus_incorrects', ['param' => "id/$primary"]); |
|
| 581 | 581 | erreur_squelette($msg); |
| 582 | 582 | // on passe id=0 au routeur pour tomber sur le modele par defaut et eviter une seconde erreur sur un modele inexistant |
| 583 | 583 | $id = 0; |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | if (preg_match(',^[a-z0-9_]+$,', $soustype)) { |
| 623 | - if (!trouve_modele($fond = ($type . '_' . $soustype))) { |
|
| 623 | + if (!trouve_modele($fond = ($type.'_'.$soustype))) { |
|
| 624 | 624 | $fond = ''; |
| 625 | 625 | $class = $soustype; |
| 626 | 626 | } |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | $compteur--; |
| 636 | 636 | return false; |
| 637 | 637 | } |
| 638 | - $fond = 'modeles/' . $fond; |
|
| 638 | + $fond = 'modeles/'.$fond; |
|
| 639 | 639 | // Creer le contexte |
| 640 | 640 | $contexte = $env; |
| 641 | 641 | $contexte['dir_racine'] = _DIR_RACINE; # eviter de mixer un cache racine et un cache ecrire (meme si pour l'instant les modeles ne sont pas caches, le resultat etant different il faut que le contexte en tienne compte |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | // sinon, s'il y a un lien, on l'ajoute classiquement |
| 677 | 677 | if ( |
| 678 | 678 | strstr( |
| 679 | - ' ' . ($classes = extraire_attribut($retour, 'class')) . ' ', |
|
| 679 | + ' '.($classes = extraire_attribut($retour, 'class')).' ', |
|
| 680 | 680 | 'spip_lien_ok' |
| 681 | 681 | ) |
| 682 | 682 | ) { |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | ); |
| 688 | 688 | } else { |
| 689 | 689 | if ($lien) { |
| 690 | - $retour = '<a href="' . $lien['href'] . '" class="' . $lien['class'] . '">' . $retour . '</a>'; |
|
| 690 | + $retour = '<a href="'.$lien['href'].'" class="'.$lien['class'].'">'.$retour.'</a>'; |
|
| 691 | 691 | } |
| 692 | 692 | } |
| 693 | 693 | |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | return $page; |
| 711 | 711 | } |
| 712 | 712 | // eval $page et affecte $res |
| 713 | - include _ROOT_RESTREINT . 'public/evaluer_page.php'; |
|
| 713 | + include _ROOT_RESTREINT.'public/evaluer_page.php'; |
|
| 714 | 714 | |
| 715 | 715 | // Lever un drapeau (global) si le fond utilise #SESSION |
| 716 | 716 | // a destination de public/parametrer |
@@ -778,16 +778,16 @@ discard block |
||
| 778 | 778 | if (($pos = strpos($head, '<head>')) !== false) { |
| 779 | 779 | $head = substr_replace($head, $base, $pos + 6, 0); |
| 780 | 780 | } elseif (preg_match(',<head[^>]*>,i', $head, $r)) { |
| 781 | - $head = str_replace($r[0], $r[0] . $base, $head); |
|
| 781 | + $head = str_replace($r[0], $r[0].$base, $head); |
|
| 782 | 782 | } |
| 783 | - $texte = $head . substr($texte, $poshead); |
|
| 783 | + $texte = $head.substr($texte, $poshead); |
|
| 784 | 784 | } |
| 785 | 785 | if ($href_base) { |
| 786 | 786 | // gerer les ancres |
| 787 | 787 | $base = $_SERVER['REQUEST_URI']; |
| 788 | 788 | // pas de guillemets ni < dans l'URL qu'on insere dans le HTML |
| 789 | 789 | if (str_contains($base, "'") || str_contains($base, '"') || str_contains($base, '<')) { |
| 790 | - $base = str_replace(["'",'"','<'], ['%27','%22','%3C'], $base); |
|
| 790 | + $base = str_replace(["'", '"', '<'], ['%27', '%22', '%3C'], $base); |
|
| 791 | 791 | } |
| 792 | 792 | if (str_contains($texte, "href='#")) { |
| 793 | 793 | $texte = str_replace("href='#", "href='$base#", $texte); |