@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | define('_DIR_RACINE', _DIR_RESTREINT ? '' : '../'); |
| 51 | 51 | |
| 52 | 52 | /** chemin absolu vers la racine */ |
| 53 | -define('_ROOT_RACINE', dirname(__DIR__) . '/'); |
|
| 53 | +define('_ROOT_RACINE', dirname(__DIR__).'/'); |
|
| 54 | 54 | /** chemin absolu vers le repertoire de travail */ |
| 55 | -define('_ROOT_CWD', getcwd() . '/'); |
|
| 55 | +define('_ROOT_CWD', getcwd().'/'); |
|
| 56 | 56 | /** chemin absolu vers ecrire */ |
| 57 | -define('_ROOT_RESTREINT', _ROOT_CWD . _DIR_RESTREINT); |
|
| 57 | +define('_ROOT_RESTREINT', _ROOT_CWD._DIR_RESTREINT); |
|
| 58 | 58 | |
| 59 | 59 | # Le nom des 4 repertoires modifiables par les scripts lances par httpd |
| 60 | 60 | # Par defaut ces 4 noms seront suffixes par _DIR_RACINE (cf plus bas) |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | // inclure l'ecran de securite si il n'a pas été inclus en prepend php |
| 80 | 80 | if ( |
| 81 | 81 | !defined('_ECRAN_SECURITE') |
| 82 | - && @file_exists($f = _ROOT_RACINE . _NOM_PERMANENTS_INACCESSIBLES . 'ecran_securite.php') |
|
| 82 | + && @file_exists($f = _ROOT_RACINE._NOM_PERMANENTS_INACCESSIBLES.'ecran_securite.php') |
|
| 83 | 83 | ) { |
| 84 | 84 | include $f; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // et on peut lancer l'autoloader |
| 88 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 88 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 89 | 89 | |
| 90 | 90 | // Icones |
| 91 | 91 | if (!defined('_NOM_IMG_PACK')) { |
@@ -93,17 +93,17 @@ discard block |
||
| 93 | 93 | define('_NOM_IMG_PACK', 'images/'); |
| 94 | 94 | } |
| 95 | 95 | /** le chemin http (relatif) vers les images standard */ |
| 96 | -define('_DIR_IMG_PACK', (_DIR_RACINE . 'prive/' . _NOM_IMG_PACK)); |
|
| 96 | +define('_DIR_IMG_PACK', (_DIR_RACINE.'prive/'._NOM_IMG_PACK)); |
|
| 97 | 97 | |
| 98 | 98 | /** le chemin php (absolu) vers les images standard (pour hebergement centralise) */ |
| 99 | -define('_ROOT_IMG_PACK', dirname(__DIR__) . '/prive/' . _NOM_IMG_PACK); |
|
| 99 | +define('_ROOT_IMG_PACK', dirname(__DIR__).'/prive/'._NOM_IMG_PACK); |
|
| 100 | 100 | |
| 101 | 101 | if (!defined('_JAVASCRIPT')) { |
| 102 | 102 | /** Nom du repertoire des bibliotheques JavaScript */ |
| 103 | 103 | define('_JAVASCRIPT', 'javascript/'); |
| 104 | 104 | } // utilisable avec #CHEMIN et find_in_path |
| 105 | 105 | /** le nom du repertoire des bibliotheques JavaScript du prive */ |
| 106 | -define('_DIR_JAVASCRIPT', (_DIR_RACINE . 'prive/' . _JAVASCRIPT)); |
|
| 106 | +define('_DIR_JAVASCRIPT', (_DIR_RACINE.'prive/'._JAVASCRIPT)); |
|
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | /** Le nom du fichier de personnalisation */ |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // Son emplacement absolu si on le trouve |
| 115 | -if (@file_exists($f = _ROOT_RACINE . _NOM_PERMANENTS_INACCESSIBLES . _NOM_CONFIG . '.php')) { |
|
| 115 | +if (@file_exists($f = _ROOT_RACINE._NOM_PERMANENTS_INACCESSIBLES._NOM_CONFIG.'.php')) { |
|
| 116 | 116 | /** Emplacement absolu du fichier d'option */ |
| 117 | 117 | define('_FILE_OPTIONS', $f); |
| 118 | 118 | } else { |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | // UA plus cibles |
| 148 | 148 | . '80legs|accoona|AltaVista|ASPSeek|Baidu|Charlotte|EC2LinkFinder|eStyle|facebook|flipboard|hootsuite|FunWebProducts|Google|Genieo|INA dlweb|InfegyAtlas|Java VM|LiteFinder|Lycos|MetaURI|Moreover|Rambler|Scooter|ScrubbyBloglines|Yahoo|Yeti' |
| 149 | 149 | . ',i', |
| 150 | - (string)$_SERVER['HTTP_USER_AGENT'] |
|
| 150 | + (string) $_SERVER['HTTP_USER_AGENT'] |
|
| 151 | 151 | ) |
| 152 | 152 | ); |
| 153 | 153 | } |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | # la matrice standard (fichiers definissant les fonctions a inclure) |
| 390 | 390 | $spip_matrice = []; |
| 391 | 391 | # les plugins a activer |
| 392 | -$plugins = []; // voir le contenu du repertoire /plugins/ |
|
| 392 | +$plugins = []; // voir le contenu du repertoire /plugins/ |
|
| 393 | 393 | # les surcharges de include_spip() |
| 394 | 394 | $surcharges = []; // format 'inc_truc' => '/plugins/chose/inc_truc2.php' |
| 395 | 395 | |
@@ -467,8 +467,8 @@ discard block |
||
| 467 | 467 | // |
| 468 | 468 | // Charger les fonctions liees aux serveurs Http et Sql. |
| 469 | 469 | // |
| 470 | -require_once _ROOT_RESTREINT . 'inc/utils.php'; |
|
| 471 | -require_once _ROOT_RESTREINT . 'base/connect_sql.php'; |
|
| 470 | +require_once _ROOT_RESTREINT.'inc/utils.php'; |
|
| 471 | +require_once _ROOT_RESTREINT.'base/connect_sql.php'; |
|
| 472 | 472 | |
| 473 | 473 | // Definition personnelles eventuelles |
| 474 | 474 | |
@@ -492,10 +492,10 @@ discard block |
||
| 492 | 492 | // ===> on execute en neutralisant les messages d'erreur |
| 493 | 493 | |
| 494 | 494 | spip_initialisation_core( |
| 495 | - (_DIR_RACINE . _NOM_PERMANENTS_INACCESSIBLES), |
|
| 496 | - (_DIR_RACINE . _NOM_PERMANENTS_ACCESSIBLES), |
|
| 497 | - (_DIR_RACINE . _NOM_TEMPORAIRES_INACCESSIBLES), |
|
| 498 | - (_DIR_RACINE . _NOM_TEMPORAIRES_ACCESSIBLES) |
|
| 495 | + (_DIR_RACINE._NOM_PERMANENTS_INACCESSIBLES), |
|
| 496 | + (_DIR_RACINE._NOM_PERMANENTS_ACCESSIBLES), |
|
| 497 | + (_DIR_RACINE._NOM_TEMPORAIRES_INACCESSIBLES), |
|
| 498 | + (_DIR_RACINE._NOM_TEMPORAIRES_ACCESSIBLES) |
|
| 499 | 499 | ); |
| 500 | 500 | |
| 501 | 501 | |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | include_spip('inc/lang'); |
| 552 | 552 | utiliser_langue_visiteur(); |
| 553 | 553 | include_spip('inc/minipres'); |
| 554 | - echo minipres(_T('info_travaux_titre'), "<p style='text-align: center;'>" . _T('info_travaux_texte') . '</p>', ['status' => 503]); |
|
| 554 | + echo minipres(_T('info_travaux_titre'), "<p style='text-align: center;'>"._T('info_travaux_texte').'</p>', ['status' => 503]); |
|
| 555 | 555 | exit; |
| 556 | 556 | } |
| 557 | 557 | // autrement c'est une install ad hoc (spikini...), on sait pas faire |
@@ -590,12 +590,12 @@ discard block |
||
| 590 | 590 | } |
| 591 | 591 | if (!isset($GLOBALS['spip_header_silencieux']) || !$GLOBALS['spip_header_silencieux']) { |
| 592 | 592 | include_spip('inc/filtres_mini'); |
| 593 | - header(_HEADER_COMPOSED_BY . " $spip_version_affichee @ www.spip.net + " . url_absolue(_DIR_VAR . 'config.txt')); |
|
| 593 | + header(_HEADER_COMPOSED_BY." $spip_version_affichee @ www.spip.net + ".url_absolue(_DIR_VAR.'config.txt')); |
|
| 594 | 594 | } else { |
| 595 | 595 | // header minimal |
| 596 | - header(_HEADER_COMPOSED_BY . ' @ www.spip.net'); |
|
| 596 | + header(_HEADER_COMPOSED_BY.' @ www.spip.net'); |
|
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | $methode = ($_SERVER['REQUEST_METHOD'] ?? ((php_sapi_name() == 'cli') ? 'cli' : '')); |
| 601 | -spip_log($methode . ' ' . self() . ' - ' . _FILE_CONNECT, _LOG_DEBUG); |
|
| 601 | +spip_log($methode.' '.self().' - '._FILE_CONNECT, _LOG_DEBUG); |
|
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | // Script pour appeler un squelette apres s'etre authentifie |
| 13 | 13 | |
| 14 | -include_once __DIR__ . '/inc_version.php'; |
|
| 14 | +include_once __DIR__.'/inc_version.php'; |
|
| 15 | 15 | |
| 16 | 16 | include_spip('inc/cookie'); |
| 17 | 17 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | // On reexecute pour deboucher sur le include public. |
| 25 | 25 | // autrement on insiste |
| 26 | 26 | if (is_array($var_auth)) { |
| 27 | - $var_auth = '../?' . $_SERVER['QUERY_STRING']; |
|
| 27 | + $var_auth = '../?'.$_SERVER['QUERY_STRING']; |
|
| 28 | 28 | include_spip('inc/session'); |
| 29 | 29 | // on prolonge le cookie |
| 30 | 30 | set_cookie_session(null, time() + 3600 * 24 * 14); |
@@ -34,4 +34,4 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // En somme, est prive' ce qui est publiquement nomme'... |
| 37 | -include __DIR__ . '/public.php'; |
|
| 37 | +include __DIR__.'/public.php'; |
|
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | use Symplify\EasyCodingStandard\Config\ECSConfig; |
| 21 | 21 | use Symplify\EasyCodingStandard\ValueObject\Set\SetList; |
| 22 | 22 | |
| 23 | -return static function (ECSConfig $ecsConfig): void { |
|
| 23 | +return static function(ECSConfig $ecsConfig): void { |
|
| 24 | 24 | // A. full sets |
| 25 | 25 | $ecsConfig->sets([SetList::PSR_12, SetList::SYMPLIFY, SetList::COMMON, SetList::CLEAN_CODE]); |
| 26 | 26 | $ecsConfig->rule(NoExtraBlankLinesFixer::class); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $ecsConfig->indentation('tab'); |
| 37 | 37 | |
| 38 | 38 | $ecsConfig->paths([ |
| 39 | - __DIR__ . '/ecrire/tests', |
|
| 39 | + __DIR__.'/ecrire/tests', |
|
| 40 | 40 | # __DIR__ . '/index.php', |
| 41 | 41 | # __DIR__ . '/spip.php', |
| 42 | 42 | # __DIR__ . '/ecrire', |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | ]); |
| 45 | 45 | |
| 46 | 46 | $ecsConfig->skip([ |
| 47 | - __DIR__ . '/ecrire/lang', |
|
| 47 | + __DIR__.'/ecrire/lang', |
|
| 48 | 48 | ArrayListItemNewlineFixer::class, |
| 49 | 49 | ArrayOpenerAndCloserNewlineFixer::class, |
| 50 | 50 | AssignmentInConditionSniff::class, |
@@ -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); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $charset = 'cp1256'; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if (find_in_path($charset . '.php', 'charsets/', true)) { |
|
| 92 | + if (find_in_path($charset.'.php', 'charsets/', true)) { |
|
| 93 | 93 | return $charset; |
| 94 | 94 | } else { |
| 95 | 95 | spip_log("Erreur: pas de fichier de conversion 'charsets/$charset'"); |
@@ -190,38 +190,38 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | if (!isset($trans[$charset][$charset_cible])) { |
| 192 | 192 | $trans[$charset][$charset_cible] = [ |
| 193 | - $p . chr(128) => '€', |
|
| 194 | - $p . chr(129) => ' ', # pas affecte |
|
| 195 | - $p . chr(130) => '‚', |
|
| 196 | - $p . chr(131) => 'ƒ', |
|
| 197 | - $p . chr(132) => '„', |
|
| 198 | - $p . chr(133) => '…', |
|
| 199 | - $p . chr(134) => '†', |
|
| 200 | - $p . chr(135) => '‡', |
|
| 201 | - $p . chr(136) => 'ˆ', |
|
| 202 | - $p . chr(137) => '‰', |
|
| 203 | - $p . chr(138) => 'Š', |
|
| 204 | - $p . chr(139) => '‹', |
|
| 205 | - $p . chr(140) => 'Œ', |
|
| 206 | - $p . chr(141) => ' ', # pas affecte |
|
| 207 | - $p . chr(142) => 'Ž', |
|
| 208 | - $p . chr(143) => ' ', # pas affecte |
|
| 209 | - $p . chr(144) => ' ', # pas affecte |
|
| 210 | - $p . chr(145) => '‘', |
|
| 211 | - $p . chr(146) => '’', |
|
| 212 | - $p . chr(147) => '“', |
|
| 213 | - $p . chr(148) => '”', |
|
| 214 | - $p . chr(149) => '•', |
|
| 215 | - $p . chr(150) => '–', |
|
| 216 | - $p . chr(151) => '—', |
|
| 217 | - $p . chr(152) => '˜', |
|
| 218 | - $p . chr(153) => '™', |
|
| 219 | - $p . chr(154) => 'š', |
|
| 220 | - $p . chr(155) => '›', |
|
| 221 | - $p . chr(156) => 'œ', |
|
| 222 | - $p . chr(157) => ' ', # pas affecte |
|
| 223 | - $p . chr(158) => 'ž', |
|
| 224 | - $p . chr(159) => 'Ÿ', |
|
| 193 | + $p.chr(128) => '€', |
|
| 194 | + $p.chr(129) => ' ', # pas affecte |
|
| 195 | + $p.chr(130) => '‚', |
|
| 196 | + $p.chr(131) => 'ƒ', |
|
| 197 | + $p.chr(132) => '„', |
|
| 198 | + $p.chr(133) => '…', |
|
| 199 | + $p.chr(134) => '†', |
|
| 200 | + $p.chr(135) => '‡', |
|
| 201 | + $p.chr(136) => 'ˆ', |
|
| 202 | + $p.chr(137) => '‰', |
|
| 203 | + $p.chr(138) => 'Š', |
|
| 204 | + $p.chr(139) => '‹', |
|
| 205 | + $p.chr(140) => 'Œ', |
|
| 206 | + $p.chr(141) => ' ', # pas affecte |
|
| 207 | + $p.chr(142) => 'Ž', |
|
| 208 | + $p.chr(143) => ' ', # pas affecte |
|
| 209 | + $p.chr(144) => ' ', # pas affecte |
|
| 210 | + $p.chr(145) => '‘', |
|
| 211 | + $p.chr(146) => '’', |
|
| 212 | + $p.chr(147) => '“', |
|
| 213 | + $p.chr(148) => '”', |
|
| 214 | + $p.chr(149) => '•', |
|
| 215 | + $p.chr(150) => '–', |
|
| 216 | + $p.chr(151) => '—', |
|
| 217 | + $p.chr(152) => '˜', |
|
| 218 | + $p.chr(153) => '™', |
|
| 219 | + $p.chr(154) => 'š', |
|
| 220 | + $p.chr(155) => '›', |
|
| 221 | + $p.chr(156) => 'œ', |
|
| 222 | + $p.chr(157) => ' ', # pas affecte |
|
| 223 | + $p.chr(158) => 'ž', |
|
| 224 | + $p.chr(159) => 'Ÿ', |
|
| 225 | 225 | ]; |
| 226 | 226 | if ($charset_cible != 'unicode') { |
| 227 | 227 | foreach ($trans[$charset][$charset_cible] as $k => $c) { |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | // Sinon, peut-etre connaissons-nous ce charset ? |
| 368 | 368 | if (!isset($trans[$charset]) && (($cset = load_charset($charset)) && is_array($GLOBALS['CHARSET'][$cset]))) { |
| 369 | 369 | foreach ($GLOBALS['CHARSET'][$cset] as $key => $val) { |
| 370 | - $trans[$charset][chr($key)] = '&#' . $val . ';'; |
|
| 370 | + $trans[$charset][chr($key)] = '&#'.$val.';'; |
|
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | if (isset($trans[$charset]) && (is_countable($trans[$charset]) ? count($trans[$charset]) : 0)) { |
@@ -432,11 +432,11 @@ discard block |
||
| 432 | 432 | $h = dechex($e); |
| 433 | 433 | if ($s = isset($CHARSET_REVERSE[$charset][$e])) { |
| 434 | 434 | $s = $CHARSET_REVERSE[$charset][$e]; |
| 435 | - $t['&#' . $e . ';'] = $t['�' . $e . ';'] = $t['�' . $e . ';'] = chr($s); |
|
| 436 | - $t['&#x' . $h . ';'] = $t['�' . $h . ';'] = $t['�' . $h . ';'] = chr($s); |
|
| 435 | + $t['&#'.$e.';'] = $t['�'.$e.';'] = $t['�'.$e.';'] = chr($s); |
|
| 436 | + $t['&#x'.$h.';'] = $t['�'.$h.';'] = $t['�'.$h.';'] = chr($s); |
|
| 437 | 437 | } else { |
| 438 | - $t['&#' . $e . ';'] = $t['�' . $e . ';'] = $t['�' . $e . ';'] = chr($e); |
|
| 439 | - $t['&#x' . $h . ';'] = $t['�' . $h . ';'] = $t['�' . $h . ';'] = chr($e); |
|
| 438 | + $t['&#'.$e.';'] = $t['�'.$e.';'] = $t['�'.$e.';'] = chr($e); |
|
| 439 | + $t['&#x'.$h.';'] = $t['�'.$h.';'] = $t['�'.$h.';'] = chr($e); |
|
| 440 | 440 | } |
| 441 | 441 | } |
| 442 | 442 | } |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | && is_array($GLOBALS['CHARSET'][$cset])) |
| 483 | 483 | ) { |
| 484 | 484 | foreach ($GLOBALS['CHARSET'][$cset] as $key => $val) { |
| 485 | - $trans[$charset][chr($key)] = unicode2charset('&#' . $val . ';'); |
|
| 485 | + $trans[$charset][chr($key)] = unicode2charset('&#'.$val.';'); |
|
| 486 | 486 | } |
| 487 | 487 | } |
| 488 | 488 | if (is_countable($trans[$charset]) ? count($trans[$charset]) : 0) { |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | } |
| 589 | 589 | $thisPos++; |
| 590 | 590 | } |
| 591 | - $encodedLetter = '&#' . preg_replace('/^0+/', '', $decimalCode) . ';'; |
|
| 591 | + $encodedLetter = '&#'.preg_replace('/^0+/', '', $decimalCode).';'; |
|
| 592 | 592 | $encodedString .= $encodedLetter; |
| 593 | 593 | } |
| 594 | 594 | } |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | } // ignorer le BOM - http://www.unicode.org/faq/utf_bom.html |
| 632 | 632 | else { |
| 633 | 633 | if ($word != 65279) { |
| 634 | - $texte .= '&#' . $word . ';'; |
|
| 634 | + $texte .= '&#'.$word.';'; |
|
| 635 | 635 | } |
| 636 | 636 | } |
| 637 | 637 | } |
@@ -659,13 +659,13 @@ discard block |
||
| 659 | 659 | return chr($num); |
| 660 | 660 | } |
| 661 | 661 | if ($num < 2048) { |
| 662 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
| 662 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
| 663 | 663 | } |
| 664 | 664 | if ($num < 65536) { |
| 665 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 665 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 666 | 666 | } |
| 667 | 667 | if ($num < 1_114_112) { |
| 668 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 668 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | return ''; |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | while (preg_match(',�*(\d+);,S', $texte, $regs) && !isset($vu[$regs[1]])) { |
| 733 | 733 | $num = $regs[1]; |
| 734 | 734 | $vu[$num] = true; |
| 735 | - $s = '\u' . sprintf('%04x', $num); |
|
| 735 | + $s = '\u'.sprintf('%04x', $num); |
|
| 736 | 736 | $texte = str_replace($regs[0], $s, $texte); |
| 737 | 737 | } |
| 738 | 738 | |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | **/ |
| 750 | 750 | function javascript_to_unicode($texte) { |
| 751 | 751 | while (preg_match(',%u([0-9A-F][0-9A-F][0-9A-F][0-9A-F]),', $texte, $regs)) { |
| 752 | - $texte = str_replace($regs[0], '&#' . hexdec($regs[1]) . ';', $texte); |
|
| 752 | + $texte = str_replace($regs[0], '&#'.hexdec($regs[1]).';', $texte); |
|
| 753 | 753 | } |
| 754 | 754 | |
| 755 | 755 | return $texte; |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | return ''; |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | - $table_translit = 'translit' . $complexe; |
|
| 797 | + $table_translit = 'translit'.$complexe; |
|
| 798 | 798 | |
| 799 | 799 | // 2. Translitterer grace a la table predefinie |
| 800 | 800 | if (!isset($trans[$complexe])) { |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | * true s'il a un BOM |
| 890 | 890 | **/ |
| 891 | 891 | function bom_utf8($texte): bool { |
| 892 | - return (substr($texte, 0, 3) === chr(0xEF) . chr(0xBB) . chr(0xBF)); |
|
| 892 | + return (substr($texte, 0, 3) === chr(0xEF).chr(0xBB).chr(0xBF)); |
|
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | /** |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | |
| 1057 | 1057 | $lettre1 = mb_strtoupper(spip_substr($c, 0, 1)); |
| 1058 | 1058 | |
| 1059 | - return $lettre1 . spip_substr($c, 1); |
|
| 1059 | + return $lettre1.spip_substr($c, 1); |
|
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | /** |