@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | 19 | return; |
| 20 | 20 | } |
| 21 | -require_once _ROOT_RESTREINT . 'base/objets.php'; |
|
| 21 | +require_once _ROOT_RESTREINT.'base/objets.php'; |
|
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $f = (!preg_match('/^[\w\.]*$/', $serveur)) |
| 60 | 60 | ? '' // nom de serveur mal ecrit |
| 61 | 61 | : ($serveur ? |
| 62 | - (_DIR_CONNECT . $serveur . '.php') // serveur externe |
|
| 62 | + (_DIR_CONNECT.$serveur.'.php') // serveur externe |
|
| 63 | 63 | : (_FILE_CONNECT ? _FILE_CONNECT // serveur principal ok |
| 64 | 64 | : ($install ? _FILE_CONNECT_TMP // init du serveur principal |
| 65 | 65 | : ''))); // installation pas faite |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | // chargement de la version du jeu de fonctions |
| 103 | 103 | // si pas dans le fichier par defaut |
| 104 | 104 | $type = $GLOBALS['db_ok']['type']; |
| 105 | - $jeu = 'spip_' . $type . '_functions_' . $version; |
|
| 105 | + $jeu = 'spip_'.$type.'_functions_'.$version; |
|
| 106 | 106 | if (!isset($GLOBALS[$jeu])) { |
| 107 | - if (!find_in_path($type . '_' . $version . '.php', 'req/', true)) { |
|
| 107 | + if (!find_in_path($type.'_'.$version.'.php', 'req/', true)) { |
|
| 108 | 108 | spip_log("spip_connect: serveur $index version '$version' non defini pour '$type'", _LOG_HS); |
| 109 | 109 | |
| 110 | 110 | // ne plus reessayer |
@@ -166,9 +166,9 @@ discard block |
||
| 166 | 166 | $connexion = spip_connect($serveur); |
| 167 | 167 | $e = sql_errno($serveur); |
| 168 | 168 | $t = (isset($connexion['type']) ? $connexion['type'] : 'sql'); |
| 169 | - $m = "Erreur $e de $t: " . sql_error($serveur) . "\nin " . sql_error_backtrace() . "\n" . trim($connexion['last']); |
|
| 170 | - $f = $t . $serveur; |
|
| 171 | - spip_log($m, $f . '.' . _LOG_ERREUR); |
|
| 169 | + $m = "Erreur $e de $t: ".sql_error($serveur)."\nin ".sql_error_backtrace()."\n".trim($connexion['last']); |
|
| 170 | + $f = $t.$serveur; |
|
| 171 | + spip_log($m, $f.'.'._LOG_ERREUR); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | // si en cours d'installation ou si db=@test@ on ne pose rien |
| 251 | 251 | // car c'est un test de connexion |
| 252 | 252 | if (!defined('_ECRIRE_INSTALL') and $db !== '@test@') { |
| 253 | - $f = _DIR_TMP . $type . '.' . substr(md5($host . $port . $db), 0, 8) . '.out'; |
|
| 253 | + $f = _DIR_TMP.$type.'.'.substr(md5($host.$port.$db), 0, 8).'.out'; |
|
| 254 | 254 | } elseif ($db == '@test@') { |
| 255 | 255 | $db = ''; |
| 256 | 256 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | // En cas d'indisponibilite du serveur, eviter de le bombarder |
| 291 | 291 | if ($f) { |
| 292 | 292 | @touch($f); |
| 293 | - spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type . '.' . _LOG_HS); |
|
| 293 | + spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type.'.'._LOG_HS); |
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | |
@@ -382,8 +382,7 @@ discard block |
||
| 382 | 382 | * @return string Valeur échappée. |
| 383 | 383 | **/ |
| 384 | 384 | function _q($a) { |
| 385 | - return (is_numeric($a)) ? strval($a) : |
|
| 386 | - (!is_array($a) ? ("'" . addslashes($a) . "'") |
|
| 385 | + return (is_numeric($a)) ? strval($a) : (!is_array($a) ? ("'".addslashes($a)."'") |
|
| 387 | 386 | : join(',', array_map('_q', $a))); |
| 388 | 387 | } |
| 389 | 388 | |
@@ -425,7 +424,7 @@ discard block |
||
| 425 | 424 | break; |
| 426 | 425 | default: |
| 427 | 426 | $replace = range(1, count($textes)); |
| 428 | - $replace = '%' . implode('$s,%', $replace) . '$s'; |
|
| 427 | + $replace = '%'.implode('$s,%', $replace).'$s'; |
|
| 429 | 428 | $replace = explode(',', $replace); |
| 430 | 429 | break; |
| 431 | 430 | } |
@@ -975,7 +975,7 @@ |
||
| 975 | 975 | if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) { |
| 976 | 976 | define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))'); |
| 977 | 977 | } |
| 978 | - $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')'; |
|
| 978 | + $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml('._TRAITEMENT_RACCOURCIS.')'; |
|
| 979 | 979 | $GLOBALS['table_des_traitements']['NOM_SITE']['spip_auteurs'] = 'entites_html(%s)'; |
| 980 | 980 | $GLOBALS['table_des_traitements']['NOM']['spip_auteurs'] = 'safehtml(%s)'; |
| 981 | 981 | $GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | define('_INC_DISTANT_CONTENT_ENCODING', 'gzip'); |
| 27 | 27 | } |
| 28 | 28 | if (!defined('_INC_DISTANT_USER_AGENT')) { |
| 29 | - define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')'); |
|
| 29 | + define('_INC_DISTANT_USER_AGENT', 'SPIP-'.$GLOBALS['spip_version_affichee'].' ('.$GLOBALS['home_server'].')'); |
|
| 30 | 30 | } |
| 31 | 31 | if (!defined('_INC_DISTANT_MAX_SIZE')) { |
| 32 | 32 | define('_INC_DISTANT_MAX_SIZE', 2097152); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | define('_INC_DISTANT_CONNECT_TIMEOUT', 10); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -define('_REGEXP_COPIE_LOCALE', ',' . |
|
| 38 | +define('_REGEXP_COPIE_LOCALE', ','. |
|
| 39 | 39 | preg_replace( |
| 40 | 40 | '@^https?:@', |
| 41 | 41 | 'https?:', |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // si c'est la protection de soi-meme, retourner le path |
| 72 | 72 | if ($mode !== 'force' and preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) { |
| 73 | - $source = substr(_DIR_IMG, strlen(_DIR_RACINE)) . urldecode($match[1]); |
|
| 73 | + $source = substr(_DIR_IMG, strlen(_DIR_RACINE)).urldecode($match[1]); |
|
| 74 | 74 | |
| 75 | 75 | return @file_exists($source) ? $source : false; |
| 76 | 76 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $localrac = _DIR_RACINE . $local; |
|
| 93 | + $localrac = _DIR_RACINE.$local; |
|
| 94 | 94 | $t = ($mode == 'force') ? false : @file_exists($localrac); |
| 95 | 95 | |
| 96 | 96 | // test d'existence du fichier |
@@ -115,13 +115,13 @@ discard block |
||
| 115 | 115 | ['file' => $localrac, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : ''] |
| 116 | 116 | ); |
| 117 | 117 | if (!$res or (!$res['length'] and $res['status'] != 304)) { |
| 118 | - spip_log("copie_locale : Echec recuperation $source sur $localrac status : " . $res['status'], 'distant' . _LOG_INFO_IMPORTANTE); |
|
| 118 | + spip_log("copie_locale : Echec recuperation $source sur $localrac status : ".$res['status'], 'distant'._LOG_INFO_IMPORTANTE); |
|
| 119 | 119 | } |
| 120 | 120 | if (!$res['length']) { |
| 121 | 121 | // si $t c'est sans doute juste un not-modified-since |
| 122 | 122 | return $t ? $local : false; |
| 123 | 123 | } |
| 124 | - spip_log("copie_locale : recuperation $source sur $localrac taille " . $res['length'] . ' OK', 'distant'); |
|
| 124 | + spip_log("copie_locale : recuperation $source sur $localrac taille ".$res['length'].' OK', 'distant'); |
|
| 125 | 125 | |
| 126 | 126 | // si on retrouve l'extension |
| 127 | 127 | if ( |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | $parts = array_map('intval', explode('.', $ip)); |
| 219 | 219 | if ( |
| 220 | 220 | 127 === $parts[0] or 10 === $parts[0] or 0 === $parts[0] |
| 221 | - or ( 172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1] ) |
|
| 222 | - or ( 192 === $parts[0] && 168 === $parts[1] ) |
|
| 221 | + or (172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1]) |
|
| 222 | + or (192 === $parts[0] && 168 === $parts[1]) |
|
| 223 | 223 | ) { |
| 224 | 224 | return false; |
| 225 | 225 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | $port = $parsed_url['port']; |
| 234 | - if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 234 | + if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 235 | 235 | return $url; |
| 236 | 236 | } |
| 237 | 237 | |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | if ($taille > 500) { |
| 304 | - $boundary = substr(md5(rand() . 'spip'), 0, 8); |
|
| 304 | + $boundary = substr(md5(rand().'spip'), 0, 8); |
|
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | |
@@ -329,16 +329,16 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | } else { |
| 331 | 331 | // fabrique une chaine HTTP simple pour un POST |
| 332 | - $entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n"; |
|
| 332 | + $entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n"; |
|
| 333 | 333 | $chaine = []; |
| 334 | 334 | if (is_array($donnees)) { |
| 335 | 335 | foreach ($donnees as $cle => $valeur) { |
| 336 | 336 | if (is_array($valeur)) { |
| 337 | 337 | foreach ($valeur as $val2) { |
| 338 | - $chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2); |
|
| 338 | + $chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2); |
|
| 339 | 339 | } |
| 340 | 340 | } else { |
| 341 | - $chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur); |
|
| 341 | + $chaine[] = rawurlencode($cle).'='.rawurlencode($valeur); |
|
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | $chaine = implode('&', $chaine); |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $url_idn = implode($host_ascii, $url_idn); |
| 373 | 373 | } |
| 374 | 374 | // et on urlencode les char utf si besoin dans le path |
| 375 | - $url_idn = preg_replace_callback('/[^\x20-\x7f]/', function ($match) { |
|
| 375 | + $url_idn = preg_replace_callback('/[^\x20-\x7f]/', function($match) { |
|
| 376 | 376 | return urlencode($match[0]); |
| 377 | 377 | }, $url_idn); |
| 378 | 378 | } |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $head_add = ''; |
| 451 | 451 | if (!empty($options['headers'])) { |
| 452 | 452 | foreach ($options['headers'] as $champ => $valeur) { |
| 453 | - $head_add .= $champ . ': ' . $valeur . "\r\n"; |
|
| 453 | + $head_add .= $champ.': '.$valeur."\r\n"; |
|
| 454 | 454 | } |
| 455 | 455 | // ne pas le repasser a recuperer_url si on follow un location, car ils seront dans datas |
| 456 | 456 | unset($options['headers']); |
@@ -460,9 +460,9 @@ discard block |
||
| 460 | 460 | list($head, $postdata) = prepare_donnees_post($options['datas'], $options['boundary']); |
| 461 | 461 | $head .= $head_add; |
| 462 | 462 | if (stripos($head, 'Content-Length:') === false) { |
| 463 | - $head .= 'Content-Length: ' . strlen($postdata) . "\r\n"; |
|
| 463 | + $head .= 'Content-Length: '.strlen($postdata)."\r\n"; |
|
| 464 | 464 | } |
| 465 | - $options['datas'] = $head . "\r\n" . $postdata; |
|
| 465 | + $options['datas'] = $head."\r\n".$postdata; |
|
| 466 | 466 | if ( |
| 467 | 467 | strlen($postdata) |
| 468 | 468 | and !$methode_demandee |
@@ -470,15 +470,15 @@ discard block |
||
| 470 | 470 | $options['methode'] = 'POST'; |
| 471 | 471 | } |
| 472 | 472 | } elseif ($head_add) { |
| 473 | - $options['datas'] = $head_add . "\r\n"; |
|
| 473 | + $options['datas'] = $head_add."\r\n"; |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | // Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole |
| 477 | 477 | $url = preg_replace(',^feed://,i', 'http://', $url); |
| 478 | 478 | if (!tester_url_absolue($url)) { |
| 479 | - $url = 'http://' . $url; |
|
| 479 | + $url = 'http://'.$url; |
|
| 480 | 480 | } elseif (strncmp($url, '//', 2) == 0) { |
| 481 | - $url = 'http:' . $url; |
|
| 481 | + $url = 'http:'.$url; |
|
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | $url = url_to_ascii($url); |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | $options['if_modified_since'] |
| 508 | 508 | ); |
| 509 | 509 | if (!$handle) { |
| 510 | - spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR); |
|
| 510 | + spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR); |
|
| 511 | 511 | |
| 512 | 512 | return false; |
| 513 | 513 | } |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | 'status' => 200, |
| 538 | 538 | ]; |
| 539 | 539 | } else { |
| 540 | - spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR); |
|
| 540 | + spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR); |
|
| 541 | 541 | return false; |
| 542 | 542 | } |
| 543 | 543 | } elseif ($res['location'] and $options['follow_location']) { |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | |
| 550 | 550 | return recuperer_url($url, $options); |
| 551 | 551 | } elseif ($res['status'] !== 200) { |
| 552 | - spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant'); |
|
| 552 | + spip_log('HTTP status '.$res['status']." pour $url", 'distant'); |
|
| 553 | 553 | } |
| 554 | 554 | $result['status'] = $res['status']; |
| 555 | 555 | if (isset($res['headers'])) { |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | $gz = false; |
| 576 | 576 | if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) { |
| 577 | - $gz = (_DIR_TMP . md5(uniqid(mt_rand())) . '.tmp.gz'); |
|
| 577 | + $gz = (_DIR_TMP.md5(uniqid(mt_rand())).'.tmp.gz'); |
|
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | // si on a pas deja recuperer le contenu par une methode detournee |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | $sig['url'] = $url; |
| 661 | 661 | |
| 662 | 662 | $dir = sous_repertoire(_DIR_CACHE, 'curl'); |
| 663 | - $cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 663 | + $cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 664 | 664 | $sub = sous_repertoire($dir, substr($cache, 0, 2)); |
| 665 | 665 | $cache = "$sub$cache"; |
| 666 | 666 | |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | $fp = false; |
| 714 | 714 | if ($fichier) { |
| 715 | 715 | include_spip('inc/acces'); |
| 716 | - $tmpfile = "$fichier." . creer_uniqid() . '.tmp'; |
|
| 716 | + $tmpfile = "$fichier.".creer_uniqid().'.tmp'; |
|
| 717 | 717 | $fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX); |
| 718 | 718 | if (!$fp and file_exists($fichier)) { |
| 719 | 719 | return filesize($fichier); |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | } |
| 773 | 773 | $result['status'] = intval($r[1]); |
| 774 | 774 | while ($s = trim(fgets($handle, 16384))) { |
| 775 | - $result['headers'][] = $s . "\n"; |
|
| 775 | + $result['headers'][] = $s."\n"; |
|
| 776 | 776 | preg_match(',^([^:]*): *(.*)$,i', $s, $r); |
| 777 | 777 | list(, $d, $v) = $r; |
| 778 | 778 | if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) { |
@@ -821,13 +821,13 @@ discard block |
||
| 821 | 821 | |
| 822 | 822 | // on se place tout le temps comme si on etait a la racine |
| 823 | 823 | if (_DIR_RACINE) { |
| 824 | - $d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d); |
|
| 824 | + $d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d); |
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | $m = md5($source); |
| 828 | 828 | |
| 829 | 829 | return $d |
| 830 | - . substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12) |
|
| 830 | + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12) |
|
| 831 | 831 | . substr($m, 0, 4) |
| 832 | 832 | . ".$extension"; |
| 833 | 833 | } |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | // Si c'est deja local pas de souci |
| 851 | 851 | if (!tester_url_absolue($source)) { |
| 852 | 852 | if (_DIR_RACINE) { |
| 853 | - $source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source); |
|
| 853 | + $source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source); |
|
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | return $source; |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | $ext |
| 869 | 869 | and preg_match(',^\w+$,', $ext) // pas de php?truc=1&... |
| 870 | 870 | and $f = nom_fichier_copie_locale($source, $ext) |
| 871 | - and file_exists(_DIR_RACINE . $f) |
|
| 871 | + and file_exists(_DIR_RACINE.$f) |
|
| 872 | 872 | ) { |
| 873 | 873 | return $f; |
| 874 | 874 | } |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | |
| 877 | 877 | // Si c'est deja dans la table des documents, |
| 878 | 878 | // ramener le nom de sa copie potentielle |
| 879 | - $ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''"); |
|
| 879 | + $ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''"); |
|
| 880 | 880 | |
| 881 | 881 | if ($ext) { |
| 882 | 882 | return nom_fichier_copie_locale($source, $ext); |
@@ -887,9 +887,9 @@ discard block |
||
| 887 | 887 | |
| 888 | 888 | $ext = $path_parts ? $path_parts['extension'] : ''; |
| 889 | 889 | |
| 890 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 890 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 891 | 891 | $f = nom_fichier_copie_locale($source, $ext); |
| 892 | - if (file_exists(_DIR_RACINE . $f)) { |
|
| 892 | + if (file_exists(_DIR_RACINE.$f)) { |
|
| 893 | 893 | return $f; |
| 894 | 894 | } |
| 895 | 895 | } |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | // Ping pour voir si son extension est connue et autorisee |
| 898 | 898 | // avec mise en cache du resultat du ping |
| 899 | 899 | |
| 900 | - $cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source); |
|
| 900 | + $cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source); |
|
| 901 | 901 | if ( |
| 902 | 902 | !@file_exists($cache) |
| 903 | 903 | or !$path_parts = @unserialize(spip_file_get_contents($cache)) |
@@ -907,10 +907,10 @@ discard block |
||
| 907 | 907 | ecrire_fichier($cache, serialize($path_parts)); |
| 908 | 908 | } |
| 909 | 909 | $ext = !empty($path_parts['extension']) ? $path_parts['extension'] : ''; |
| 910 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 910 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 911 | 911 | return nom_fichier_copie_locale($source, $ext); |
| 912 | 912 | } |
| 913 | - spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR); |
|
| 913 | + spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR); |
|
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | |
@@ -994,7 +994,7 @@ discard block |
||
| 994 | 994 | } else { |
| 995 | 995 | if ($a['body']) { |
| 996 | 996 | $a['extension'] = $extension; |
| 997 | - $a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension); |
|
| 997 | + $a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension); |
|
| 998 | 998 | ecrire_fichier($a['fichier'], $a['body']); |
| 999 | 999 | $size_image = @spip_getimagesize($a['fichier']); |
| 1000 | 1000 | $a['largeur'] = intval($size_image[0]); |
@@ -1059,20 +1059,20 @@ discard block |
||
| 1059 | 1059 | !$t |
| 1060 | 1060 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1061 | 1061 | ) { |
| 1062 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1062 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1063 | 1063 | } |
| 1064 | 1064 | if ( |
| 1065 | 1065 | !$t |
| 1066 | 1066 | and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m) |
| 1067 | 1067 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext) |
| 1068 | 1068 | ) { |
| 1069 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1069 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1070 | 1070 | } |
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | // Autre mime/type (ou text/plain avec fichier d'extension inconnue) |
| 1074 | 1074 | if (!$t) { |
| 1075 | - $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type)); |
|
| 1075 | + $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type)); |
|
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | // Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg) |
@@ -1083,11 +1083,11 @@ discard block |
||
| 1083 | 1083 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1084 | 1084 | ) { |
| 1085 | 1085 | # eviter xxx.3 => 3gp (> SPIP 3) |
| 1086 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1086 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | 1089 | if ($t) { |
| 1090 | - spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant'); |
|
| 1090 | + spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant'); |
|
| 1091 | 1091 | return $t['extension']; |
| 1092 | 1092 | } else { |
| 1093 | 1093 | # par defaut on retombe sur '.bin' si c'est autorise |
@@ -1190,7 +1190,7 @@ discard block |
||
| 1190 | 1190 | } |
| 1191 | 1191 | } else { |
| 1192 | 1192 | $scheme = $t['scheme']; |
| 1193 | - $noproxy = $scheme . '://'; |
|
| 1193 | + $noproxy = $scheme.'://'; |
|
| 1194 | 1194 | } |
| 1195 | 1195 | if (isset($t['user'])) { |
| 1196 | 1196 | $user = [$t['user'], $t['pass']]; |
@@ -1204,7 +1204,7 @@ discard block |
||
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | 1206 | if (!empty($t['query'])) { |
| 1207 | - $path .= '?' . $t['query']; |
|
| 1207 | + $path .= '?'.$t['query']; |
|
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | $f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date); |
@@ -1278,20 +1278,20 @@ discard block |
||
| 1278 | 1278 | $proxy_user = ''; |
| 1279 | 1279 | $http_proxy = need_proxy($host); |
| 1280 | 1280 | if ($user) { |
| 1281 | - $user = urlencode($user[0]) . ':' . urlencode($user[1]); |
|
| 1281 | + $user = urlencode($user[0]).':'.urlencode($user[1]); |
|
| 1282 | 1282 | } |
| 1283 | 1283 | |
| 1284 | 1284 | $connect = ''; |
| 1285 | 1285 | if ($http_proxy) { |
| 1286 | - if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) { |
|
| 1287 | - $path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : ''); |
|
| 1288 | - $connect = 'CONNECT ' . $path_host . " $vers\r\n" |
|
| 1286 | + if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) { |
|
| 1287 | + $path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : ''); |
|
| 1288 | + $connect = 'CONNECT '.$path_host." $vers\r\n" |
|
| 1289 | 1289 | . "Host: $path_host\r\n" |
| 1290 | 1290 | . "Proxy-Connection: Keep-Alive\r\n"; |
| 1291 | 1291 | } else { |
| 1292 | - $path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://") |
|
| 1292 | + $path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://") |
|
| 1293 | 1293 | . (!$user ? '' : "$user@") |
| 1294 | - . "$host" . (($port != 80) ? ":$port" : '') . $path; |
|
| 1294 | + . "$host".(($port != 80) ? ":$port" : '').$path; |
|
| 1295 | 1295 | } |
| 1296 | 1296 | $t2 = @parse_url($http_proxy); |
| 1297 | 1297 | $first_host = $t2['host']; |
@@ -1299,10 +1299,10 @@ discard block |
||
| 1299 | 1299 | $port = 80; |
| 1300 | 1300 | } |
| 1301 | 1301 | if ($t2['user']) { |
| 1302 | - $proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']); |
|
| 1302 | + $proxy_user = base64_encode($t2['user'].':'.$t2['pass']); |
|
| 1303 | 1303 | } |
| 1304 | 1304 | } else { |
| 1305 | - $first_host = $noproxy . $host; |
|
| 1305 | + $first_host = $noproxy.$host; |
|
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | 1308 | if ($connect) { |
@@ -1324,7 +1324,7 @@ discard block |
||
| 1324 | 1324 | ); |
| 1325 | 1325 | spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect'); |
| 1326 | 1326 | if (!$f) { |
| 1327 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1327 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1328 | 1328 | return $errno; |
| 1329 | 1329 | } |
| 1330 | 1330 | stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT); |
@@ -1337,7 +1337,7 @@ discard block |
||
| 1337 | 1337 | or !count($res = explode(' ', $res)) |
| 1338 | 1338 | or $res[1] !== '200' |
| 1339 | 1339 | ) { |
| 1340 | - spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE); |
|
| 1340 | + spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE); |
|
| 1341 | 1341 | fclose($f); |
| 1342 | 1342 | |
| 1343 | 1343 | return false; |
@@ -1354,7 +1354,7 @@ discard block |
||
| 1354 | 1354 | } while (!$f and $ntry-- and $errno !== 110 and sleep(1)); |
| 1355 | 1355 | spip_log("Recuperer $path sur $first_host:$port par $f"); |
| 1356 | 1356 | if (!$f) { |
| 1357 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1357 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1358 | 1358 | |
| 1359 | 1359 | return $errno; |
| 1360 | 1360 | } |
@@ -1364,16 +1364,16 @@ discard block |
||
| 1364 | 1364 | $site = isset($GLOBALS['meta']['adresse_site']) ? $GLOBALS['meta']['adresse_site'] : ''; |
| 1365 | 1365 | |
| 1366 | 1366 | $host_port = $host; |
| 1367 | - if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) { |
|
| 1367 | + if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) { |
|
| 1368 | 1368 | $host_port .= ":$port"; |
| 1369 | 1369 | } |
| 1370 | 1370 | $req = "$method $path $vers\r\n" |
| 1371 | 1371 | . "Host: $host_port\r\n" |
| 1372 | - . 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n" |
|
| 1373 | - . ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n")) |
|
| 1372 | + . 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n" |
|
| 1373 | + . ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n")) |
|
| 1374 | 1374 | . (!$site ? '' : "Referer: $site/$referer\r\n") |
| 1375 | - . (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n")) |
|
| 1376 | - . (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n")) |
|
| 1375 | + . (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n")) |
|
| 1376 | + . (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n")) |
|
| 1377 | 1377 | . (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n") |
| 1378 | 1378 | . (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n"); |
| 1379 | 1379 | |
@@ -155,23 +155,23 @@ discard block |
||
| 155 | 155 | or !$r = verifier_upload_autorise($dest) |
| 156 | 156 | or $r['autozip'] |
| 157 | 157 | ) { |
| 158 | - $dest = substr($dest, 0, -strlen($m[0])) . '_' . $m[1]; |
|
| 158 | + $dest = substr($dest, 0, -strlen($m[0])).'_'.$m[1]; |
|
| 159 | 159 | break; |
| 160 | 160 | } |
| 161 | 161 | else { |
| 162 | 162 | $dest = substr($dest, 0, -strlen($m[0])); |
| 163 | - $ext = $m[1] . '.' . $ext; |
|
| 163 | + $ext = $m[1].'.'.$ext; |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // Si le document "source" est deja au bon endroit, ne rien faire |
| 168 | - if ($source == ($dir . $dest . '.' . $ext)) { |
|
| 168 | + if ($source == ($dir.$dest.'.'.$ext)) { |
|
| 169 | 169 | return $source; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // sinon tourner jusqu'a trouver un numero correct |
| 173 | 173 | $n = 0; |
| 174 | - while (@file_exists($newFile = $dir . $dest . ($n++ ? ('-' . $n) : '') . '.' . $ext)) { |
|
| 174 | + while (@file_exists($newFile = $dir.$dest.($n++ ? ('-'.$n) : '').'.'.$ext)) { |
|
| 175 | 175 | ; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | function deplacer_fichier_upload($source, $dest, $move = false) { |
| 233 | 233 | // Securite |
| 234 | 234 | if (substr($dest, 0, strlen(_DIR_RACINE)) == _DIR_RACINE) { |
| 235 | - $dest = _DIR_RACINE . preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE))); |
|
| 235 | + $dest = _DIR_RACINE.preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE))); |
|
| 236 | 236 | } else { |
| 237 | 237 | $dest = preg_replace(',\.\.+,', '.', $dest); |
| 238 | 238 | } |
@@ -314,8 +314,8 @@ discard block |
||
| 314 | 314 | |
| 315 | 315 | default: /* autre */ |
| 316 | 316 | if (!$msg) { |
| 317 | - $msg = _T('pass_erreur') . ' ' . $error |
|
| 318 | - . '<br />' . propre('[->http://php.net/manual/fr/features.file-upload.errors.php]'); |
|
| 317 | + $msg = _T('pass_erreur').' '.$error |
|
| 318 | + . '<br />'.propre('[->http://php.net/manual/fr/features.file-upload.errors.php]'); |
|
| 319 | 319 | } |
| 320 | 320 | break; |
| 321 | 321 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | include_spip('inc/minipres'); |
| 334 | 334 | echo minipres( |
| 335 | 335 | $msg, |
| 336 | - "<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><a href='" . rawurldecode($GLOBALS['redirect']) . "'><button type='button'>" . _T('ecrire:bouton_suivant') . '</button></a></div>' |
|
| 336 | + "<div style='text-align: ".$GLOBALS['spip_lang_right']."'><a href='".rawurldecode($GLOBALS['redirect'])."'><button type='button'>"._T('ecrire:bouton_suivant').'</button></a></div>' |
|
| 337 | 337 | ); |
| 338 | 338 | exit; |
| 339 | 339 | } |