@@ -79,20 +79,20 @@ discard block |
||
| 79 | 79 | (!$equiv and !spip_cookie_envoye()) or ( |
| 80 | 80 | (!empty($_SERVER['SERVER_SOFTWARE']) |
| 81 | 81 | and _SERVEUR_SOFTWARE_ACCEPTE_LOCATION_APRES_COOKIE |
| 82 | - and preg_match('/' . _SERVEUR_SOFTWARE_ACCEPTE_LOCATION_APRES_COOKIE . '/i', $_SERVER['SERVER_SOFTWARE'])) |
|
| 82 | + and preg_match('/'._SERVEUR_SOFTWARE_ACCEPTE_LOCATION_APRES_COOKIE.'/i', $_SERVER['SERVER_SOFTWARE'])) |
|
| 83 | 83 | or (!empty($_SERVER['SERVER_SIGNATURE']) |
| 84 | 84 | and _SERVEUR_SIGNATURE_ACCEPTE_LOCATION_APRES_COOKIE |
| 85 | - and preg_match('/' . _SERVEUR_SIGNATURE_ACCEPTE_LOCATION_APRES_COOKIE . '/i', $_SERVER['SERVER_SIGNATURE'])) |
|
| 85 | + and preg_match('/'._SERVEUR_SIGNATURE_ACCEPTE_LOCATION_APRES_COOKIE.'/i', $_SERVER['SERVER_SIGNATURE'])) |
|
| 86 | 86 | or function_exists('apache_getenv') |
| 87 | 87 | or defined('_SERVER_APACHE') |
| 88 | 88 | ) |
| 89 | 89 | ) { |
| 90 | - @header('Location: ' . $url); |
|
| 90 | + @header('Location: '.$url); |
|
| 91 | 91 | $equiv = ''; |
| 92 | 92 | } else { |
| 93 | - @header('Refresh: 0; url=' . $url); |
|
| 93 | + @header('Refresh: 0; url='.$url); |
|
| 94 | 94 | if (isset($GLOBALS['meta']['charset'])) { |
| 95 | - @header('Content-Type: text/html; charset=' . $GLOBALS['meta']['charset']); |
|
| 95 | + @header('Content-Type: text/html; charset='.$GLOBALS['meta']['charset']); |
|
| 96 | 96 | } |
| 97 | 97 | $equiv = "<meta http-equiv='Refresh' content='0; url=$url'>"; |
| 98 | 98 | } |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | html_lang_attributes(), ' |
| 105 | 105 | <head>', |
| 106 | 106 | $equiv, ' |
| 107 | -<title>HTTP ' . $status . '</title> |
|
| 108 | -' . ((isset($GLOBALS['meta']['charset'])) ? '<meta http-equiv="Content-Type" content="text/html;charset=' . $GLOBALS['meta']['charset'] . '">' : '') . ' |
|
| 107 | +<title>HTTP ' . $status.'</title> |
|
| 108 | +' . ((isset($GLOBALS['meta']['charset'])) ? '<meta http-equiv="Content-Type" content="text/html;charset='.$GLOBALS['meta']['charset'].'">' : '').' |
|
| 109 | 109 | </head> |
| 110 | 110 | <body> |
| 111 | -<h1>HTTP ' . $status . '</h1> |
|
| 111 | +<h1>HTTP ' . $status.'</h1> |
|
| 112 | 112 | <a href="', |
| 113 | 113 | quote_amp($url), |
| 114 | 114 | '">', |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | # en theorie on devrait faire ca tout le temps, mais quand la chaine |
| 145 | 145 | # commence par ? c'est imperatif, sinon l'url finale n'est pas la bonne |
| 146 | 146 | if ($url[0] == '?') { |
| 147 | - $url = url_de_base() . $url; |
|
| 147 | + $url = url_de_base().$url; |
|
| 148 | 148 | } |
| 149 | 149 | $url = str_replace('&', '&', $url); |
| 150 | 150 | spip_log("redirige formulaire ajax: $url"); |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | if ($format == 'ajaxform') { |
| 153 | 153 | return [ |
| 154 | 154 | // on renvoie un lien masque qui sera traite par ajaxCallback.js |
| 155 | - '<a href="' . quote_amp($url) . '" name="ajax_redirect" style="display:none;">' . _T('navigateur_pas_redirige') . '</a>', |
|
| 155 | + '<a href="'.quote_amp($url).'" name="ajax_redirect" style="display:none;">'._T('navigateur_pas_redirige').'</a>', |
|
| 156 | 156 | // et un message au cas ou |
| 157 | - '<br /><a href="' . quote_amp($url) . '">' . _T('navigateur_pas_redirige') . '</a>' |
|
| 157 | + '<br /><a href="'.quote_amp($url).'">'._T('navigateur_pas_redirige').'</a>' |
|
| 158 | 158 | ]; |
| 159 | 159 | } else // format message texte, tout en js inline |
| 160 | 160 | { |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | "<script type='text/javascript'>if (parent.window){parent.window.document.location.replace(\"$url\");} else {document.location.replace(\"$url\");}</script>" |
| 164 | 164 | . http_img_pack('loader.svg', '', " class='loader'") |
| 165 | 165 | . '<br />' |
| 166 | - . '<a href="' . quote_amp($url) . '">' . _T('navigateur_pas_redirige') . '</a>'; |
|
| 166 | + . '<a href="'.quote_amp($url).'">'._T('navigateur_pas_redirige').'</a>'; |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | header("Content-Type: text/html; charset=$charset"); |
| 224 | 224 | header('Expires: 0'); |
| 225 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 225 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
| 226 | 226 | header('Cache-Control: no-cache, must-revalidate'); |
| 227 | 227 | header('Pragma: no-cache'); |
| 228 | 228 | } |
@@ -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; |
@@ -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 | } |
@@ -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 |
@@ -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 | } |