@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | * @return string |
| 334 | 334 | */ |
| 335 | 335 | function _sqlite_func_preg_replace($quoi, $cherche, $remplace) { |
| 336 | - $return = preg_replace('%' . $cherche . '%', $remplace, $quoi); |
|
| 336 | + $return = preg_replace('%'.$cherche.'%', $remplace, $quoi); |
|
| 337 | 337 | |
| 338 | 338 | #spip_log("preg_replace : $quoi, $cherche, $remplace, $return",'sqlite.'._LOG_DEBUG); |
| 339 | 339 | return $return; |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | // il faut enlever un niveau d'echappement pour être homogène à mysql |
| 410 | 410 | $cherche = str_replace('\\\\', '\\', $cherche); |
| 411 | 411 | $u = isset($GLOBALS['meta']['pcre_u']) ? $GLOBALS['meta']['pcre_u'] : 'u'; |
| 412 | - $return = preg_match('%' . $cherche . '%imsS' . $u, $quoi); |
|
| 412 | + $return = preg_match('%'.$cherche.'%imsS'.$u, $quoi); |
|
| 413 | 413 | |
| 414 | 414 | #spip_log("regexp_replace : $quoi, $cherche, $remplace, $return",'sqlite.'._LOG_DEBUG); |
| 415 | 415 | return $return; |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $count = 0; |
| 462 | 462 | str_replace($mysql_to_strftime_not_ok, '', $conv, $count); |
| 463 | 463 | if ($count > 0) { |
| 464 | - spip_log("DATE_FORMAT : At least one parameter can't be parsed by strftime with format '$conv'", 'sqlite.' . _LOG_ERREUR); |
|
| 464 | + spip_log("DATE_FORMAT : At least one parameter can't be parsed by strftime with format '$conv'", 'sqlite.'._LOG_ERREUR); |
|
| 465 | 465 | } |
| 466 | 466 | $to_strftime[$conv] = str_replace(array_keys($mysql_to_strftime), $mysql_to_strftime, $conv); |
| 467 | 467 | } |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | */ |
| 481 | 481 | function _sqlite_func_to_days($d) { |
| 482 | 482 | static $offset = 719528; // nb de jour entre 0000-00-00 et timestamp 0=1970-01-01 |
| 483 | - $result = $offset + (int)ceil(_sqlite_func_unix_timestamp($d) / (24 * 3600)); |
|
| 483 | + $result = $offset + (int) ceil(_sqlite_func_unix_timestamp($d) / (24 * 3600)); |
|
| 484 | 484 | |
| 485 | 485 | #spip_log("Passage avec TO_DAYS : $d, $result",'sqlite.'._LOG_DEBUG); |
| 486 | 486 | return $result; |
@@ -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 | |
@@ -399,7 +398,7 @@ discard block |
||
| 399 | 398 | * @param string $query |
| 400 | 399 | * @return array |
| 401 | 400 | */ |
| 402 | -function query_echappe_textes($query, $uniqid=null) { |
|
| 401 | +function query_echappe_textes($query, $uniqid = null) { |
|
| 403 | 402 | static $codeEchappements = null; |
| 404 | 403 | if (is_null($codeEchappements) or $uniqid) { |
| 405 | 404 | if (is_null($uniqid)) { |
@@ -444,7 +443,7 @@ discard block |
||
| 444 | 443 | break; |
| 445 | 444 | default: |
| 446 | 445 | $replace = range(1, count($textes)); |
| 447 | - $replace = '%' . implode('$s,%', $replace) . '$s'; |
|
| 446 | + $replace = '%'.implode('$s,%', $replace).'$s'; |
|
| 448 | 447 | $replace = explode(',', $replace); |
| 449 | 448 | break; |
| 450 | 449 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | if (!$link) { |
| 63 | - spip_log('Echec mysqli_connect. Erreur : ' . mysqli_connect_error(), 'mysql.' . _LOG_HS); |
|
| 63 | + spip_log('Echec mysqli_connect. Erreur : '.mysqli_connect_error(), 'mysql.'._LOG_HS); |
|
| 64 | 64 | |
| 65 | 65 | return false; |
| 66 | 66 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | spip_log( |
| 82 | - "Connexion MySQLi vers $host, base $db, prefixe $prefixe " . ($ok ? 'operationnelle' : 'impossible'), |
|
| 82 | + "Connexion MySQLi vers $host, base $db, prefixe $prefixe ".($ok ? 'operationnelle' : 'impossible'), |
|
| 83 | 83 | _LOG_DEBUG |
| 84 | 84 | ); |
| 85 | 85 | |
@@ -169,9 +169,9 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | function spip_mysql_set_charset($charset, $serveur = '', $requeter = true) { |
| 171 | 171 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 172 | - spip_log('changement de charset sql : ' . 'SET NAMES ' . _q($charset), _LOG_DEBUG); |
|
| 172 | + spip_log('changement de charset sql : '.'SET NAMES '._q($charset), _LOG_DEBUG); |
|
| 173 | 173 | |
| 174 | - return mysqli_query($connexion['link'], $connexion['last'] = 'SET NAMES ' . _q($charset)); |
|
| 174 | + return mysqli_query($connexion['link'], $connexion['last'] = 'SET NAMES '._q($charset)); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | function spip_mysql_get_charset($charset = [], $serveur = '', $requeter = true) { |
| 187 | 187 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 188 | 188 | $connexion['last'] = $c = 'SHOW CHARACTER SET' |
| 189 | - . (!$charset ? '' : (' LIKE ' . _q($charset['charset']))); |
|
| 189 | + . (!$charset ? '' : (' LIKE '._q($charset['charset']))); |
|
| 190 | 190 | |
| 191 | 191 | return spip_mysql_fetch(mysqli_query($connexion['link'], $c), null, $serveur); |
| 192 | 192 | } |
@@ -230,19 +230,19 @@ discard block |
||
| 230 | 230 | $debug = ''; |
| 231 | 231 | if (defined('_DEBUG_SLOW_QUERIES') and _DEBUG_SLOW_QUERIES) { |
| 232 | 232 | if (isset($GLOBALS['debug']['aucasou'])) { |
| 233 | - list(, $id, , $infos) = $GLOBALS['debug']['aucasou']; |
|
| 234 | - $debug .= "BOUCLE$id @ " . (isset($infos[0]) ? $infos[0] : '') . ' | '; |
|
| 233 | + list(, $id,, $infos) = $GLOBALS['debug']['aucasou']; |
|
| 234 | + $debug .= "BOUCLE$id @ ".(isset($infos[0]) ? $infos[0] : '').' | '; |
|
| 235 | 235 | } |
| 236 | 236 | if (isset($_SERVER['REQUEST_URI'])) { |
| 237 | 237 | $debug .= $_SERVER['REQUEST_URI']; |
| 238 | 238 | } |
| 239 | 239 | if (!empty($GLOBALS['ip'])) { |
| 240 | - $debug .= ' + ' . $GLOBALS['ip']; |
|
| 240 | + $debug .= ' + '.$GLOBALS['ip']; |
|
| 241 | 241 | } |
| 242 | - $debug = ' /* ' . mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)) . ' */'; |
|
| 242 | + $debug = ' /* '.mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)).' */'; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - $r = mysqli_query($link, $query . $debug); |
|
| 245 | + $r = mysqli_query($link, $query.$debug); |
|
| 246 | 246 | |
| 247 | 247 | //Eviter de propager le GoneAway sur les autres requetes d'un même processus PHP |
| 248 | 248 | if ($e = spip_mysql_errno($serveur)) { // Log d'un Gone Away |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 256 | 256 | $link = $connexion['link']; |
| 257 | 257 | //On retente au cas où |
| 258 | - $r = mysqli_query($link, $query . $debug); |
|
| 258 | + $r = mysqli_query($link, $query.$debug); |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | // d'utiliser ceux-ci, copie-colle de phpmyadmin |
| 284 | 284 | $query = preg_replace(',^TABLE\s*`([^`]*)`,i', "TABLE \\1", $query); |
| 285 | 285 | |
| 286 | - return spip_mysql_query('ALTER ' . $query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 286 | + return spip_mysql_query('ALTER '.$query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * @return bool Toujours true |
| 297 | 297 | */ |
| 298 | 298 | function spip_mysql_optimize($table, $serveur = '', $requeter = true) { |
| 299 | - spip_mysql_query('OPTIMIZE TABLE ' . $table); |
|
| 299 | + spip_mysql_query('OPTIMIZE TABLE '.$table); |
|
| 300 | 300 | |
| 301 | 301 | return true; |
| 302 | 302 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | $link = $connexion['link']; |
| 320 | 320 | $db = $connexion['db']; |
| 321 | 321 | |
| 322 | - $query = 'EXPLAIN ' . _mysql_traite_query($query, $db, $prefixe); |
|
| 322 | + $query = 'EXPLAIN '._mysql_traite_query($query, $db, $prefixe); |
|
| 323 | 323 | $r = mysqli_query($link, $query); |
| 324 | 324 | |
| 325 | 325 | return spip_mysql_fetch($r, null, $serveur); |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | . calculer_mysql_expression('WHERE', $where) |
| 371 | 371 | . calculer_mysql_expression('GROUP BY', $groupby, ',') |
| 372 | 372 | . calculer_mysql_expression('HAVING', $having) |
| 373 | - . ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) : '') |
|
| 373 | + . ($orderby ? ("\nORDER BY ".spip_mysql_order($orderby)) : '') |
|
| 374 | 374 | . ($limit ? "\nLIMIT $limit" : ''); |
| 375 | 375 | |
| 376 | 376 | // renvoyer la requete inerte si demandee |
@@ -460,12 +460,12 @@ discard block |
||
| 460 | 460 | $exp = "\n$expression "; |
| 461 | 461 | |
| 462 | 462 | if (!is_array($v)) { |
| 463 | - return $exp . $v; |
|
| 463 | + return $exp.$v; |
|
| 464 | 464 | } else { |
| 465 | 465 | if (strtoupper($join) === 'AND') { |
| 466 | - return $exp . join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 466 | + return $exp.join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 467 | 467 | } else { |
| 468 | - return $exp . join($join, $v); |
|
| 468 | + return $exp.join($join, $v); |
|
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | } |
@@ -483,17 +483,17 @@ discard block |
||
| 483 | 483 | if (substr($k, -1) == '@') { |
| 484 | 484 | // c'est une jointure qui se refere au from precedent |
| 485 | 485 | // pas de virgule |
| 486 | - $res .= ' ' . $v; |
|
| 486 | + $res .= ' '.$v; |
|
| 487 | 487 | } else { |
| 488 | 488 | if (!is_numeric($k)) { |
| 489 | 489 | $p = strpos($v, ' '); |
| 490 | 490 | if ($p) { |
| 491 | - $v = substr($v, 0, $p) . " AS `$k`" . substr($v, $p); |
|
| 491 | + $v = substr($v, 0, $p)." AS `$k`".substr($v, $p); |
|
| 492 | 492 | } else { |
| 493 | 493 | $v .= " AS `$k`"; |
| 494 | 494 | } |
| 495 | 495 | } |
| 496 | - $res .= ', ' . $v; |
|
| 496 | + $res .= ', '.$v; |
|
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | 499 | |
@@ -523,13 +523,13 @@ discard block |
||
| 523 | 523 | function _mysql_traite_query($query, $db = '', $prefixe = '', $echappe_textes = true) { |
| 524 | 524 | |
| 525 | 525 | if ($GLOBALS['mysql_rappel_nom_base'] and $db) { |
| 526 | - $pref = '`' . $db . '`.'; |
|
| 526 | + $pref = '`'.$db.'`.'; |
|
| 527 | 527 | } else { |
| 528 | 528 | $pref = ''; |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | if ($prefixe) { |
| 532 | - $pref .= $prefixe . '_'; |
|
| 532 | + $pref .= $prefixe.'_'; |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | if (!preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) { |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | $suite_echap = $suite; |
| 549 | 549 | } |
| 550 | 550 | if (preg_match('/^(.*?)([(]\s*SELECT\b.*)$/si', $suite_echap, $r)) { |
| 551 | - $suite_echap = $r[1] . _mysql_traite_query($r[2], $db, $prefixe, false); |
|
| 551 | + $suite_echap = $r[1]._mysql_traite_query($r[2], $db, $prefixe, false); |
|
| 552 | 552 | if ($echappe_textes) { |
| 553 | 553 | $suite = query_reinjecte_textes($suite_echap, $textes); |
| 554 | 554 | } |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | 560 | } |
| 561 | - $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1' . $pref, $query) . $suite; |
|
| 561 | + $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1'.$pref, $query).$suite; |
|
| 562 | 562 | |
| 563 | 563 | // en option, remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
| 564 | 564 | // remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | $link = _mysql_link($serveur); |
| 595 | 595 | $ok = mysqli_select_db($link, $db); |
| 596 | 596 | if (!$ok) { |
| 597 | - spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE); |
|
| 597 | + spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE); |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | return $ok; |
@@ -684,10 +684,10 @@ discard block |
||
| 684 | 684 | |
| 685 | 685 | $character_set = ''; |
| 686 | 686 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 687 | - $character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base']; |
|
| 687 | + $character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base']; |
|
| 688 | 688 | } |
| 689 | 689 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 690 | - $character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 690 | + $character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | foreach ($champs as $k => $v) { |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | preg_match(',(char|text),i', $defs[1]) |
| 698 | 698 | and !preg_match(',(binary|CHARACTER|COLLATE),i', $v) |
| 699 | 699 | ) { |
| 700 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 700 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | 703 | |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | $s = ','; |
| 710 | 710 | } |
| 711 | 711 | $temporary = $temporary ? 'TEMPORARY' : ''; |
| 712 | - $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ')' |
|
| 712 | + $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').')' |
|
| 713 | 713 | . ' ENGINE=MyISAM' |
| 714 | 714 | . ($character_set ? " DEFAULT $character_set" : '') |
| 715 | 715 | . "\n"; |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | return false; |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 792 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 793 | 793 | |
| 794 | 794 | return spip_mysql_query($query, $serveur, $requeter); |
| 795 | 795 | } |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | * Ressource à utiliser avec sql_fetch() |
| 848 | 848 | **/ |
| 849 | 849 | function spip_mysql_showbase($match, $serveur = '', $requeter = true) { |
| 850 | - return spip_mysql_query('SHOW TABLES LIKE ' . _q($match), $serveur, $requeter); |
|
| 850 | + return spip_mysql_query('SHOW TABLES LIKE '._q($match), $serveur, $requeter); |
|
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | /** |
@@ -941,22 +941,22 @@ discard block |
||
| 941 | 941 | } |
| 942 | 942 | if ($val['Default'] === '0' || $val['Default']) { |
| 943 | 943 | if (preg_match('/[A-Z_]/', $val['Default'])) { |
| 944 | - $nfields[$val['Field']] .= ' DEFAULT ' . $val['Default']; |
|
| 944 | + $nfields[$val['Field']] .= ' DEFAULT '.$val['Default']; |
|
| 945 | 945 | } else { |
| 946 | - $nfields[$val['Field']] .= " DEFAULT '" . $val['Default'] . "'"; |
|
| 946 | + $nfields[$val['Field']] .= " DEFAULT '".$val['Default']."'"; |
|
| 947 | 947 | } |
| 948 | 948 | } |
| 949 | 949 | if ($val['Extra']) { |
| 950 | - $nfields[$val['Field']] .= ' ' . $val['Extra']; |
|
| 950 | + $nfields[$val['Field']] .= ' '.$val['Extra']; |
|
| 951 | 951 | } |
| 952 | 952 | if ($val['Key'] == 'PRI') { |
| 953 | 953 | $nkeys['PRIMARY KEY'] = $val['Field']; |
| 954 | 954 | } else { |
| 955 | 955 | if ($val['Key'] == 'MUL') { |
| 956 | - $nkeys['KEY ' . $val['Field']] = $val['Field']; |
|
| 956 | + $nkeys['KEY '.$val['Field']] = $val['Field']; |
|
| 957 | 957 | } else { |
| 958 | 958 | if ($val['Key'] == 'UNI') { |
| 959 | - $nkeys['UNIQUE KEY ' . $val['Field']] = $val['Field']; |
|
| 959 | + $nkeys['UNIQUE KEY '.$val['Field']] = $val['Field']; |
|
| 960 | 960 | } |
| 961 | 961 | } |
| 962 | 962 | } |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | $serveur = '', |
| 1028 | 1028 | $requeter = true |
| 1029 | 1029 | ) { |
| 1030 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1030 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1031 | 1031 | |
| 1032 | 1032 | $r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 1033 | 1033 | if (!$requeter) { |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | if ($s) { |
| 1068 | 1068 | $trace = debug_backtrace(); |
| 1069 | 1069 | if ($trace[0]['function'] != 'spip_mysql_error') { |
| 1070 | - spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR); |
|
| 1070 | + spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR); |
|
| 1071 | 1071 | } |
| 1072 | 1072 | } |
| 1073 | 1073 | |
@@ -1238,8 +1238,8 @@ discard block |
||
| 1238 | 1238 | |
| 1239 | 1239 | return spip_mysql_insert( |
| 1240 | 1240 | $table, |
| 1241 | - '(' . join(',', array_keys($couples)) . ')', |
|
| 1242 | - '(' . join(',', $couples) . ')', |
|
| 1241 | + '('.join(',', array_keys($couples)).')', |
|
| 1242 | + '('.join(',', $couples).')', |
|
| 1243 | 1243 | $desc, |
| 1244 | 1244 | $serveur, |
| 1245 | 1245 | $requeter |
@@ -1276,7 +1276,7 @@ discard block |
||
| 1276 | 1276 | } |
| 1277 | 1277 | $fields = isset($desc['field']) ? $desc['field'] : []; |
| 1278 | 1278 | |
| 1279 | - $cles = '(' . join(',', array_keys(reset($tab_couples))) . ')'; |
|
| 1279 | + $cles = '('.join(',', array_keys(reset($tab_couples))).')'; |
|
| 1280 | 1280 | $valeurs = []; |
| 1281 | 1281 | $r = false; |
| 1282 | 1282 | |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | foreach ($couples as $champ => $val) { |
| 1286 | 1286 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1287 | 1287 | } |
| 1288 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1288 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1289 | 1289 | if (count($valeurs) >= 100) { |
| 1290 | 1290 | $r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter); |
| 1291 | 1291 | $valeurs = []; |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | function spip_mysql_update($table, $champs, $where = '', $desc = [], $serveur = '', $requeter = true) { |
| 1323 | 1323 | $set = []; |
| 1324 | 1324 | foreach ($champs as $champ => $val) { |
| 1325 | - $set[] = $champ . "=$val"; |
|
| 1325 | + $set[] = $champ."=$val"; |
|
| 1326 | 1326 | } |
| 1327 | 1327 | if (!empty($set)) { |
| 1328 | 1328 | return spip_mysql_query( |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | } |
| 1379 | 1379 | $set = []; |
| 1380 | 1380 | foreach ($champs as $champ => $val) { |
| 1381 | - $set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]); |
|
| 1381 | + $set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]); |
|
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | return spip_mysql_query( |
@@ -1447,10 +1447,10 @@ discard block |
||
| 1447 | 1447 | * - False en cas d'erreur. |
| 1448 | 1448 | **/ |
| 1449 | 1449 | function spip_mysql_replace($table, $couples, $desc = [], $serveur = '', $requeter = true) { |
| 1450 | - return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join( |
|
| 1450 | + return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join( |
|
| 1451 | 1451 | ',', |
| 1452 | 1452 | array_map('_q', $couples) |
| 1453 | - ) . ')', $serveur, $requeter); |
|
| 1453 | + ).')', $serveur, $requeter); |
|
| 1454 | 1454 | } |
| 1455 | 1455 | |
| 1456 | 1456 | |
@@ -1479,10 +1479,10 @@ discard block |
||
| 1479 | 1479 | * - False en cas d'erreur. |
| 1480 | 1480 | **/ |
| 1481 | 1481 | function spip_mysql_replace_multi($table, $tab_couples, $desc = [], $serveur = '', $requeter = true) { |
| 1482 | - $cles = '(' . join(',', array_keys($tab_couples[0])) . ')'; |
|
| 1482 | + $cles = '('.join(',', array_keys($tab_couples[0])).')'; |
|
| 1483 | 1483 | $valeurs = []; |
| 1484 | 1484 | foreach ($tab_couples as $couples) { |
| 1485 | - $valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')'; |
|
| 1485 | + $valeurs[] = '('.join(',', array_map('_q', $couples)).')'; |
|
| 1486 | 1486 | } |
| 1487 | 1487 | $valeurs = implode(', ', $valeurs); |
| 1488 | 1488 | |
@@ -1502,28 +1502,28 @@ discard block |
||
| 1502 | 1502 | */ |
| 1503 | 1503 | function spip_mysql_multi($objet, $lang) { |
| 1504 | 1504 | $lengthlang = strlen("[$lang]"); |
| 1505 | - $posmulti = 'INSTR(' . $objet . ", '<multi>')"; |
|
| 1506 | - $posfinmulti = 'INSTR(' . $objet . ", '</multi>')"; |
|
| 1507 | - $debutchaine = 'LEFT(' . $objet . ", $posmulti-1)"; |
|
| 1508 | - $finchaine = 'RIGHT(' . $objet . ', CHAR_LENGTH(' . $objet . ") -(7+$posfinmulti))"; |
|
| 1509 | - $chainemulti = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1510 | - $poslang = "INSTR($chainemulti,'[" . $lang . "]')"; |
|
| 1505 | + $posmulti = 'INSTR('.$objet.", '<multi>')"; |
|
| 1506 | + $posfinmulti = 'INSTR('.$objet.", '</multi>')"; |
|
| 1507 | + $debutchaine = 'LEFT('.$objet.", $posmulti-1)"; |
|
| 1508 | + $finchaine = 'RIGHT('.$objet.', CHAR_LENGTH('.$objet.") -(7+$posfinmulti))"; |
|
| 1509 | + $chainemulti = 'TRIM(SUBSTRING('.$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1510 | + $poslang = "INSTR($chainemulti,'[".$lang."]')"; |
|
| 1511 | 1511 | $poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)"; |
| 1512 | - $chainelang = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1513 | - $posfinlang = 'INSTR(' . $chainelang . ", '[')"; |
|
| 1512 | + $chainelang = 'TRIM(SUBSTRING('.$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1513 | + $posfinlang = 'INSTR('.$chainelang.", '[')"; |
|
| 1514 | 1514 | $chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)"; |
| 1515 | 1515 | //$chainelang = "LEFT($chainelang,$posfinlang-1)"; |
| 1516 | - $retour = "(TRIM(IF($posmulti = 0 , " . |
|
| 1517 | - ' TRIM(' . $objet . '), ' . |
|
| 1518 | - ' CONCAT( ' . |
|
| 1519 | - " $debutchaine, " . |
|
| 1520 | - ' IF( ' . |
|
| 1521 | - " $poslang = 0, " . |
|
| 1522 | - " $chainemulti, " . |
|
| 1523 | - " $chainelang" . |
|
| 1524 | - ' ), ' . |
|
| 1525 | - " $finchaine" . |
|
| 1526 | - ' ) ' . |
|
| 1516 | + $retour = "(TRIM(IF($posmulti = 0 , ". |
|
| 1517 | + ' TRIM('.$objet.'), '. |
|
| 1518 | + ' CONCAT( '. |
|
| 1519 | + " $debutchaine, ". |
|
| 1520 | + ' IF( '. |
|
| 1521 | + " $poslang = 0, ". |
|
| 1522 | + " $chainemulti, ". |
|
| 1523 | + " $chainelang". |
|
| 1524 | + ' ), '. |
|
| 1525 | + " $finchaine". |
|
| 1526 | + ' ) '. |
|
| 1527 | 1527 | '))) AS multi'; |
| 1528 | 1528 | |
| 1529 | 1529 | return $retour; |
@@ -1540,7 +1540,7 @@ discard block |
||
| 1540 | 1540 | * Valeur hexadécimale pour MySQL |
| 1541 | 1541 | **/ |
| 1542 | 1542 | function spip_mysql_hex($v) { |
| 1543 | - return '0x' . $v; |
|
| 1543 | + return '0x'.$v; |
|
| 1544 | 1544 | } |
| 1545 | 1545 | |
| 1546 | 1546 | /** |
@@ -1580,7 +1580,7 @@ discard block |
||
| 1580 | 1580 | * Expression SQL |
| 1581 | 1581 | **/ |
| 1582 | 1582 | function spip_mysql_date_proche($champ, $interval, $unite) { |
| 1583 | - $use_now = ( ($champ === 'maj' or strpos($champ, '.maj')) ? true : false ); |
|
| 1583 | + $use_now = (($champ === 'maj' or strpos($champ, '.maj')) ? true : false); |
|
| 1584 | 1584 | return '(' |
| 1585 | 1585 | . $champ |
| 1586 | 1586 | . (($interval <= 0) ? '>' : '<') |
@@ -1634,7 +1634,7 @@ discard block |
||
| 1634 | 1634 | elseif (is_numeric($v)) { |
| 1635 | 1635 | return strval($v); |
| 1636 | 1636 | } |
| 1637 | - return "'" . addslashes($v) . "'"; |
|
| 1637 | + return "'".addslashes($v)."'"; |
|
| 1638 | 1638 | } |
| 1639 | 1639 | |
| 1640 | 1640 | if ( |
@@ -1658,7 +1658,7 @@ discard block |
||
| 1658 | 1658 | } |
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | - return ("'" . addslashes($v) . "'"); |
|
| 1661 | + return ("'".addslashes($v)."'"); |
|
| 1662 | 1662 | } |
| 1663 | 1663 | |
| 1664 | 1664 | /** |
@@ -1692,7 +1692,7 @@ discard block |
||
| 1692 | 1692 | } else { |
| 1693 | 1693 | $GLOBALS['mysql_rappel_nom_base'] = false; |
| 1694 | 1694 | |
| 1695 | - return "\$GLOBALS['mysql_rappel_nom_base'] = false; " . |
|
| 1695 | + return "\$GLOBALS['mysql_rappel_nom_base'] = false; ". |
|
| 1696 | 1696 | "/* echec de test_rappel_nom_base_mysql a l'installation. */\n"; |
| 1697 | 1697 | } |
| 1698 | 1698 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | function generer_nom_fichier_cache($contexte, $page) { |
| 30 | 30 | $u = md5(var_export([$contexte, $page], true)); |
| 31 | 31 | |
| 32 | - return $u . '.cache'; |
|
| 32 | + return $u.'.cache'; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | else { |
| 63 | 63 | // en lecture on essaye pas de creer les repertoires, on va au plus vite |
| 64 | - $rep = _DIR_CACHE . "calcul/$d/"; |
|
| 64 | + $rep = _DIR_CACHE."calcul/$d/"; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - return $rep . $u . '.cache'; |
|
| 67 | + return $rep.$u.'.cache'; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | ); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - return crc32($GLOBALS['meta']['cache_signature'] . $page['texte']); |
|
| 118 | + return crc32($GLOBALS['meta']['cache_signature'].$page['texte']); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | // "cache sessionne" ; sa date indique la date de validite |
| 272 | 272 | // des caches sessionnes |
| 273 | 273 | if (!$tmp = lire_cache($chemin_cache)) { |
| 274 | - spip_log('Creation cache sessionne ' . $chemin_cache); |
|
| 274 | + spip_log('Creation cache sessionne '.$chemin_cache); |
|
| 275 | 275 | $tmp = [ |
| 276 | 276 | 'invalideurs' => ['session' => ''], |
| 277 | 277 | 'lastmodified' => $_SERVER['REQUEST_TIME'] |
@@ -297,8 +297,8 @@ discard block |
||
| 297 | 297 | // l'enregistrer, compresse ou non... |
| 298 | 298 | $ok = ecrire_cache($chemin_cache, $pagez); |
| 299 | 299 | |
| 300 | - spip_log((_IS_BOT ? 'Bot:' : '') . "Creation du cache $chemin_cache pour " |
|
| 301 | - . $page['entetes']['X-Spip-Cache'] . ' secondes' . ($ok ? '' : ' (erreur!)'), _LOG_INFO); |
|
| 300 | + spip_log((_IS_BOT ? 'Bot:' : '')."Creation du cache $chemin_cache pour " |
|
| 301 | + . $page['entetes']['X-Spip-Cache'].' secondes'.($ok ? '' : ' (erreur!)'), _LOG_INFO); |
|
| 302 | 302 | |
| 303 | 303 | // Inserer ses invalideurs |
| 304 | 304 | include_spip('inc/invalideur'); |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | function nettoyer_petit_cache($prefix, $duree = 300) { |
| 320 | 320 | // determiner le repertoire a purger : 'tmp/CACHE/rech/' |
| 321 | 321 | $dircache = sous_repertoire(_DIR_CACHE, $prefix); |
| 322 | - if (spip_touch($dircache . 'purger_' . $prefix, $duree, true)) { |
|
| 322 | + if (spip_touch($dircache.'purger_'.$prefix, $duree, true)) { |
|
| 323 | 323 | foreach (preg_files($dircache, '[.]txt$') as $f) { |
| 324 | 324 | if ($_SERVER['REQUEST_TIME'] - (@file_exists($f) ? @filemtime($f) : 0) > $duree) { |
| 325 | 325 | spip_unlink($f); |
@@ -414,9 +414,9 @@ discard block |
||
| 414 | 414 | if (spip_connect()) { |
| 415 | 415 | include_spip('inc/invalideur'); |
| 416 | 416 | retire_caches($chemin_cache); # API invalideur inutile |
| 417 | - supprimer_fichier(_DIR_CACHE . $chemin_cache); |
|
| 417 | + supprimer_fichier(_DIR_CACHE.$chemin_cache); |
|
| 418 | 418 | if (isset($chemin_cache_session) and $chemin_cache_session) { |
| 419 | - supprimer_fichier(_DIR_CACHE . $chemin_cache_session); |
|
| 419 | + supprimer_fichier(_DIR_CACHE.$chemin_cache_session); |
|
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | } |
@@ -433,9 +433,9 @@ discard block |
||
| 433 | 433 | $page = ['contexte_implicite' => $contexte_implicite]; // ignorer le cache deja lu |
| 434 | 434 | include_spip('inc/invalideur'); |
| 435 | 435 | retire_caches($chemin_cache); # API invalideur inutile |
| 436 | - supprimer_fichier(_DIR_CACHE . $chemin_cache); |
|
| 436 | + supprimer_fichier(_DIR_CACHE.$chemin_cache); |
|
| 437 | 437 | if (isset($chemin_cache_session) and $chemin_cache_session) { |
| 438 | - supprimer_fichier(_DIR_CACHE . $chemin_cache_session); |
|
| 438 | + supprimer_fichier(_DIR_CACHE.$chemin_cache_session); |
|
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | 441 | |
@@ -312,7 +312,7 @@ |
||
| 312 | 312 | foreach ($erreurs as $k => $v) { |
| 313 | 313 | if (is_string($v) and strlen(trim($v)) and strpos($k, '_') !== 0) { |
| 314 | 314 | // on encapsule dans un span car ces messages sont en general simple, juste du texte, et deja dans un span dans le form |
| 315 | - $valeurs['erreurs'][$k] = "<span role='alert'>" . $erreurs[$k] . '</span>'; |
|
| 315 | + $valeurs['erreurs'][$k] = "<span role='alert'>".$erreurs[$k].'</span>'; |
|
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | } |
@@ -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 (!empty($res['headers']) |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | $parts = array_map('intval', explode('.', $ip)); |
| 217 | 217 | if ( |
| 218 | 218 | 127 === $parts[0] or 10 === $parts[0] or 0 === $parts[0] |
| 219 | - or ( 172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1] ) |
|
| 220 | - or ( 192 === $parts[0] && 168 === $parts[1] ) |
|
| 219 | + or (172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1]) |
|
| 220 | + or (192 === $parts[0] && 168 === $parts[1]) |
|
| 221 | 221 | ) { |
| 222 | 222 | return false; |
| 223 | 223 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | $port = $parsed_url['port']; |
| 232 | - if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 232 | + if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 233 | 233 | return $url; |
| 234 | 234 | } |
| 235 | 235 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | if ($taille > 500) { |
| 302 | - $boundary = substr(md5(rand() . 'spip'), 0, 8); |
|
| 302 | + $boundary = substr(md5(rand().'spip'), 0, 8); |
|
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | |
@@ -327,16 +327,16 @@ discard block |
||
| 327 | 327 | } |
| 328 | 328 | } else { |
| 329 | 329 | // fabrique une chaine HTTP simple pour un POST |
| 330 | - $entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n"; |
|
| 330 | + $entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n"; |
|
| 331 | 331 | $chaine = []; |
| 332 | 332 | if (is_array($donnees)) { |
| 333 | 333 | foreach ($donnees as $cle => $valeur) { |
| 334 | 334 | if (is_array($valeur)) { |
| 335 | 335 | foreach ($valeur as $val2) { |
| 336 | - $chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2); |
|
| 336 | + $chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2); |
|
| 337 | 337 | } |
| 338 | 338 | } else { |
| 339 | - $chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur); |
|
| 339 | + $chaine[] = rawurlencode($cle).'='.rawurlencode($valeur); |
|
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | $chaine = implode('&', $chaine); |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | $url_idn = implode($host_ascii, $url_idn); |
| 371 | 371 | } |
| 372 | 372 | // et on urlencode les char utf si besoin dans le path |
| 373 | - $url_idn = preg_replace_callback('/[^\x20-\x7f]/', function ($match) { |
|
| 373 | + $url_idn = preg_replace_callback('/[^\x20-\x7f]/', function($match) { |
|
| 374 | 374 | return urlencode($match[0]); |
| 375 | 375 | }, $url_idn); |
| 376 | 376 | } |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | $head_add = ''; |
| 449 | 449 | if (!empty($options['headers'])) { |
| 450 | 450 | foreach ($options['headers'] as $champ => $valeur) { |
| 451 | - $head_add .= $champ . ': ' . $valeur . "\r\n"; |
|
| 451 | + $head_add .= $champ.': '.$valeur."\r\n"; |
|
| 452 | 452 | } |
| 453 | 453 | // ne pas le repasser a recuperer_url si on follow un location, car ils seront dans datas |
| 454 | 454 | unset($options['headers']); |
@@ -458,9 +458,9 @@ discard block |
||
| 458 | 458 | list($head, $postdata) = prepare_donnees_post($options['datas'], $options['boundary']); |
| 459 | 459 | $head .= $head_add; |
| 460 | 460 | if (stripos($head, 'Content-Length:') === false) { |
| 461 | - $head .= 'Content-Length: ' . strlen($postdata) . "\r\n"; |
|
| 461 | + $head .= 'Content-Length: '.strlen($postdata)."\r\n"; |
|
| 462 | 462 | } |
| 463 | - $options['datas'] = $head . "\r\n" . $postdata; |
|
| 463 | + $options['datas'] = $head."\r\n".$postdata; |
|
| 464 | 464 | if ( |
| 465 | 465 | strlen($postdata) |
| 466 | 466 | and !$methode_demandee |
@@ -468,15 +468,15 @@ discard block |
||
| 468 | 468 | $options['methode'] = 'POST'; |
| 469 | 469 | } |
| 470 | 470 | } elseif ($head_add) { |
| 471 | - $options['datas'] = $head_add . "\r\n"; |
|
| 471 | + $options['datas'] = $head_add."\r\n"; |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | // Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole |
| 475 | 475 | $url = preg_replace(',^feed://,i', 'http://', $url); |
| 476 | 476 | if (!tester_url_absolue($url)) { |
| 477 | - $url = 'http://' . $url; |
|
| 477 | + $url = 'http://'.$url; |
|
| 478 | 478 | } elseif (strncmp($url, '//', 2) == 0) { |
| 479 | - $url = 'http:' . $url; |
|
| 479 | + $url = 'http:'.$url; |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | $url = url_to_ascii($url); |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | $options['if_modified_since'] |
| 506 | 506 | ); |
| 507 | 507 | if (!$handle) { |
| 508 | - spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR); |
|
| 508 | + spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR); |
|
| 509 | 509 | |
| 510 | 510 | return false; |
| 511 | 511 | } |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | 'status' => 200, |
| 536 | 536 | ]; |
| 537 | 537 | } else { |
| 538 | - spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR); |
|
| 538 | + spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR); |
|
| 539 | 539 | return false; |
| 540 | 540 | } |
| 541 | 541 | } elseif ($res['location'] and $options['follow_location']) { |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | |
| 548 | 548 | return recuperer_url($url, $options); |
| 549 | 549 | } elseif ($res['status'] !== 200) { |
| 550 | - spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant'); |
|
| 550 | + spip_log('HTTP status '.$res['status']." pour $url", 'distant'); |
|
| 551 | 551 | } |
| 552 | 552 | $result['status'] = $res['status']; |
| 553 | 553 | if (isset($res['headers'])) { |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | |
| 573 | 573 | $gz = false; |
| 574 | 574 | if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) { |
| 575 | - $gz = (_DIR_TMP . md5(uniqid(mt_rand())) . '.tmp.gz'); |
|
| 575 | + $gz = (_DIR_TMP.md5(uniqid(mt_rand())).'.tmp.gz'); |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | // si on a pas deja recuperer le contenu par une methode detournee |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | $sig['url'] = $url; |
| 659 | 659 | |
| 660 | 660 | $dir = sous_repertoire(_DIR_CACHE, 'curl'); |
| 661 | - $cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 661 | + $cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 662 | 662 | $sub = sous_repertoire($dir, substr($cache, 0, 2)); |
| 663 | 663 | $cache = "$sub$cache"; |
| 664 | 664 | |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | $fp = false; |
| 712 | 712 | if ($fichier) { |
| 713 | 713 | include_spip('inc/acces'); |
| 714 | - $tmpfile = "$fichier." . creer_uniqid() . '.tmp'; |
|
| 714 | + $tmpfile = "$fichier.".creer_uniqid().'.tmp'; |
|
| 715 | 715 | $fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX); |
| 716 | 716 | if (!$fp and file_exists($fichier)) { |
| 717 | 717 | return filesize($fichier); |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | } |
| 771 | 771 | $result['status'] = intval($r[1]); |
| 772 | 772 | while ($s = trim(fgets($handle, 16384))) { |
| 773 | - $result['headers'][] = $s . "\n"; |
|
| 773 | + $result['headers'][] = $s."\n"; |
|
| 774 | 774 | preg_match(',^([^:]*): *(.*)$,i', $s, $r); |
| 775 | 775 | list(, $d, $v) = $r; |
| 776 | 776 | if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) { |
@@ -819,13 +819,13 @@ discard block |
||
| 819 | 819 | |
| 820 | 820 | // on se place tout le temps comme si on etait a la racine |
| 821 | 821 | if (_DIR_RACINE) { |
| 822 | - $d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d); |
|
| 822 | + $d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d); |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | $m = md5($source); |
| 826 | 826 | |
| 827 | 827 | return $d |
| 828 | - . substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12) |
|
| 828 | + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12) |
|
| 829 | 829 | . substr($m, 0, 4) |
| 830 | 830 | . ".$extension"; |
| 831 | 831 | } |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | // Si c'est deja local pas de souci |
| 849 | 849 | if (!tester_url_absolue($source)) { |
| 850 | 850 | if (_DIR_RACINE) { |
| 851 | - $source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source); |
|
| 851 | + $source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source); |
|
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | return $source; |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | $ext |
| 867 | 867 | and preg_match(',^\w+$,', $ext) // pas de php?truc=1&... |
| 868 | 868 | and $f = nom_fichier_copie_locale($source, $ext) |
| 869 | - and file_exists(_DIR_RACINE . $f) |
|
| 869 | + and file_exists(_DIR_RACINE.$f) |
|
| 870 | 870 | ) { |
| 871 | 871 | return $f; |
| 872 | 872 | } |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | |
| 875 | 875 | // Si c'est deja dans la table des documents, |
| 876 | 876 | // ramener le nom de sa copie potentielle |
| 877 | - $ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''"); |
|
| 877 | + $ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''"); |
|
| 878 | 878 | |
| 879 | 879 | if ($ext) { |
| 880 | 880 | return nom_fichier_copie_locale($source, $ext); |
@@ -885,9 +885,9 @@ discard block |
||
| 885 | 885 | |
| 886 | 886 | $ext = $path_parts ? $path_parts['extension'] : ''; |
| 887 | 887 | |
| 888 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 888 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 889 | 889 | $f = nom_fichier_copie_locale($source, $ext); |
| 890 | - if (file_exists(_DIR_RACINE . $f)) { |
|
| 890 | + if (file_exists(_DIR_RACINE.$f)) { |
|
| 891 | 891 | return $f; |
| 892 | 892 | } |
| 893 | 893 | } |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | // Ping pour voir si son extension est connue et autorisee |
| 896 | 896 | // avec mise en cache du resultat du ping |
| 897 | 897 | |
| 898 | - $cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source); |
|
| 898 | + $cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source); |
|
| 899 | 899 | if ( |
| 900 | 900 | !@file_exists($cache) |
| 901 | 901 | or !$path_parts = @unserialize(spip_file_get_contents($cache)) |
@@ -905,10 +905,10 @@ discard block |
||
| 905 | 905 | ecrire_fichier($cache, serialize($path_parts)); |
| 906 | 906 | } |
| 907 | 907 | $ext = !empty($path_parts['extension']) ? $path_parts['extension'] : ''; |
| 908 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 908 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 909 | 909 | return nom_fichier_copie_locale($source, $ext); |
| 910 | 910 | } |
| 911 | - spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR); |
|
| 911 | + spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR); |
|
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | } else { |
| 993 | 993 | if ($a['body']) { |
| 994 | 994 | $a['extension'] = $extension; |
| 995 | - $a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension); |
|
| 995 | + $a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension); |
|
| 996 | 996 | ecrire_fichier($a['fichier'], $a['body']); |
| 997 | 997 | $size_image = @spip_getimagesize($a['fichier']); |
| 998 | 998 | $a['largeur'] = intval($size_image[0]); |
@@ -1057,20 +1057,20 @@ discard block |
||
| 1057 | 1057 | !$t |
| 1058 | 1058 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1059 | 1059 | ) { |
| 1060 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1060 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1061 | 1061 | } |
| 1062 | 1062 | if ( |
| 1063 | 1063 | !$t |
| 1064 | 1064 | and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m) |
| 1065 | 1065 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext) |
| 1066 | 1066 | ) { |
| 1067 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1067 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1068 | 1068 | } |
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | 1071 | // Autre mime/type (ou text/plain avec fichier d'extension inconnue) |
| 1072 | 1072 | if (!$t) { |
| 1073 | - $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type)); |
|
| 1073 | + $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type)); |
|
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | 1076 | // Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg) |
@@ -1081,11 +1081,11 @@ discard block |
||
| 1081 | 1081 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1082 | 1082 | ) { |
| 1083 | 1083 | # eviter xxx.3 => 3gp (> SPIP 3) |
| 1084 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1084 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | 1087 | if ($t) { |
| 1088 | - spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant'); |
|
| 1088 | + spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant'); |
|
| 1089 | 1089 | return $t['extension']; |
| 1090 | 1090 | } else { |
| 1091 | 1091 | # par defaut on retombe sur '.bin' si c'est autorise |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | } |
| 1189 | 1189 | } else { |
| 1190 | 1190 | $scheme = $t['scheme']; |
| 1191 | - $noproxy = $scheme . '://'; |
|
| 1191 | + $noproxy = $scheme.'://'; |
|
| 1192 | 1192 | } |
| 1193 | 1193 | if (isset($t['user'])) { |
| 1194 | 1194 | $user = [$t['user'], $t['pass']]; |
@@ -1202,7 +1202,7 @@ discard block |
||
| 1202 | 1202 | } |
| 1203 | 1203 | |
| 1204 | 1204 | if (!empty($t['query'])) { |
| 1205 | - $path .= '?' . $t['query']; |
|
| 1205 | + $path .= '?'.$t['query']; |
|
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | $f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date); |
@@ -1276,20 +1276,20 @@ discard block |
||
| 1276 | 1276 | $proxy_user = ''; |
| 1277 | 1277 | $http_proxy = need_proxy($host); |
| 1278 | 1278 | if ($user) { |
| 1279 | - $user = urlencode($user[0]) . ':' . urlencode($user[1]); |
|
| 1279 | + $user = urlencode($user[0]).':'.urlencode($user[1]); |
|
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | 1282 | $connect = ''; |
| 1283 | 1283 | if ($http_proxy) { |
| 1284 | - if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) { |
|
| 1285 | - $path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : ''); |
|
| 1286 | - $connect = 'CONNECT ' . $path_host . " $vers\r\n" |
|
| 1284 | + if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) { |
|
| 1285 | + $path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : ''); |
|
| 1286 | + $connect = 'CONNECT '.$path_host." $vers\r\n" |
|
| 1287 | 1287 | . "Host: $path_host\r\n" |
| 1288 | 1288 | . "Proxy-Connection: Keep-Alive\r\n"; |
| 1289 | 1289 | } else { |
| 1290 | - $path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://") |
|
| 1290 | + $path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://") |
|
| 1291 | 1291 | . (!$user ? '' : "$user@") |
| 1292 | - . "$host" . (($port != 80) ? ":$port" : '') . $path; |
|
| 1292 | + . "$host".(($port != 80) ? ":$port" : '').$path; |
|
| 1293 | 1293 | } |
| 1294 | 1294 | $t2 = @parse_url($http_proxy); |
| 1295 | 1295 | $first_host = $t2['host']; |
@@ -1297,10 +1297,10 @@ discard block |
||
| 1297 | 1297 | $port = 80; |
| 1298 | 1298 | } |
| 1299 | 1299 | if ($t2['user']) { |
| 1300 | - $proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']); |
|
| 1300 | + $proxy_user = base64_encode($t2['user'].':'.$t2['pass']); |
|
| 1301 | 1301 | } |
| 1302 | 1302 | } else { |
| 1303 | - $first_host = $noproxy . $host; |
|
| 1303 | + $first_host = $noproxy.$host; |
|
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | 1306 | if ($connect) { |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | ); |
| 1323 | 1323 | spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect'); |
| 1324 | 1324 | if (!$f) { |
| 1325 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1325 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1326 | 1326 | return $errno; |
| 1327 | 1327 | } |
| 1328 | 1328 | stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT); |
@@ -1335,7 +1335,7 @@ discard block |
||
| 1335 | 1335 | or !count($res = explode(' ', $res)) |
| 1336 | 1336 | or $res[1] !== '200' |
| 1337 | 1337 | ) { |
| 1338 | - spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE); |
|
| 1338 | + spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE); |
|
| 1339 | 1339 | fclose($f); |
| 1340 | 1340 | |
| 1341 | 1341 | return false; |
@@ -1352,7 +1352,7 @@ discard block |
||
| 1352 | 1352 | } while (!$f and $ntry-- and $errno !== 110 and sleep(1)); |
| 1353 | 1353 | spip_log("Recuperer $path sur $first_host:$port par $f"); |
| 1354 | 1354 | if (!$f) { |
| 1355 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1355 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1356 | 1356 | |
| 1357 | 1357 | return $errno; |
| 1358 | 1358 | } |
@@ -1362,16 +1362,16 @@ discard block |
||
| 1362 | 1362 | $site = isset($GLOBALS['meta']['adresse_site']) ? $GLOBALS['meta']['adresse_site'] : ''; |
| 1363 | 1363 | |
| 1364 | 1364 | $host_port = $host; |
| 1365 | - if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) { |
|
| 1365 | + if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) { |
|
| 1366 | 1366 | $host_port .= ":$port"; |
| 1367 | 1367 | } |
| 1368 | 1368 | $req = "$method $path $vers\r\n" |
| 1369 | 1369 | . "Host: $host_port\r\n" |
| 1370 | - . 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n" |
|
| 1371 | - . ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n")) |
|
| 1370 | + . 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n" |
|
| 1371 | + . ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n")) |
|
| 1372 | 1372 | . (!$site ? '' : "Referer: $site/$referer\r\n") |
| 1373 | - . (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n")) |
|
| 1374 | - . (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n")) |
|
| 1373 | + . (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n")) |
|
| 1374 | + . (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n")) |
|
| 1375 | 1375 | . (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n") |
| 1376 | 1376 | . (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n"); |
| 1377 | 1377 | |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | $dir = creer_repertoire_documents($subdir ? $subdir : $ext); |
| 142 | 142 | |
| 143 | 143 | $dest = preg_replace('/<[^>]*>/', '', basename($orig)); |
| 144 | - $dest = preg_replace('/\.([^.]+)$/','', $dest); |
|
| 144 | + $dest = preg_replace('/\.([^.]+)$/', '', $dest); |
|
| 145 | 145 | $dest = translitteration($dest); |
| 146 | - $dest = preg_replace('/[^.=\w-]+/','_', $dest); |
|
| 146 | + $dest = preg_replace('/[^.=\w-]+/', '_', $dest); |
|
| 147 | 147 | |
| 148 | 148 | // ne pas accepter de noms de la forme -r90.jpg qui sont reserves |
| 149 | 149 | // pour les images transformees par rotation (action/documenter) |
@@ -153,23 +153,23 @@ discard block |
||
| 153 | 153 | if (!function_exists('verifier_upload_autorise') |
| 154 | 154 | or !$r = verifier_upload_autorise($dest) |
| 155 | 155 | or $r['autozip']) { |
| 156 | - $dest = substr($dest, 0, -strlen($m[0])) . '_' . $m[1]; |
|
| 156 | + $dest = substr($dest, 0, -strlen($m[0])).'_'.$m[1]; |
|
| 157 | 157 | break; |
| 158 | 158 | } |
| 159 | 159 | else { |
| 160 | 160 | $dest = substr($dest, 0, -strlen($m[0])); |
| 161 | - $ext = $m[1] . "." . $ext; |
|
| 161 | + $ext = $m[1].".".$ext; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Si le document "source" est deja au bon endroit, ne rien faire |
| 166 | - if ($source == ($dir . $dest . '.' . $ext)) { |
|
| 166 | + if ($source == ($dir.$dest.'.'.$ext)) { |
|
| 167 | 167 | return $source; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | // sinon tourner jusqu'a trouver un numero correct |
| 171 | 171 | $n = 0; |
| 172 | - while (@file_exists($newFile = $dir . $dest . ($n++ ? ('-' . $n) : '') . '.' . $ext)) { |
|
| 172 | + while (@file_exists($newFile = $dir.$dest.($n++ ? ('-'.$n) : '').'.'.$ext)) { |
|
| 173 | 173 | ; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | function deplacer_fichier_upload($source, $dest, $move = false) { |
| 231 | 231 | // Securite |
| 232 | 232 | if (substr($dest, 0, strlen(_DIR_RACINE)) == _DIR_RACINE) { |
| 233 | - $dest = _DIR_RACINE . preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE))); |
|
| 233 | + $dest = _DIR_RACINE.preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE))); |
|
| 234 | 234 | } else { |
| 235 | 235 | $dest = preg_replace(',\.\.+,', '.', $dest); |
| 236 | 236 | } |
@@ -312,8 +312,8 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | default: /* autre */ |
| 314 | 314 | if (!$msg) { |
| 315 | - $msg = _T('pass_erreur') . ' ' . $error |
|
| 316 | - . '<br />' . propre('[->http://php.net/manual/fr/features.file-upload.errors.php]'); |
|
| 315 | + $msg = _T('pass_erreur').' '.$error |
|
| 316 | + . '<br />'.propre('[->http://php.net/manual/fr/features.file-upload.errors.php]'); |
|
| 317 | 317 | } |
| 318 | 318 | break; |
| 319 | 319 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | include_spip('inc/minipres'); |
| 332 | 332 | echo minipres( |
| 333 | 333 | $msg, |
| 334 | - "<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><a href='" . rawurldecode($GLOBALS['redirect']) . "'><button type='button'>" . _T('ecrire:bouton_suivant') . '</button></a></div>' |
|
| 334 | + "<div style='text-align: ".$GLOBALS['spip_lang_right']."'><a href='".rawurldecode($GLOBALS['redirect'])."'><button type='button'>"._T('ecrire:bouton_suivant').'</button></a></div>' |
|
| 335 | 335 | ); |
| 336 | 336 | exit; |
| 337 | 337 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | ) { |
| 29 | 29 | // si l'url est une url du site, on la laisse passer sans rien faire |
| 30 | 30 | // c'est encore le plus simple |
| 31 | - $base = $GLOBALS['meta']['adresse_site'] . '/'; |
|
| 31 | + $base = $GLOBALS['meta']['adresse_site'].'/'; |
|
| 32 | 32 | if (strlen($base) and strncmp($redirect, $base, strlen($base)) == 0) { |
| 33 | 33 | return $redirect; |
| 34 | 34 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | if ($ancre = _request('var_ajax_ancre')) { |
| 157 | 157 | // pas n'importe quoi quand meme dans la variable ! |
| 158 | 158 | $ancre = str_replace(['<', '"', "'"], ['<', '"', ''], $ancre); |
| 159 | - $texte = "<a href='#$ancre' name='ajax_ancre' style='display:none;'>anchor</a>" . $texte; |
|
| 159 | + $texte = "<a href='#$ancre' name='ajax_ancre' style='display:none;'>anchor</a>".$texte; |
|
| 160 | 160 | } |
| 161 | 161 | } else { |
| 162 | 162 | include_spip('inc/headers'); |
@@ -199,26 +199,26 @@ discard block |
||
| 199 | 199 | $sign = _request('formulaire_action_sign'); |
| 200 | 200 | if (!empty($GLOBALS['visiteur_session']['id_auteur'])) { |
| 201 | 201 | if (empty($sign)) { |
| 202 | - spip_log("signature ajax form incorrecte : $form (formulaire non signe mais on a une session)", 'formulaires' . _LOG_ERREUR); |
|
| 202 | + spip_log("signature ajax form incorrecte : $form (formulaire non signe mais on a une session)", 'formulaires'._LOG_ERREUR); |
|
| 203 | 203 | return false; |
| 204 | 204 | } |
| 205 | 205 | $securiser_action = charger_fonction('securiser_action', 'inc'); |
| 206 | 206 | $secu = $securiser_action($form, $args, '', -1); |
| 207 | 207 | if ($sign !== $secu['hash']) { |
| 208 | - spip_log("signature ajax form incorrecte : $form (formulaire signe mais ne correspond pas a la session)", 'formulaires' . _LOG_ERREUR); |
|
| 208 | + spip_log("signature ajax form incorrecte : $form (formulaire signe mais ne correspond pas a la session)", 'formulaires'._LOG_ERREUR); |
|
| 209 | 209 | return false; |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | else { |
| 213 | 213 | if (!empty($sign)) { |
| 214 | - spip_log("signature ajax form incorrecte : $form (formulaire signe mais pas de session)", 'formulaires' . _LOG_ERREUR); |
|
| 214 | + spip_log("signature ajax form incorrecte : $form (formulaire signe mais pas de session)", 'formulaires'._LOG_ERREUR); |
|
| 215 | 215 | return false; |
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | include_spip('inc/filtres'); |
| 220 | 220 | if (($args = decoder_contexte_ajax($args, $form)) === false) { |
| 221 | - spip_log("signature ajax form incorrecte : $form (encodage corrompu)", 'formulaires' . _LOG_ERREUR); |
|
| 221 | + spip_log("signature ajax form incorrecte : $form (encodage corrompu)", 'formulaires'._LOG_ERREUR); |
|
| 222 | 222 | |
| 223 | 223 | return false; // continuons le hit comme si de rien etait |
| 224 | 224 | } else { |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | // on ajoute un br en display none en tete du retour ajax pour regler un bug dans IE6/7 |
| 336 | 336 | // sans cela le formulaire n'est pas actif apres le hit ajax |
| 337 | 337 | // la classe ajax-form-is-ok sert a s'assurer que le retour ajax s'est bien passe |
| 338 | - $retour = "<br class='bugajaxie ajax-form-is-ok' style='display:none;'/>" . $retour; |
|
| 338 | + $retour = "<br class='bugajaxie ajax-form-is-ok' style='display:none;'/>".$retour; |
|
| 339 | 339 | ajax_retour($retour, false); |
| 340 | 340 | |
| 341 | 341 | return true; // on a fini le hit |