@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | if (strncmp($fichier, _DIR_IMG, strlen(_DIR_IMG)) !== 0) { |
| 65 | - $fichier = _DIR_IMG . $fichier; |
|
| 65 | + $fichier = _DIR_IMG.$fichier; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // fichier normal |
@@ -158,23 +158,23 @@ discard block |
||
| 158 | 158 | or !$r = verifier_upload_autorise($dest) |
| 159 | 159 | or (!empty($r['autozip'])) |
| 160 | 160 | ) { |
| 161 | - $dest = substr($dest, 0, -strlen($m[0])) . '_' . $m[1]; |
|
| 161 | + $dest = substr($dest, 0, -strlen($m[0])).'_'.$m[1]; |
|
| 162 | 162 | break; |
| 163 | 163 | } |
| 164 | 164 | else { |
| 165 | 165 | $dest = substr($dest, 0, -strlen($m[0])); |
| 166 | - $ext = $m[1] . '.' . $ext; |
|
| 166 | + $ext = $m[1].'.'.$ext; |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | // Si le document "source" est deja au bon endroit, ne rien faire |
| 171 | - if ($source == ($dir . $dest . '.' . $ext)) { |
|
| 171 | + if ($source == ($dir.$dest.'.'.$ext)) { |
|
| 172 | 172 | return $source; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // sinon tourner jusqu'a trouver un numero correct |
| 176 | 176 | $n = 0; |
| 177 | - while (@file_exists($newFile = $dir . $dest . ($n++ ? ('-' . $n) : '') . '.' . $ext)) { |
|
| 177 | + while (@file_exists($newFile = $dir.$dest.($n++ ? ('-'.$n) : '').'.'.$ext)) { |
|
| 178 | 178 | ; |
| 179 | 179 | } |
| 180 | 180 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | function deplacer_fichier_upload($source, $dest, $move = false) { |
| 236 | 236 | // Securite |
| 237 | 237 | if (substr($dest, 0, strlen(_DIR_RACINE)) == _DIR_RACINE) { |
| 238 | - $dest = _DIR_RACINE . preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE))); |
|
| 238 | + $dest = _DIR_RACINE.preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE))); |
|
| 239 | 239 | } else { |
| 240 | 240 | $dest = preg_replace(',\.\.+,', '.', $dest); |
| 241 | 241 | } |
@@ -317,8 +317,8 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | default: /* autre */ |
| 319 | 319 | if (!$msg) { |
| 320 | - $msg = _T('pass_erreur') . ' ' . $error |
|
| 321 | - . '<br />' . propre('[->http://php.net/manual/fr/features.file-upload.errors.php]'); |
|
| 320 | + $msg = _T('pass_erreur').' '.$error |
|
| 321 | + . '<br />'.propre('[->http://php.net/manual/fr/features.file-upload.errors.php]'); |
|
| 322 | 322 | } |
| 323 | 323 | break; |
| 324 | 324 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | include_spip('inc/minipres'); |
| 337 | 337 | echo minipres( |
| 338 | 338 | $msg, |
| 339 | - "<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><a href='" . rawurldecode($GLOBALS['redirect']) . "'><button type='button'>" . _T('ecrire:bouton_suivant') . '</button></a></div>' |
|
| 339 | + "<div style='text-align: ".$GLOBALS['spip_lang_right']."'><a href='".rawurldecode($GLOBALS['redirect'])."'><button type='button'>"._T('ecrire:bouton_suivant').'</button></a></div>' |
|
| 340 | 340 | ); |
| 341 | 341 | exit; |
| 342 | 342 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function optimiser_caches_contextes() { |
| 53 | 53 | sous_repertoire(_DIR_CACHE, 'contextes'); |
| 54 | - if (is_dir($d = _DIR_CACHE . 'contextes')) { |
|
| 54 | + if (is_dir($d = _DIR_CACHE.'contextes')) { |
|
| 55 | 55 | include_spip('inc/invalideur'); |
| 56 | 56 | purger_repertoire($d, ['mtime' => time() - 48 * 3600, 'limit' => 10000]); |
| 57 | 57 | } |
@@ -96,16 +96,16 @@ discard block |
||
| 96 | 96 | $tables[] = array_shift($row); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - spip_log('optimiser_base_une_table ' . json_encode($tables, JSON_THROW_ON_ERROR), 'genie' . _LOG_DEBUG); |
|
| 99 | + spip_log('optimiser_base_une_table '.json_encode($tables, JSON_THROW_ON_ERROR), 'genie'._LOG_DEBUG); |
|
| 100 | 100 | if ($tables) { |
| 101 | 101 | $table_op = intval(lire_config('optimiser_table', 0) + 1) % sizeof($tables); |
| 102 | 102 | ecrire_config('optimiser_table', $table_op); |
| 103 | 103 | $q = $tables[$table_op]; |
| 104 | - spip_log("optimiser_base_une_table : debut d'optimisation de la table $q", 'genie' . _LOG_DEBUG); |
|
| 104 | + spip_log("optimiser_base_une_table : debut d'optimisation de la table $q", 'genie'._LOG_DEBUG); |
|
| 105 | 105 | if (sql_optimize($q)) { |
| 106 | - spip_log("optimiser_base_une_table : fin d'optimisation de la table $q", 'genie' . _LOG_DEBUG); |
|
| 106 | + spip_log("optimiser_base_une_table : fin d'optimisation de la table $q", 'genie'._LOG_DEBUG); |
|
| 107 | 107 | } else { |
| 108 | - spip_log("optimiser_base_une_table : Pas d'optimiseur necessaire", 'genie' . _LOG_DEBUG); |
|
| 108 | + spip_log("optimiser_base_une_table : Pas d'optimiseur necessaire", 'genie'._LOG_DEBUG); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | sql_free($sel); |
| 141 | 141 | |
| 142 | 142 | if ($in) { |
| 143 | - sql_delete($table, sql_in($id, array_keys($in)) . ($and ? " AND $and" : '')); |
|
| 144 | - spip_log("optimiser_sansref: Numeros des entrees $id supprimees dans la table $table: " . implode(', ', array_keys($in)), 'genie' . _LOG_DEBUG); |
|
| 143 | + sql_delete($table, sql_in($id, array_keys($in)).($and ? " AND $and" : '')); |
|
| 144 | + spip_log("optimiser_sansref: Numeros des entrees $id supprimees dans la table $table: ".implode(', ', array_keys($in)), 'genie'._LOG_DEBUG); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | return count($in); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | if (!defined('_AUTEURS_DELAI_REJET_NOUVEAU')) { |
| 222 | 222 | define('_AUTEURS_DELAI_REJET_NOUVEAU', 45 * 24 * 3600); |
| 223 | 223 | } |
| 224 | - sql_delete('spip_auteurs', "statut='nouveau' AND maj < " . sql_quote(date('Y-m-d', time() - intval(_AUTEURS_DELAI_REJET_NOUVEAU)))); |
|
| 224 | + sql_delete('spip_auteurs', "statut='nouveau' AND maj < ".sql_quote(date('Y-m-d', time() - intval(_AUTEURS_DELAI_REJET_NOUVEAU)))); |
|
| 225 | 225 | |
| 226 | 226 | /** |
| 227 | 227 | * Permet aux plugins de compléter l'optimisation suite aux éléments disparus |
@@ -242,5 +242,5 @@ discard block |
||
| 242 | 242 | ]); |
| 243 | 243 | |
| 244 | 244 | |
| 245 | - spip_log("optimiser_base_disparus : {$n} lien(s) mort(s)", 'genie' . _LOG_DEBUG); |
|
| 245 | + spip_log("optimiser_base_disparus : {$n} lien(s) mort(s)", 'genie'._LOG_DEBUG); |
|
| 246 | 246 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | if ($fichier) { |
| 111 | 111 | $code = "quete_logo_file($doc, $qconnect)"; |
| 112 | 112 | } else { |
| 113 | - $code = "quete_logo_document($doc, " . ($lien ?: "''") . ", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)"; |
|
| 113 | + $code = "quete_logo_document($doc, ".($lien ?: "''").", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)"; |
|
| 114 | 114 | } |
| 115 | 115 | // (x=non-faux ? y : '') pour affecter x en retournant y |
| 116 | 116 | if ($p->descr['documents']) { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | // demande de reduction sur logo avec ecriture spip 2.1 : #LOGO_xxx{200, 0} |
| 135 | 135 | if ($coord_x or $coord_y) { |
| 136 | - $code = "filtrer('image_graver',filtrer('image_reduire'," . $code . ", '$coord_x', '$coord_y'))"; |
|
| 136 | + $code = "filtrer('image_graver',filtrer('image_reduire',".$code.", '$coord_x', '$coord_y'))"; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $p->code = $code; |
@@ -32,11 +32,11 @@ |
||
| 32 | 32 | } else { |
| 33 | 33 | include_spip('inc/presentation'); // pour info_copyright |
| 34 | 34 | |
| 35 | - $res = "<div class='petit-centre'><img alt='SPIP' class='logo' src='" . chemin_image('logo-spip.png') . "' />\n" . |
|
| 36 | - "<p class='small'>" . info_copyright() . "</p></div>\n" . |
|
| 37 | - '<p>' . _T('install_select_langue') . '</p>' . |
|
| 38 | - '<div>' . $menu_langues . "</div>\n" . |
|
| 39 | - generer_form_ecrire('install', "<input type='hidden' name='etape' value='chmod' />" . bouton_suivant()); |
|
| 35 | + $res = "<div class='petit-centre'><img alt='SPIP' class='logo' src='".chemin_image('logo-spip.png')."' />\n". |
|
| 36 | + "<p class='small'>".info_copyright()."</p></div>\n". |
|
| 37 | + '<p>'._T('install_select_langue').'</p>'. |
|
| 38 | + '<div>'.$menu_langues."</div>\n". |
|
| 39 | + generer_form_ecrire('install', "<input type='hidden' name='etape' value='chmod' />".bouton_suivant()); |
|
| 40 | 40 | |
| 41 | 41 | $minipage = new Spip\Afficher\Minipage\Installation(); |
| 42 | 42 | echo $minipage->page($res); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | // creer le repertoire cache, qui sert partout ! |
| 44 | 44 | // deja fait en etape 4 en principe, on garde au cas ou |
| 45 | 45 | if (!@file_exists(_DIR_CACHE)) { |
| 46 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 46 | + $rep = preg_replace(','._DIR_TMP.',', '', _DIR_CACHE); |
|
| 47 | 47 | $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $cible = _T('public:accueil_site'); |
| 55 | 55 | $cible = generer_form_ecrire('accueil', '', '', $cible); |
| 56 | 56 | $minipage = new Spip\Afficher\Minipage\Installation(); |
| 57 | - echo $minipage->page($msg . $cible); |
|
| 57 | + echo $minipage->page($msg.$cible); |
|
| 58 | 58 | // ok, deboucher dans l'espace prive |
| 59 | 59 | } else { |
| 60 | 60 | redirige_url_ecrire('accueil'); |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | $averti = _T( |
| 76 | 76 | 'htaccess_a_simuler', |
| 77 | 77 | [ |
| 78 | - 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 78 | + 'htaccess' => '<tt>'._ACCESS_FILE_NAME.'</tt>', |
|
| 79 | 79 | 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
| 80 | - 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 80 | + 'document_root' => '<tt>'.$_SERVER['DOCUMENT_ROOT'].'</tt>' |
|
| 81 | 81 | ] |
| 82 | 82 | ); |
| 83 | 83 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | $titre = ($titre == 'install') |
| 106 | 106 | ? _T('avis_espace_interdit') |
| 107 | - : $titre . ' : ' . _T('info_acces_interdit'); |
|
| 107 | + : $titre.' : '._T('info_acces_interdit'); |
|
| 108 | 108 | |
| 109 | 109 | $statut = $GLOBALS['visiteur_session']['statut'] ?? ''; |
| 110 | 110 | $nom = $GLOBALS['visiteur_session']['nom'] ?? ''; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $footer = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site'] ?? ''); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - spip_log($nom . " $titre " . $_SERVER['REQUEST_URI'], 'minipres'); |
|
| 126 | + spip_log($nom." $titre ".$_SERVER['REQUEST_URI'], 'minipres'); |
|
| 127 | 127 | |
| 128 | 128 | $options['footer'] = $footer; |
| 129 | 129 | if (empty($corps)) { |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | foreach ($_POST as $v => $c) { |
| 155 | 155 | $url = parametre_url($url, $v, $c, '&'); |
| 156 | 156 | } |
| 157 | - ajax_retour('<div>' . $titre . redirige_formulaire($url) . '</div>', false); |
|
| 157 | + ajax_retour('<div>'.$titre.redirige_formulaire($url).'</div>', false); |
|
| 158 | 158 | return ''; |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | function genie_mise_a_jour_dist($t) { |
| 29 | 29 | include_spip('inc/meta'); |
| 30 | 30 | $maj = info_maj($GLOBALS['spip_version_branche']); |
| 31 | - ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : '', 'non'); |
|
| 31 | + ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche']."|$maj") : '', 'non'); |
|
| 32 | 32 | |
| 33 | 33 | mise_a_jour_ecran_securite(); |
| 34 | 34 | |
| 35 | - spip_log('Verification version SPIP : ' . ($maj ?: 'version a jour'), 'verifie_maj'); |
|
| 35 | + spip_log('Verification version SPIP : '.($maj ?: 'version a jour'), 'verifie_maj'); |
|
| 36 | 36 | |
| 37 | 37 | return 1; |
| 38 | 38 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | // si l'ecran n'est pas deja present ou pas updatable, sortir |
| 58 | 58 | if ( |
| 59 | 59 | !_URL_ECRAN_SECURITE |
| 60 | - or !file_exists($filename = _DIR_ETC . 'ecran_securite.php') |
|
| 60 | + or !file_exists($filename = _DIR_ETC.'ecran_securite.php') |
|
| 61 | 61 | or !is_writable($filename) |
| 62 | 62 | or !$last_modified = filemtime($filename) |
| 63 | 63 | or !$md5 = md5_file($filename) |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | include_spip('inc/distant'); |
| 69 | - $tmp_file = _DIR_TMP . 'ecran_securite.php'; |
|
| 69 | + $tmp_file = _DIR_TMP.'ecran_securite.php'; |
|
| 70 | 70 | $url = parametre_url(_URL_ECRAN_SECURITE, 'md5', $md5); |
| 71 | 71 | $url = parametre_url($url, 'vspip', $GLOBALS['spip_version_branche']); |
| 72 | 72 | $res = recuperer_url($url, [ |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | include_once $tmp_file; |
| 86 | 86 | // ok, on le copie a la place de l'ecran existant |
| 87 | 87 | // en backupant l'ecran avant, au cas ou |
| 88 | - @copy($filename, $filename . '-bck-' . date('Y-m-d-His', $last_modified)); |
|
| 88 | + @copy($filename, $filename.'-bck-'.date('Y-m-d-His', $last_modified)); |
|
| 89 | 89 | @rename($tmp_file, $filename); |
| 90 | 90 | } else { |
| 91 | 91 | @unlink($tmp_file); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $message[] = _T('nouvelle_version_spip_majeure', ['version' => $maj['majeure']]); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - return '<a class="info_maj_spip" href="https://www.spip.net/fr_update" title="' . $maj['mineure'] . '">' . implode(' | ', $message) . '</a>'; |
|
| 130 | + return '<a class="info_maj_spip" href="https://www.spip.net/fr_update" title="'.$maj['mineure'].'">'.implode(' | ', $message).'</a>'; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | function info_maj_cache(): ?array { |
| 145 | 145 | $contenu = ''; |
| 146 | 146 | $options = []; |
| 147 | - $nom = _DIR_CACHE . _VERSIONS_LISTE; |
|
| 147 | + $nom = _DIR_CACHE._VERSIONS_LISTE; |
|
| 148 | 148 | if (file_exists($nom)) { |
| 149 | 149 | $contenu = file_get_contents($nom); |
| 150 | 150 | $options['if_modified_since'] = filemtime($nom); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | try { |
| 166 | 166 | $json = json_decode($contenu, true, 512, JSON_THROW_ON_ERROR); |
| 167 | 167 | } catch (JsonException $e) { |
| 168 | - spip_log('Failed to parse Json data : ' . $e->getMessage(), 'verifie_maj'); |
|
| 168 | + spip_log('Failed to parse Json data : '.$e->getMessage(), 'verifie_maj'); |
|
| 169 | 169 | return null; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | foreach ($versions as $v) { |
| 199 | 199 | [$maj2, $min2, $rev2] = explode('.', $v); |
| 200 | - $branche_maj = $maj2 . '.' . $min2; |
|
| 201 | - $version_maj = $maj2 . '.' . $min2 . '.' . $rev2; |
|
| 200 | + $branche_maj = $maj2.'.'.$min2; |
|
| 201 | + $version_maj = $maj2.'.'.$min2.'.'.$rev2; |
|
| 202 | 202 | $is_version_stable = is_numeric($rev2); |
| 203 | 203 | // d'abord les mises à jour de la même branche (version mineure) |
| 204 | 204 | if ( |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $champ = preg_replace(',[\s]+,ms', ' ', $champ); |
| 38 | 38 | $champ = str_replace('"', '""', $champ); |
| 39 | 39 | |
| 40 | - return '"' . $champ . '"'; |
|
| 40 | + return '"'.$champ.'"'; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if ($callback) { |
| 58 | 58 | $ligne = $callback($nb, $ligne, $delim, $importer_charset); |
| 59 | 59 | } |
| 60 | - $output = join($delim, array_map('exporter_csv_champ', $ligne)) . "\r\n"; |
|
| 60 | + $output = join($delim, array_map('exporter_csv_champ', $ligne))."\r\n"; |
|
| 61 | 61 | if ($importer_charset) { |
| 62 | 62 | $output = str_replace('’', '\'', $output); |
| 63 | 63 | $output = unicode2charset(html2unicode(charset2unicode($output)), $importer_charset); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $fichier = 'php://output'; |
| 185 | 185 | } |
| 186 | 186 | else { |
| 187 | - $fichier = sous_repertoire(_DIR_CACHE, 'export') . $basename; |
|
| 187 | + $fichier = sous_repertoire(_DIR_CACHE, 'export').$basename; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $fp = fopen($fichier, 'w'); |
@@ -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' and preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) { |
| 76 | - $source = substr(_DIR_IMG, strlen(_DIR_RACINE)) . urldecode($match[1]); |
|
| 76 | + $source = substr(_DIR_IMG, strlen(_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,18 +113,18 @@ 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 or (!$res['length'] and $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 | } |
| 126 | 126 | else { |
| 127 | - spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant'); |
|
| 127 | + spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille ".$res['length'].' status '.$res['status'], 'distant'); |
|
| 128 | 128 | } |
| 129 | 129 | if (!$res or !$res['length']) { |
| 130 | 130 | // si $t c'est sans doute juste un not-modified-since |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | and is_callable($callback_valider_url) |
| 138 | 138 | and !$callback_valider_url($res['url']) |
| 139 | 139 | ) { |
| 140 | - spip_log('copie_locale : url finale ' . $res['url'] . " non valide, on refuse le fichier $localrac_tmp", 'distant' . _LOG_INFO_IMPORTANTE); |
|
| 140 | + spip_log('copie_locale : url finale '.$res['url']." non valide, on refuse le fichier $localrac_tmp", 'distant'._LOG_INFO_IMPORTANTE); |
|
| 141 | 141 | @unlink($localrac_tmp); |
| 142 | 142 | return $t ? $local : false; |
| 143 | 143 | } |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | if (!$is_known_host) { |
| 230 | 230 | $host = trim($parsed_url['host'], '.'); |
| 231 | - if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) { |
|
| 231 | + if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) { |
|
| 232 | 232 | $ip = gethostbyname($host); |
| 233 | 233 | if ($ip === $host) { |
| 234 | 234 | // Error condition for gethostbyname() |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | if ($ip) { |
| 252 | - if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
| 252 | + if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
| 253 | 253 | return false; |
| 254 | 254 | } |
| 255 | 255 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | $port = $parsed_url['port']; |
| 263 | - if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 263 | + if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 264 | 264 | return $url; |
| 265 | 265 | } |
| 266 | 266 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | if ($taille > 500) { |
| 333 | - $boundary = substr(md5(random_int(0, mt_getrandmax()) . 'spip'), 0, 8); |
|
| 333 | + $boundary = substr(md5(random_int(0, mt_getrandmax()).'spip'), 0, 8); |
|
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
@@ -358,16 +358,16 @@ discard block |
||
| 358 | 358 | } |
| 359 | 359 | } else { |
| 360 | 360 | // fabrique une chaine HTTP simple pour un POST |
| 361 | - $entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n"; |
|
| 361 | + $entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n"; |
|
| 362 | 362 | $chaine = []; |
| 363 | 363 | if (is_array($donnees)) { |
| 364 | 364 | foreach ($donnees as $cle => $valeur) { |
| 365 | 365 | if (is_array($valeur)) { |
| 366 | 366 | foreach ($valeur as $val2) { |
| 367 | - $chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2); |
|
| 367 | + $chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2); |
|
| 368 | 368 | } |
| 369 | 369 | } else { |
| 370 | - $chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur); |
|
| 370 | + $chaine[] = rawurlencode($cle).'='.rawurlencode($valeur); |
|
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | $chaine = implode('&', $chaine); |
@@ -468,13 +468,13 @@ discard block |
||
| 468 | 468 | $options['taille_max'] = $copy ? _COPIE_LOCALE_MAX_SIZE : _INC_DISTANT_MAX_SIZE; |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - spip_log('recuperer_url ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG); |
|
| 471 | + spip_log('recuperer_url '.$options['methode']." sur $url", 'distant'._LOG_DEBUG); |
|
| 472 | 472 | |
| 473 | 473 | // Ajout des en-têtes spécifiques si besoin |
| 474 | 474 | $formatted_data = ''; |
| 475 | 475 | if (!empty($options['headers'])) { |
| 476 | 476 | foreach ($options['headers'] as $champ => $valeur) { |
| 477 | - $formatted_data .= $champ . ': ' . $valeur . "\r\n"; |
|
| 477 | + $formatted_data .= $champ.': '.$valeur."\r\n"; |
|
| 478 | 478 | } |
| 479 | 479 | } |
| 480 | 480 | |
@@ -482,9 +482,9 @@ discard block |
||
| 482 | 482 | [$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']); |
| 483 | 483 | $head .= $formatted_data; |
| 484 | 484 | if (stripos($head, 'Content-Length:') === false) { |
| 485 | - $head .= 'Content-Length: ' . strlen($postdata) . "\r\n"; |
|
| 485 | + $head .= 'Content-Length: '.strlen($postdata)."\r\n"; |
|
| 486 | 486 | } |
| 487 | - $formatted_data = $head . "\r\n" . $postdata; |
|
| 487 | + $formatted_data = $head."\r\n".$postdata; |
|
| 488 | 488 | if ( |
| 489 | 489 | strlen($postdata) |
| 490 | 490 | and !$methode_demandee |
@@ -498,9 +498,9 @@ discard block |
||
| 498 | 498 | // Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole |
| 499 | 499 | $url = preg_replace(',^feed://,i', 'http://', $url); |
| 500 | 500 | if (!tester_url_absolue($url)) { |
| 501 | - $url = 'http://' . $url; |
|
| 501 | + $url = 'http://'.$url; |
|
| 502 | 502 | } elseif (strncmp($url, '//', 2) == 0) { |
| 503 | - $url = 'http:' . $url; |
|
| 503 | + $url = 'http:'.$url; |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | $url = url_to_ascii($url); |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $options['if_modified_since'] |
| 530 | 530 | ); |
| 531 | 531 | if (!$handle) { |
| 532 | - spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR); |
|
| 532 | + spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR); |
|
| 533 | 533 | |
| 534 | 534 | return false; |
| 535 | 535 | } |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | 'status' => 200, |
| 560 | 560 | ]; |
| 561 | 561 | } else { |
| 562 | - spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR); |
|
| 562 | + spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR); |
|
| 563 | 563 | return false; |
| 564 | 564 | } |
| 565 | 565 | } elseif ($res['location'] and $options['follow_location']) { |
@@ -575,11 +575,11 @@ discard block |
||
| 575 | 575 | $options['datas'] = ''; |
| 576 | 576 | } |
| 577 | 577 | } |
| 578 | - spip_log('recuperer_url recommence ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG); |
|
| 578 | + spip_log('recuperer_url recommence '.$options['methode']." sur $url", 'distant'._LOG_DEBUG); |
|
| 579 | 579 | |
| 580 | 580 | return recuperer_url($url, $options); |
| 581 | 581 | } elseif ($res['status'] !== 200) { |
| 582 | - spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant'); |
|
| 582 | + spip_log('HTTP status '.$res['status']." pour $url", 'distant'); |
|
| 583 | 583 | } |
| 584 | 584 | $result['status'] = $res['status']; |
| 585 | 585 | if (isset($res['headers'])) { |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | |
| 596 | 596 | // on ne veut que les entetes |
| 597 | 597 | if (!$options['taille_max'] or $options['methode'] == 'HEAD' or $result['status'] == '304') { |
| 598 | - spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($result), 'distant' . _LOG_DEBUG); |
|
| 598 | + spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($result), 'distant'._LOG_DEBUG); |
|
| 599 | 599 | return $result; |
| 600 | 600 | } |
| 601 | 601 | |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | |
| 606 | 606 | $gz = false; |
| 607 | 607 | if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) { |
| 608 | - $gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz'); |
|
| 608 | + $gz = (_DIR_TMP.md5(uniqid(random_int(0, mt_getrandmax()))).'.tmp.gz'); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | // si on a pas deja recuperer le contenu par une methode detournee |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | |
| 642 | 642 | $trace = json_decode(json_encode($result), true); |
| 643 | 643 | $trace['page'] = '...'; |
| 644 | - spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($trace), 'distant' . _LOG_DEBUG); |
|
| 644 | + spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($trace), 'distant'._LOG_DEBUG); |
|
| 645 | 645 | |
| 646 | 646 | return $result; |
| 647 | 647 | } |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | $sig['url'] = $url; |
| 696 | 696 | |
| 697 | 697 | $dir = sous_repertoire(_DIR_CACHE, 'curl'); |
| 698 | - $cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 698 | + $cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 699 | 699 | $sub = sous_repertoire($dir, substr($cache, 0, 2)); |
| 700 | 700 | $cache = "$sub$cache"; |
| 701 | 701 | |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | $fp = false; |
| 750 | 750 | if ($fichier) { |
| 751 | 751 | include_spip('inc/acces'); |
| 752 | - $tmpfile = "$fichier." . creer_uniqid() . '.tmp'; |
|
| 752 | + $tmpfile = "$fichier.".creer_uniqid().'.tmp'; |
|
| 753 | 753 | $fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX); |
| 754 | 754 | if (!$fp and file_exists($fichier)) { |
| 755 | 755 | return filesize($fichier); |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | } |
| 809 | 809 | $result['status'] = intval($r[1]); |
| 810 | 810 | while ($s = trim(fgets($handle, 16384))) { |
| 811 | - $result['headers'][] = $s . "\n"; |
|
| 811 | + $result['headers'][] = $s."\n"; |
|
| 812 | 812 | preg_match(',^([^:]*): *(.*)$,i', $s, $r); |
| 813 | 813 | [, $d, $v] = $r; |
| 814 | 814 | if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) { |
@@ -857,13 +857,13 @@ discard block |
||
| 857 | 857 | |
| 858 | 858 | // on se place tout le temps comme si on etait a la racine |
| 859 | 859 | if (_DIR_RACINE) { |
| 860 | - $d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d); |
|
| 860 | + $d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d); |
|
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | $m = md5($source); |
| 864 | 864 | |
| 865 | 865 | return $d |
| 866 | - . substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12) |
|
| 866 | + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12) |
|
| 867 | 867 | . substr($m, 0, 4) |
| 868 | 868 | . ".$extension"; |
| 869 | 869 | } |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | // Si c'est deja local pas de souci |
| 888 | 888 | if (!tester_url_absolue($source)) { |
| 889 | 889 | if (_DIR_RACINE) { |
| 890 | - $source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source); |
|
| 890 | + $source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source); |
|
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | return $source; |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | $ext |
| 906 | 906 | and preg_match(',^\w+$,', $ext) // pas de php?truc=1&... |
| 907 | 907 | and $f = nom_fichier_copie_locale($source, $ext) |
| 908 | - and file_exists(_DIR_RACINE . $f) |
|
| 908 | + and file_exists(_DIR_RACINE.$f) |
|
| 909 | 909 | ) { |
| 910 | 910 | return $f; |
| 911 | 911 | } |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | |
| 914 | 914 | // Si c'est deja dans la table des documents, |
| 915 | 915 | // ramener le nom de sa copie potentielle |
| 916 | - $ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''"); |
|
| 916 | + $ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''"); |
|
| 917 | 917 | |
| 918 | 918 | if ($ext) { |
| 919 | 919 | return nom_fichier_copie_locale($source, $ext); |
@@ -924,9 +924,9 @@ discard block |
||
| 924 | 924 | |
| 925 | 925 | $ext = $path_parts ? $path_parts['extension'] : ''; |
| 926 | 926 | |
| 927 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 927 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 928 | 928 | $f = nom_fichier_copie_locale($source, $ext); |
| 929 | - if (file_exists(_DIR_RACINE . $f)) { |
|
| 929 | + if (file_exists(_DIR_RACINE.$f)) { |
|
| 930 | 930 | return $f; |
| 931 | 931 | } |
| 932 | 932 | } |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | // Ping pour voir si son extension est connue et autorisee |
| 935 | 935 | // avec mise en cache du resultat du ping |
| 936 | 936 | |
| 937 | - $cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source); |
|
| 937 | + $cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source); |
|
| 938 | 938 | if ( |
| 939 | 939 | !@file_exists($cache) |
| 940 | 940 | or !$path_parts = @unserialize(spip_file_get_contents($cache)) |
@@ -944,11 +944,11 @@ discard block |
||
| 944 | 944 | ecrire_fichier($cache, serialize($path_parts)); |
| 945 | 945 | } |
| 946 | 946 | $ext = !empty($path_parts['extension']) ? $path_parts['extension'] : ''; |
| 947 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 947 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 948 | 948 | return nom_fichier_copie_locale($source, $ext); |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | - spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR); |
|
| 951 | + spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR); |
|
| 952 | 952 | return null; |
| 953 | 953 | } |
| 954 | 954 | |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | } else { |
| 1048 | 1048 | if ($a['body']) { |
| 1049 | 1049 | $a['extension'] = $extension; |
| 1050 | - $a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension); |
|
| 1050 | + $a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension); |
|
| 1051 | 1051 | ecrire_fichier($a['fichier'], $a['body']); |
| 1052 | 1052 | $size_image = @spip_getimagesize($a['fichier']); |
| 1053 | 1053 | $a['largeur'] = intval($size_image[0]); |
@@ -1115,20 +1115,20 @@ discard block |
||
| 1115 | 1115 | !$t |
| 1116 | 1116 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1117 | 1117 | ) { |
| 1118 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1118 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1119 | 1119 | } |
| 1120 | 1120 | if ( |
| 1121 | 1121 | !$t |
| 1122 | 1122 | and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m) |
| 1123 | 1123 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext) |
| 1124 | 1124 | ) { |
| 1125 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1125 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1126 | 1126 | } |
| 1127 | 1127 | } |
| 1128 | 1128 | |
| 1129 | 1129 | // Autre mime/type (ou text/plain avec fichier d'extension inconnue) |
| 1130 | 1130 | if (!$t) { |
| 1131 | - $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type)); |
|
| 1131 | + $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type)); |
|
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | 1134 | // Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg) |
@@ -1139,11 +1139,11 @@ discard block |
||
| 1139 | 1139 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1140 | 1140 | ) { |
| 1141 | 1141 | # eviter xxx.3 => 3gp (> SPIP 3) |
| 1142 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1142 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | 1145 | if ($t) { |
| 1146 | - spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant'); |
|
| 1146 | + spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant'); |
|
| 1147 | 1147 | return $t['extension']; |
| 1148 | 1148 | } else { |
| 1149 | 1149 | # par defaut on retombe sur '.bin' si c'est autorise |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | } |
| 1247 | 1247 | } else { |
| 1248 | 1248 | $scheme = $t['scheme']; |
| 1249 | - $noproxy = $scheme . '://'; |
|
| 1249 | + $noproxy = $scheme.'://'; |
|
| 1250 | 1250 | } |
| 1251 | 1251 | if (isset($t['user'])) { |
| 1252 | 1252 | $user = [$t['user'], $t['pass']]; |
@@ -1260,7 +1260,7 @@ discard block |
||
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | 1262 | if (!empty($t['query'])) { |
| 1263 | - $path .= '?' . $t['query']; |
|
| 1263 | + $path .= '?'.$t['query']; |
|
| 1264 | 1264 | } |
| 1265 | 1265 | |
| 1266 | 1266 | $f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date); |
@@ -1334,29 +1334,29 @@ discard block |
||
| 1334 | 1334 | $proxy_user = ''; |
| 1335 | 1335 | $http_proxy = need_proxy($host); |
| 1336 | 1336 | if ($user) { |
| 1337 | - $user = urlencode($user[0]) . ':' . urlencode($user[1]); |
|
| 1337 | + $user = urlencode($user[0]).':'.urlencode($user[1]); |
|
| 1338 | 1338 | } |
| 1339 | 1339 | |
| 1340 | 1340 | $connect = ''; |
| 1341 | 1341 | if ($http_proxy) { |
| 1342 | - if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) { |
|
| 1343 | - $path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : ''); |
|
| 1344 | - $connect = 'CONNECT ' . $path_host . " $vers\r\n" |
|
| 1342 | + if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) { |
|
| 1343 | + $path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : ''); |
|
| 1344 | + $connect = 'CONNECT '.$path_host." $vers\r\n" |
|
| 1345 | 1345 | . "Host: $path_host\r\n" |
| 1346 | 1346 | . "Proxy-Connection: Keep-Alive\r\n"; |
| 1347 | 1347 | } else { |
| 1348 | - $path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://") |
|
| 1348 | + $path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://") |
|
| 1349 | 1349 | . (!$user ? '' : "$user@") |
| 1350 | - . "$host" . (($port != 80) ? ":$port" : '') . $path; |
|
| 1350 | + . "$host".(($port != 80) ? ":$port" : '').$path; |
|
| 1351 | 1351 | } |
| 1352 | 1352 | $t2 = @parse_url($http_proxy); |
| 1353 | 1353 | $first_host = $t2['host']; |
| 1354 | 1354 | $first_port = ($t2['port'] ?? null) ?: 80; |
| 1355 | 1355 | if ($t2['user'] ?? null) { |
| 1356 | - $proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']); |
|
| 1356 | + $proxy_user = base64_encode($t2['user'].':'.$t2['pass']); |
|
| 1357 | 1357 | } |
| 1358 | 1358 | } else { |
| 1359 | - $first_host = $noproxy . $host; |
|
| 1359 | + $first_host = $noproxy.$host; |
|
| 1360 | 1360 | $first_port = $port; |
| 1361 | 1361 | } |
| 1362 | 1362 | |
@@ -1379,7 +1379,7 @@ discard block |
||
| 1379 | 1379 | ); |
| 1380 | 1380 | spip_log("Recuperer $path sur $first_host:$first_port par $f (via CONNECT)", 'connect'); |
| 1381 | 1381 | if (!$f) { |
| 1382 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1382 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1383 | 1383 | return $errno; |
| 1384 | 1384 | } |
| 1385 | 1385 | stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT); |
@@ -1392,7 +1392,7 @@ discard block |
||
| 1392 | 1392 | or !count($res = explode(' ', $res)) |
| 1393 | 1393 | or $res[1] !== '200' |
| 1394 | 1394 | ) { |
| 1395 | - spip_log("Echec CONNECT sur $first_host:$first_port", 'connect' . _LOG_INFO_IMPORTANTE); |
|
| 1395 | + spip_log("Echec CONNECT sur $first_host:$first_port", 'connect'._LOG_INFO_IMPORTANTE); |
|
| 1396 | 1396 | fclose($f); |
| 1397 | 1397 | |
| 1398 | 1398 | return false; |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | } while (!$f and $ntry-- and $errno !== 110 and sleep(1)); |
| 1410 | 1410 | spip_log("Recuperer $path sur $first_host:$first_port par $f"); |
| 1411 | 1411 | if (!$f) { |
| 1412 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1412 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1413 | 1413 | |
| 1414 | 1414 | return $errno; |
| 1415 | 1415 | } |
@@ -1419,16 +1419,16 @@ discard block |
||
| 1419 | 1419 | $site = $GLOBALS['meta']['adresse_site'] ?? ''; |
| 1420 | 1420 | |
| 1421 | 1421 | $host_port = $host; |
| 1422 | - if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) { |
|
| 1422 | + if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) { |
|
| 1423 | 1423 | $host_port .= ":$port"; |
| 1424 | 1424 | } |
| 1425 | 1425 | $req = "$method $path $vers\r\n" |
| 1426 | 1426 | . "Host: $host_port\r\n" |
| 1427 | - . 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n" |
|
| 1428 | - . ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n")) |
|
| 1427 | + . 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n" |
|
| 1428 | + . ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n")) |
|
| 1429 | 1429 | . (!$site ? '' : "Referer: $site/$referer\r\n") |
| 1430 | - . (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n")) |
|
| 1431 | - . (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n")) |
|
| 1430 | + . (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n")) |
|
| 1431 | + . (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n")) |
|
| 1432 | 1432 | . (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n") |
| 1433 | 1433 | . (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n"); |
| 1434 | 1434 | |