@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | $link = @mysqli_connect($host, $login, $pass); |
| 59 | 59 | } |
| 60 | 60 | } catch (\mysqli_sql_exception $e) { |
| 61 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 61 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 62 | 62 | $link = false; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (!$link) { |
| 66 | - spip_log('Echec mysqli_connect. Erreur : ' . mysqli_connect_error(), 'mysql.' . _LOG_HS); |
|
| 66 | + spip_log('Echec mysqli_connect. Erreur : '.mysqli_connect_error(), 'mysql.'._LOG_HS); |
|
| 67 | 67 | |
| 68 | 68 | return false; |
| 69 | 69 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | spip_log( |
| 85 | - "Connexion MySQLi vers $host, base $db, prefixe $prefixe " . ($ok ? 'operationnelle' : 'impossible'), |
|
| 85 | + "Connexion MySQLi vers $host, base $db, prefixe $prefixe ".($ok ? 'operationnelle' : 'impossible'), |
|
| 86 | 86 | _LOG_DEBUG |
| 87 | 87 | ); |
| 88 | 88 | |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | function spip_mysql_set_charset($charset, $serveur = '', $requeter = true) { |
| 175 | 175 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 176 | - spip_log('changement de charset sql : ' . 'SET NAMES ' . _q($charset), _LOG_DEBUG); |
|
| 176 | + spip_log('changement de charset sql : '.'SET NAMES '._q($charset), _LOG_DEBUG); |
|
| 177 | 177 | |
| 178 | - return mysqli_query($connexion['link'], $connexion['last'] = 'SET NAMES ' . _q($charset)); |
|
| 178 | + return mysqli_query($connexion['link'], $connexion['last'] = 'SET NAMES '._q($charset)); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | function spip_mysql_get_charset($charset = [], $serveur = '', $requeter = true) { |
| 191 | 191 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 192 | 192 | $connexion['last'] = $c = 'SHOW CHARACTER SET' |
| 193 | - . (!$charset ? '' : (' LIKE ' . _q($charset['charset']))); |
|
| 193 | + . (!$charset ? '' : (' LIKE '._q($charset['charset']))); |
|
| 194 | 194 | |
| 195 | 195 | return spip_mysql_fetch(mysqli_query($connexion['link'], $c), null, $serveur); |
| 196 | 196 | } |
@@ -234,21 +234,21 @@ discard block |
||
| 234 | 234 | $debug = ''; |
| 235 | 235 | if (defined('_DEBUG_SLOW_QUERIES') and _DEBUG_SLOW_QUERIES) { |
| 236 | 236 | if (isset($GLOBALS['debug']['aucasou'])) { |
| 237 | - [, $id, , $infos] = $GLOBALS['debug']['aucasou']; |
|
| 238 | - $debug .= "BOUCLE$id @ " . ($infos[0] ?? '') . ' | '; |
|
| 237 | + [, $id,, $infos] = $GLOBALS['debug']['aucasou']; |
|
| 238 | + $debug .= "BOUCLE$id @ ".($infos[0] ?? '').' | '; |
|
| 239 | 239 | } |
| 240 | 240 | if (isset($_SERVER['REQUEST_URI'])) { |
| 241 | 241 | $debug .= $_SERVER['REQUEST_URI']; |
| 242 | 242 | } |
| 243 | 243 | if (!empty($GLOBALS['ip'])) { |
| 244 | - $debug .= ' + ' . $GLOBALS['ip']; |
|
| 244 | + $debug .= ' + '.$GLOBALS['ip']; |
|
| 245 | 245 | } |
| 246 | - $debug = ' /* ' . mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)) . ' */'; |
|
| 246 | + $debug = ' /* '.mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)).' */'; |
|
| 247 | 247 | } |
| 248 | 248 | try { |
| 249 | - $r = mysqli_query($link, $query . $debug); |
|
| 249 | + $r = mysqli_query($link, $query.$debug); |
|
| 250 | 250 | } catch (\mysqli_sql_exception $e) { |
| 251 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 251 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 252 | 252 | $r = false; |
| 253 | 253 | // TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno() |
| 254 | 254 | // mais il faut pour php < 8.1 forcer les exeptions via mysqli_report(). |
@@ -266,9 +266,9 @@ discard block |
||
| 266 | 266 | $link = $connexion['link']; |
| 267 | 267 | //On retente au cas où |
| 268 | 268 | try { |
| 269 | - $r = mysqli_query($link, $query . $debug); |
|
| 269 | + $r = mysqli_query($link, $query.$debug); |
|
| 270 | 270 | } catch (\mysqli_sql_exception $e) { |
| 271 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 271 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 272 | 272 | $r = false; |
| 273 | 273 | // TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno() |
| 274 | 274 | // mais il faut pour php < 8.1 forcer les exeptions via mysqli_report(). |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | // d'utiliser ceux-ci, copie-colle de phpmyadmin |
| 302 | 302 | $query = preg_replace(',^TABLE\s*`([^`]*)`,i', "TABLE \\1", $query); |
| 303 | 303 | |
| 304 | - return spip_mysql_query('ALTER ' . $query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 304 | + return spip_mysql_query('ALTER '.$query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @return bool Toujours true |
| 315 | 315 | */ |
| 316 | 316 | function spip_mysql_optimize($table, $serveur = '', $requeter = true) { |
| 317 | - spip_mysql_query('OPTIMIZE TABLE ' . $table); |
|
| 317 | + spip_mysql_query('OPTIMIZE TABLE '.$table); |
|
| 318 | 318 | |
| 319 | 319 | return true; |
| 320 | 320 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $link = $connexion['link']; |
| 338 | 338 | $db = $connexion['db']; |
| 339 | 339 | |
| 340 | - $query = 'EXPLAIN ' . _mysql_traite_query($query, $db, $prefixe); |
|
| 340 | + $query = 'EXPLAIN '._mysql_traite_query($query, $db, $prefixe); |
|
| 341 | 341 | $r = mysqli_query($link, $query); |
| 342 | 342 | |
| 343 | 343 | return spip_mysql_fetch($r, null, $serveur); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | . calculer_mysql_expression('WHERE', $where) |
| 389 | 389 | . calculer_mysql_expression('GROUP BY', $groupby, ',') |
| 390 | 390 | . calculer_mysql_expression('HAVING', $having) |
| 391 | - . ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) : '') |
|
| 391 | + . ($orderby ? ("\nORDER BY ".spip_mysql_order($orderby)) : '') |
|
| 392 | 392 | . ($limit ? "\nLIMIT $limit" : ''); |
| 393 | 393 | |
| 394 | 394 | // renvoyer la requete inerte si demandee |
@@ -478,12 +478,12 @@ discard block |
||
| 478 | 478 | $exp = "\n$expression "; |
| 479 | 479 | |
| 480 | 480 | if (!is_array($v)) { |
| 481 | - return $exp . $v; |
|
| 481 | + return $exp.$v; |
|
| 482 | 482 | } else { |
| 483 | 483 | if (strtoupper($join) === 'AND') { |
| 484 | - return $exp . join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 484 | + return $exp.join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 485 | 485 | } else { |
| 486 | - return $exp . join($join, $v); |
|
| 486 | + return $exp.join($join, $v); |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | } |
@@ -501,17 +501,17 @@ discard block |
||
| 501 | 501 | if (substr($k, -1) == '@') { |
| 502 | 502 | // c'est une jointure qui se refere au from precedent |
| 503 | 503 | // pas de virgule |
| 504 | - $res .= ' ' . $v; |
|
| 504 | + $res .= ' '.$v; |
|
| 505 | 505 | } else { |
| 506 | 506 | if (!is_numeric($k)) { |
| 507 | 507 | $p = strpos($v, ' '); |
| 508 | 508 | if ($p) { |
| 509 | - $v = substr($v, 0, $p) . " AS `$k`" . substr($v, $p); |
|
| 509 | + $v = substr($v, 0, $p)." AS `$k`".substr($v, $p); |
|
| 510 | 510 | } else { |
| 511 | 511 | $v .= " AS `$k`"; |
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | - $res .= ', ' . $v; |
|
| 514 | + $res .= ', '.$v; |
|
| 515 | 515 | } |
| 516 | 516 | } |
| 517 | 517 | |
@@ -541,13 +541,13 @@ discard block |
||
| 541 | 541 | function _mysql_traite_query($query, $db = '', $prefixe = '', $echappe_textes = true) { |
| 542 | 542 | |
| 543 | 543 | if ($GLOBALS['mysql_rappel_nom_base'] and $db) { |
| 544 | - $pref = '`' . $db . '`.'; |
|
| 544 | + $pref = '`'.$db.'`.'; |
|
| 545 | 545 | } else { |
| 546 | 546 | $pref = ''; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | if ($prefixe) { |
| 550 | - $pref .= $prefixe . '_'; |
|
| 550 | + $pref .= $prefixe.'_'; |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | if (!preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) { |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | $suite_echap = $suite; |
| 567 | 567 | } |
| 568 | 568 | if (preg_match('/^(.*?)([(]\s*SELECT\b.*)$/si', $suite_echap, $r)) { |
| 569 | - $suite_echap = $r[1] . _mysql_traite_query($r[2], $db, $prefixe, false); |
|
| 569 | + $suite_echap = $r[1]._mysql_traite_query($r[2], $db, $prefixe, false); |
|
| 570 | 570 | if ($echappe_textes) { |
| 571 | 571 | $suite = query_reinjecte_textes($suite_echap, $textes); |
| 572 | 572 | } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | } |
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | - $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1' . $pref, $query) . $suite; |
|
| 579 | + $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1'.$pref, $query).$suite; |
|
| 580 | 580 | |
| 581 | 581 | // en option, remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
| 582 | 582 | // remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | $link = _mysql_link($serveur); |
| 613 | 613 | $ok = mysqli_select_db($link, $db); |
| 614 | 614 | if (!$ok) { |
| 615 | - spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE); |
|
| 615 | + spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | return $ok; |
@@ -702,10 +702,10 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | $character_set = ''; |
| 704 | 704 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 705 | - $character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base']; |
|
| 705 | + $character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base']; |
|
| 706 | 706 | } |
| 707 | 707 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 708 | - $character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 708 | + $character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | foreach ($champs as $k => $v) { |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | preg_match(',(char|text),i', $defs[1]) |
| 716 | 716 | and !preg_match(',(binary|CHARACTER|COLLATE),i', $v) |
| 717 | 717 | ) { |
| 718 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 718 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 719 | 719 | } |
| 720 | 720 | } |
| 721 | 721 | |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | $s = ','; |
| 728 | 728 | } |
| 729 | 729 | $temporary = $temporary ? 'TEMPORARY' : ''; |
| 730 | - $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ')' |
|
| 730 | + $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').')' |
|
| 731 | 731 | . ' ENGINE=MyISAM' |
| 732 | 732 | . ($character_set ? " DEFAULT $character_set" : '') |
| 733 | 733 | . "\n"; |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | return false; |
| 808 | 808 | } |
| 809 | 809 | |
| 810 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 810 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 811 | 811 | |
| 812 | 812 | return spip_mysql_query($query, $serveur, $requeter); |
| 813 | 813 | } |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | * Ressource à utiliser avec sql_fetch() |
| 866 | 866 | **/ |
| 867 | 867 | function spip_mysql_showbase($match, $serveur = '', $requeter = true) { |
| 868 | - return spip_mysql_query('SHOW TABLES LIKE ' . _q($match), $serveur, $requeter); |
|
| 868 | + return spip_mysql_query('SHOW TABLES LIKE '._q($match), $serveur, $requeter); |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | /** |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | * - string : requete sql, si $requeter = true |
| 900 | 900 | **/ |
| 901 | 901 | function spip_mysql_table_exists(string $table, $serveur = '', $requeter = true) { |
| 902 | - $r = spip_mysql_query('SHOW TABLES LIKE ' . _q($table), $serveur, $requeter); |
|
| 902 | + $r = spip_mysql_query('SHOW TABLES LIKE '._q($table), $serveur, $requeter); |
|
| 903 | 903 | if (!$requeter) { |
| 904 | 904 | return $r; |
| 905 | 905 | } |
@@ -981,22 +981,22 @@ discard block |
||
| 981 | 981 | } |
| 982 | 982 | if ($val['Default'] === '0' || $val['Default']) { |
| 983 | 983 | if (preg_match('/[A-Z_]/', $val['Default'])) { |
| 984 | - $nfields[$val['Field']] .= ' DEFAULT ' . $val['Default']; |
|
| 984 | + $nfields[$val['Field']] .= ' DEFAULT '.$val['Default']; |
|
| 985 | 985 | } else { |
| 986 | - $nfields[$val['Field']] .= " DEFAULT '" . $val['Default'] . "'"; |
|
| 986 | + $nfields[$val['Field']] .= " DEFAULT '".$val['Default']."'"; |
|
| 987 | 987 | } |
| 988 | 988 | } |
| 989 | 989 | if ($val['Extra']) { |
| 990 | - $nfields[$val['Field']] .= ' ' . $val['Extra']; |
|
| 990 | + $nfields[$val['Field']] .= ' '.$val['Extra']; |
|
| 991 | 991 | } |
| 992 | 992 | if ($val['Key'] == 'PRI') { |
| 993 | 993 | $nkeys['PRIMARY KEY'] = $val['Field']; |
| 994 | 994 | } else { |
| 995 | 995 | if ($val['Key'] == 'MUL') { |
| 996 | - $nkeys['KEY ' . $val['Field']] = $val['Field']; |
|
| 996 | + $nkeys['KEY '.$val['Field']] = $val['Field']; |
|
| 997 | 997 | } else { |
| 998 | 998 | if ($val['Key'] == 'UNI') { |
| 999 | - $nkeys['UNIQUE KEY ' . $val['Field']] = $val['Field']; |
|
| 999 | + $nkeys['UNIQUE KEY '.$val['Field']] = $val['Field']; |
|
| 1000 | 1000 | } |
| 1001 | 1001 | } |
| 1002 | 1002 | } |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | $serveur = '', |
| 1068 | 1068 | $requeter = true |
| 1069 | 1069 | ) { |
| 1070 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1070 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1071 | 1071 | |
| 1072 | 1072 | $r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 1073 | 1073 | if (!$requeter) { |
@@ -1107,7 +1107,7 @@ discard block |
||
| 1107 | 1107 | if ($s) { |
| 1108 | 1108 | $trace = debug_backtrace(); |
| 1109 | 1109 | if ($trace[0]['function'] != 'spip_mysql_error') { |
| 1110 | - spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR); |
|
| 1110 | + spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR); |
|
| 1111 | 1111 | } |
| 1112 | 1112 | } |
| 1113 | 1113 | |
@@ -1233,7 +1233,7 @@ discard block |
||
| 1233 | 1233 | try { |
| 1234 | 1234 | $insert = mysqli_query($link, $query); |
| 1235 | 1235 | } catch (\mysqli_sql_exception $e) { |
| 1236 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 1236 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 1237 | 1237 | // TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno() |
| 1238 | 1238 | // mais il faut pour php < 8.1 forcer les exeptions via mysqli_report(). |
| 1239 | 1239 | } |
@@ -1288,8 +1288,8 @@ discard block |
||
| 1288 | 1288 | |
| 1289 | 1289 | return spip_mysql_insert( |
| 1290 | 1290 | $table, |
| 1291 | - '(' . join(',', array_keys($couples)) . ')', |
|
| 1292 | - '(' . join(',', $couples) . ')', |
|
| 1291 | + '('.join(',', array_keys($couples)).')', |
|
| 1292 | + '('.join(',', $couples).')', |
|
| 1293 | 1293 | $desc, |
| 1294 | 1294 | $serveur, |
| 1295 | 1295 | $requeter |
@@ -1326,7 +1326,7 @@ discard block |
||
| 1326 | 1326 | } |
| 1327 | 1327 | $fields = $desc['field'] ?? []; |
| 1328 | 1328 | |
| 1329 | - $cles = '(' . join(',', array_keys(reset($tab_couples))) . ')'; |
|
| 1329 | + $cles = '('.join(',', array_keys(reset($tab_couples))).')'; |
|
| 1330 | 1330 | $valeurs = []; |
| 1331 | 1331 | $r = false; |
| 1332 | 1332 | |
@@ -1335,7 +1335,7 @@ discard block |
||
| 1335 | 1335 | foreach ($couples as $champ => $val) { |
| 1336 | 1336 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1337 | 1337 | } |
| 1338 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1338 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1339 | 1339 | if (count($valeurs) >= 100) { |
| 1340 | 1340 | $r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter); |
| 1341 | 1341 | $valeurs = []; |
@@ -1372,7 +1372,7 @@ discard block |
||
| 1372 | 1372 | function spip_mysql_update($table, $champs, $where = '', $desc = [], $serveur = '', $requeter = true) { |
| 1373 | 1373 | $set = []; |
| 1374 | 1374 | foreach ($champs as $champ => $val) { |
| 1375 | - $set[] = $champ . "=$val"; |
|
| 1375 | + $set[] = $champ."=$val"; |
|
| 1376 | 1376 | } |
| 1377 | 1377 | if (!empty($set)) { |
| 1378 | 1378 | return spip_mysql_query( |
@@ -1428,7 +1428,7 @@ discard block |
||
| 1428 | 1428 | } |
| 1429 | 1429 | $set = []; |
| 1430 | 1430 | foreach ($champs as $champ => $val) { |
| 1431 | - $set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]); |
|
| 1431 | + $set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]); |
|
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | 1434 | return spip_mysql_query( |
@@ -1497,10 +1497,10 @@ discard block |
||
| 1497 | 1497 | * - False en cas d'erreur. |
| 1498 | 1498 | **/ |
| 1499 | 1499 | function spip_mysql_replace($table, $couples, $desc = [], $serveur = '', $requeter = true) { |
| 1500 | - return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join( |
|
| 1500 | + return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join( |
|
| 1501 | 1501 | ',', |
| 1502 | 1502 | array_map('_q', $couples) |
| 1503 | - ) . ')', $serveur, $requeter); |
|
| 1503 | + ).')', $serveur, $requeter); |
|
| 1504 | 1504 | } |
| 1505 | 1505 | |
| 1506 | 1506 | |
@@ -1529,10 +1529,10 @@ discard block |
||
| 1529 | 1529 | * - False en cas d'erreur. |
| 1530 | 1530 | **/ |
| 1531 | 1531 | function spip_mysql_replace_multi($table, $tab_couples, $desc = [], $serveur = '', $requeter = true) { |
| 1532 | - $cles = '(' . join(',', array_keys($tab_couples[0])) . ')'; |
|
| 1532 | + $cles = '('.join(',', array_keys($tab_couples[0])).')'; |
|
| 1533 | 1533 | $valeurs = []; |
| 1534 | 1534 | foreach ($tab_couples as $couples) { |
| 1535 | - $valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')'; |
|
| 1535 | + $valeurs[] = '('.join(',', array_map('_q', $couples)).')'; |
|
| 1536 | 1536 | } |
| 1537 | 1537 | $valeurs = implode(', ', $valeurs); |
| 1538 | 1538 | |
@@ -1552,28 +1552,28 @@ discard block |
||
| 1552 | 1552 | */ |
| 1553 | 1553 | function spip_mysql_multi($objet, $lang) { |
| 1554 | 1554 | $lengthlang = strlen("[$lang]"); |
| 1555 | - $posmulti = 'INSTR(' . $objet . ", '<multi>')"; |
|
| 1556 | - $posfinmulti = 'INSTR(' . $objet . ", '</multi>')"; |
|
| 1557 | - $debutchaine = 'LEFT(' . $objet . ", $posmulti-1)"; |
|
| 1558 | - $finchaine = 'RIGHT(' . $objet . ', CHAR_LENGTH(' . $objet . ") -(7+$posfinmulti))"; |
|
| 1559 | - $chainemulti = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1560 | - $poslang = "INSTR($chainemulti,'[" . $lang . "]')"; |
|
| 1555 | + $posmulti = 'INSTR('.$objet.", '<multi>')"; |
|
| 1556 | + $posfinmulti = 'INSTR('.$objet.", '</multi>')"; |
|
| 1557 | + $debutchaine = 'LEFT('.$objet.", $posmulti-1)"; |
|
| 1558 | + $finchaine = 'RIGHT('.$objet.', CHAR_LENGTH('.$objet.") -(7+$posfinmulti))"; |
|
| 1559 | + $chainemulti = 'TRIM(SUBSTRING('.$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1560 | + $poslang = "INSTR($chainemulti,'[".$lang."]')"; |
|
| 1561 | 1561 | $poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)"; |
| 1562 | - $chainelang = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1563 | - $posfinlang = 'INSTR(' . $chainelang . ", '[')"; |
|
| 1562 | + $chainelang = 'TRIM(SUBSTRING('.$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1563 | + $posfinlang = 'INSTR('.$chainelang.", '[')"; |
|
| 1564 | 1564 | $chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)"; |
| 1565 | 1565 | //$chainelang = "LEFT($chainelang,$posfinlang-1)"; |
| 1566 | - $retour = "(TRIM(IF($posmulti = 0 , " . |
|
| 1567 | - ' TRIM(' . $objet . '), ' . |
|
| 1568 | - ' CONCAT( ' . |
|
| 1569 | - " $debutchaine, " . |
|
| 1570 | - ' IF( ' . |
|
| 1571 | - " $poslang = 0, " . |
|
| 1572 | - " $chainemulti, " . |
|
| 1573 | - " $chainelang" . |
|
| 1574 | - ' ), ' . |
|
| 1575 | - " $finchaine" . |
|
| 1576 | - ' ) ' . |
|
| 1566 | + $retour = "(TRIM(IF($posmulti = 0 , ". |
|
| 1567 | + ' TRIM('.$objet.'), '. |
|
| 1568 | + ' CONCAT( '. |
|
| 1569 | + " $debutchaine, ". |
|
| 1570 | + ' IF( '. |
|
| 1571 | + " $poslang = 0, ". |
|
| 1572 | + " $chainemulti, ". |
|
| 1573 | + " $chainelang". |
|
| 1574 | + ' ), '. |
|
| 1575 | + " $finchaine". |
|
| 1576 | + ' ) '. |
|
| 1577 | 1577 | '))) AS multi'; |
| 1578 | 1578 | |
| 1579 | 1579 | return $retour; |
@@ -1590,7 +1590,7 @@ discard block |
||
| 1590 | 1590 | * Valeur hexadécimale pour MySQL |
| 1591 | 1591 | **/ |
| 1592 | 1592 | function spip_mysql_hex($v) { |
| 1593 | - return '0x' . $v; |
|
| 1593 | + return '0x'.$v; |
|
| 1594 | 1594 | } |
| 1595 | 1595 | |
| 1596 | 1596 | /** |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | * Expression SQL |
| 1631 | 1631 | **/ |
| 1632 | 1632 | function spip_mysql_date_proche($champ, $interval, $unite) { |
| 1633 | - $use_now = ( ($champ === 'maj' or strpos($champ, '.maj')) ? true : false ); |
|
| 1633 | + $use_now = (($champ === 'maj' or strpos($champ, '.maj')) ? true : false); |
|
| 1634 | 1634 | return '(' |
| 1635 | 1635 | . $champ |
| 1636 | 1636 | . (($interval <= 0) ? '>' : '<') |
@@ -1685,7 +1685,7 @@ discard block |
||
| 1685 | 1685 | } elseif ($v === null) { |
| 1686 | 1686 | return "''"; |
| 1687 | 1687 | } |
| 1688 | - return "'" . addslashes($v) . "'"; |
|
| 1688 | + return "'".addslashes($v)."'"; |
|
| 1689 | 1689 | } |
| 1690 | 1690 | |
| 1691 | 1691 | if ($v === null) { |
@@ -1709,7 +1709,7 @@ discard block |
||
| 1709 | 1709 | } |
| 1710 | 1710 | } |
| 1711 | 1711 | |
| 1712 | - return ("'" . addslashes($v) . "'"); |
|
| 1712 | + return ("'".addslashes($v)."'"); |
|
| 1713 | 1713 | } |
| 1714 | 1714 | |
| 1715 | 1715 | /** |
@@ -1743,7 +1743,7 @@ discard block |
||
| 1743 | 1743 | } else { |
| 1744 | 1744 | $GLOBALS['mysql_rappel_nom_base'] = false; |
| 1745 | 1745 | |
| 1746 | - return "\$GLOBALS['mysql_rappel_nom_base'] = false; " . |
|
| 1746 | + return "\$GLOBALS['mysql_rappel_nom_base'] = false; ". |
|
| 1747 | 1747 | "/* echec de test_rappel_nom_base_mysql a l'installation. */\n"; |
| 1748 | 1748 | } |
| 1749 | 1749 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | if ($GLOBALS['spip_version_base'] != $GLOBALS['meta']['version_installee']) { |
| 57 | 57 | if (!is_numeric(_request('reinstall'))) { |
| 58 | 58 | include_spip('base/create'); |
| 59 | - spip_log('recree les tables eventuellement disparues', 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 59 | + spip_log('recree les tables eventuellement disparues', 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 60 | 60 | creer_base(); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | exit; |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - spip_log('Fin de mise a jour SQL. Debut m-a-j acces et config', 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 72 | + spip_log('Fin de mise a jour SQL. Debut m-a-j acces et config', 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 73 | 73 | |
| 74 | 74 | // supprimer quelques fichiers temporaires qui peuvent se retrouver invalides |
| 75 | 75 | @spip_unlink(_CACHE_RUBRIQUES); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | @spip_unlink(_CACHE_PLUGINS_OPT); |
| 79 | 79 | @spip_unlink(_CACHE_PLUGINS_FCT); |
| 80 | 80 | @spip_unlink(_CACHE_CHEMIN); |
| 81 | - @spip_unlink(_DIR_TMP . 'plugin_xml_cache.gz'); |
|
| 81 | + @spip_unlink(_DIR_TMP.'plugin_xml_cache.gz'); |
|
| 82 | 82 | |
| 83 | 83 | include_spip('inc/auth'); |
| 84 | 84 | auth_synchroniser_distant(); |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | $version_installee = $GLOBALS['meta']['version_installee'] ?? null; |
| 118 | 118 | |
| 119 | 119 | spip_log( |
| 120 | - "Version anterieure: $version_installee. Courante: " . $GLOBALS['spip_version_base'], |
|
| 121 | - 'maj.' . _LOG_INFO_IMPORTANTE |
|
| 120 | + "Version anterieure: $version_installee. Courante: ".$GLOBALS['spip_version_base'], |
|
| 121 | + 'maj.'._LOG_INFO_IMPORTANTE |
|
| 122 | 122 | ); |
| 123 | 123 | if (!$version_installee or ($GLOBALS['spip_version_base'] < $version_installee)) { |
| 124 | 124 | sql_replace( |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | $res = maj_while($version_installee, $cible, $GLOBALS['maj'], 'version_installee', 'meta', $redirect, $debut_page); |
| 152 | 152 | if ($res) { |
| 153 | 153 | if (!is_array($res)) { |
| 154 | - spip_log("Pb d'acces SQL a la mise a jour", 'maj.' . _LOG_ERREUR); |
|
| 154 | + spip_log("Pb d'acces SQL a la mise a jour", 'maj.'._LOG_ERREUR); |
|
| 155 | 155 | } else { |
| 156 | - echo _T('avis_operation_echec') . ' ' . join(' ', $res); |
|
| 156 | + echo _T('avis_operation_echec').' '.join(' ', $res); |
|
| 157 | 157 | echo install_fin_html(); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -241,9 +241,9 @@ discard block |
||
| 241 | 241 | $res = maj_while($current_version, $version_cible, $maj, $nom_meta_base_version, $table_meta, $redirect); |
| 242 | 242 | if ($res) { |
| 243 | 243 | if (!is_array($res)) { |
| 244 | - spip_log("Pb d'acces SQL a la mise a jour", 'maj.' . _LOG_ERREUR); |
|
| 244 | + spip_log("Pb d'acces SQL a la mise a jour", 'maj.'._LOG_ERREUR); |
|
| 245 | 245 | } else { |
| 246 | - echo '<p>' . _T('avis_operation_echec') . ' ' . join(' ', $res) . '</p>'; |
|
| 246 | + echo '<p>'._T('avis_operation_echec').' '.join(' ', $res).'</p>'; |
|
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | echo(install_debut_html($titre)); |
| 300 | 300 | // script de rechargement auto sur timeout |
| 301 | 301 | $redirect = generer_url_ecrire('upgrade', "reinstall=$installee&meta=$meta&table=$table", true); |
| 302 | - echo http_script("window.setTimeout('location.href=\"" . $redirect . "\";'," . ($timeout * 1000) . ')'); |
|
| 302 | + echo http_script("window.setTimeout('location.href=\"".$redirect."\";',".($timeout * 1000).')'); |
|
| 303 | 303 | echo "<div style='text-align: left'>\n"; |
| 304 | 304 | if (ob_get_level()) { |
| 305 | 305 | ob_flush(); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | return [$v, $etape]; |
| 389 | 389 | } |
| 390 | 390 | $n = time() - $time; |
| 391 | - spip_log("$table $meta: $v en $n secondes", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 391 | + spip_log("$table $meta: $v en $n secondes", 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 392 | 392 | if ($meta) { |
| 393 | 393 | ecrire_meta($meta, $installee = $v, 'oui', $table); |
| 394 | 394 | } |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | if ($meta) { |
| 405 | 405 | ecrire_meta($meta, $cible, 'oui', $table); |
| 406 | 406 | } |
| 407 | - spip_log("MAJ terminee. $meta: $installee", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 407 | + spip_log("MAJ terminee. $meta: $installee", 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 408 | 408 | |
| 409 | 409 | return []; |
| 410 | 410 | } |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | * @return int |
| 430 | 430 | */ |
| 431 | 431 | function serie_alter($serie, $q = [], $meta = '', $table = 'meta', $redirect = '') { |
| 432 | - $meta2 = $meta . '_maj_' . $serie; |
|
| 432 | + $meta2 = $meta.'_maj_'.$serie; |
|
| 433 | 433 | $etape = 0; |
| 434 | 434 | if (isset($GLOBALS[$table][$meta2])) { |
| 435 | 435 | $etape = intval($GLOBALS[$table][$meta2]); |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | and function_exists($f = array_shift($r)) |
| 443 | 443 | ) { |
| 444 | 444 | // note: $r (arguments de la fonction $f) peut avoir des données tabulaires |
| 445 | - spip_log("$msg: $f " . @join(',', $r), 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 445 | + spip_log("$msg: $f ".@join(',', $r), 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 446 | 446 | // pour les fonctions atomiques sql_xx |
| 447 | 447 | // on enregistre le meta avant de lancer la fonction, |
| 448 | 448 | // de maniere a eviter de boucler sur timeout |
@@ -460,12 +460,12 @@ discard block |
||
| 460 | 460 | relance_maj($meta, $table, $redirect); |
| 461 | 461 | } |
| 462 | 462 | ecrire_meta($meta2, $i + 1, 'non', $table); |
| 463 | - spip_log("$meta2: ok", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 463 | + spip_log("$meta2: ok", 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 464 | 464 | } else { |
| 465 | 465 | if (!is_array($r)) { |
| 466 | - spip_log("maj $i format incorrect", 'maj.' . _LOG_ERREUR); |
|
| 466 | + spip_log("maj $i format incorrect", 'maj.'._LOG_ERREUR); |
|
| 467 | 467 | } else { |
| 468 | - spip_log("maj $i fonction $f non definie", 'maj.' . _LOG_ERREUR); |
|
| 468 | + spip_log("maj $i fonction $f non definie", 'maj.'._LOG_ERREUR); |
|
| 469 | 469 | } |
| 470 | 470 | // en cas d'erreur serieuse, on s'arrete |
| 471 | 471 | // mais on permet de passer par dessus en rechargeant la page. |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | include_spip('inc/lang'); |
| 100 | 100 | |
| 101 | 101 | if ($GLOBALS['spip_lang'] <> $default) { |
| 102 | - $opt = lang_select($default); # et remplace |
|
| 102 | + $opt = lang_select($default); # et remplace |
|
| 103 | 103 | if ($GLOBALS['spip_lang'] <> $default) { |
| 104 | - $default = ''; # annule tout choix par defaut |
|
| 104 | + $default = ''; # annule tout choix par defaut |
|
| 105 | 105 | if ($opt) { |
| 106 | 106 | lang_select(); |
| 107 | 107 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | # lien a partir de / |
| 112 | 112 | $cible = parametre_url(self(), 'lang', '', '&'); |
| 113 | - $post = generer_url_action('converser', 'redirect=' . rawurlencode($cible), true); |
|
| 113 | + $post = generer_url_action('converser', 'redirect='.rawurlencode($cible), true); |
|
| 114 | 114 | |
| 115 | 115 | return [ |
| 116 | 116 | 'formulaires/menu_lang', |
@@ -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 ?: ($install ? _FILE_CONNECT_TMP // init du serveur principal |
| 64 | 64 | : ''))); // installation pas faite |
| 65 | 65 | |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | // chargement de la version du jeu de fonctions |
| 102 | 102 | // si pas dans le fichier par defaut |
| 103 | 103 | $type = $GLOBALS['db_ok']['type']; |
| 104 | - $jeu = 'spip_' . $type . '_functions_' . $version; |
|
| 104 | + $jeu = 'spip_'.$type.'_functions_'.$version; |
|
| 105 | 105 | if (!isset($GLOBALS[$jeu])) { |
| 106 | - if (!find_in_path($type . '_' . $version . '.php', 'req/', true)) { |
|
| 106 | + if (!find_in_path($type.'_'.$version.'.php', 'req/', true)) { |
|
| 107 | 107 | spip_log("spip_connect: serveur $index version '$version' non defini pour '$type'", _LOG_HS); |
| 108 | 108 | |
| 109 | 109 | // ne plus reessayer |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | $connexion = spip_connect($serveur); |
| 166 | 166 | $e = sql_errno($serveur); |
| 167 | 167 | $t = ($connexion['type'] ?? 'sql'); |
| 168 | - $m = "Erreur $e de $t: " . sql_error($serveur) . "\nin " . sql_error_backtrace() . "\n" . trim($connexion['last']); |
|
| 169 | - $f = $t . $serveur; |
|
| 170 | - spip_log($m, $f . '.' . _LOG_ERREUR); |
|
| 168 | + $m = "Erreur $e de $t: ".sql_error($serveur)."\nin ".sql_error_backtrace()."\n".trim($connexion['last']); |
|
| 169 | + $f = $t.$serveur; |
|
| 170 | + spip_log($m, $f.'.'._LOG_ERREUR); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | // si en cours d'installation ou si db=@test@ on ne pose rien |
| 254 | 254 | // car c'est un test de connexion |
| 255 | 255 | if (!defined('_ECRIRE_INSTALL') and $db !== '@test@') { |
| 256 | - $f = _DIR_TMP . $type . '.' . substr(md5($host . $port . $db), 0, 8) . '.out'; |
|
| 256 | + $f = _DIR_TMP.$type.'.'.substr(md5($host.$port.$db), 0, 8).'.out'; |
|
| 257 | 257 | } elseif ($db == '@test@') { |
| 258 | 258 | $db = ''; |
| 259 | 259 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | // En cas d'indisponibilite du serveur, eviter de le bombarder |
| 293 | 293 | if ($f) { |
| 294 | 294 | @touch($f); |
| 295 | - spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type . '.' . _LOG_HS); |
|
| 295 | + spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type.'.'._LOG_HS); |
|
| 296 | 296 | } |
| 297 | 297 | return null; |
| 298 | 298 | } |
@@ -390,11 +390,11 @@ discard block |
||
| 390 | 390 | } elseif (is_array($a)) { |
| 391 | 391 | return join(',', array_map('_q', $a)); |
| 392 | 392 | } elseif (is_scalar($a)) { |
| 393 | - return ("'" . addslashes($a) . "'"); |
|
| 393 | + return ("'".addslashes($a)."'"); |
|
| 394 | 394 | } elseif ($a === null) { |
| 395 | 395 | return "''"; |
| 396 | 396 | } |
| 397 | - throw new \RuntimeException("Can’t use _q with " . gettype($a)); |
|
| 397 | + throw new \RuntimeException("Can’t use _q with ".gettype($a)); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | /** |
@@ -437,14 +437,14 @@ discard block |
||
| 437 | 437 | $parts = []; |
| 438 | 438 | $currentpos = 0; |
| 439 | 439 | $k = 0; |
| 440 | - while(count($textes)) { |
|
| 440 | + while (count($textes)) { |
|
| 441 | 441 | $part = array_shift($textes); |
| 442 | 442 | $nextpos = strpos($query_echappees, $part, $currentpos); |
| 443 | 443 | // si besoin recoller ensemble les doubles '' de sqlite (echappement des ') |
| 444 | 444 | while (count($textes) and substr($part, -1) === "'") { |
| 445 | 445 | $next = reset($textes); |
| 446 | 446 | if (strpos($next, "'") === 0 |
| 447 | - and strpos($query_echappees, $part . $next, $currentpos) === $nextpos) { |
|
| 447 | + and strpos($query_echappees, $part.$next, $currentpos) === $nextpos) { |
|
| 448 | 448 | $part .= array_shift($textes); |
| 449 | 449 | } |
| 450 | 450 | else { |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | // et on replace les parts une par une en commencant par la fin |
| 464 | - while ($k>0) { |
|
| 464 | + while ($k > 0) { |
|
| 465 | 465 | $query_echappees = substr_replace($query_echappees, $parts[$k]['placeholder'], $parts[$k]['position'], strlen($parts[$k]['texte'])); |
| 466 | 466 | $k--; |
| 467 | 467 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $n = intval(sql_errno()); |
| 62 | - spip_log("Erreur base de donnees $n " . sql_error()); |
|
| 62 | + spip_log("Erreur base de donnees $n ".sql_error()); |
|
| 63 | 63 | |
| 64 | 64 | return $n ?: 1; |
| 65 | 65 | } |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | // erreur SQL a afficher |
| 86 | 86 | $raison = minipres( |
| 87 | 87 | _T('info_travaux_titre'), |
| 88 | - _T('titre_probleme_technique') . '<p><tt>' . sql_errno() . ' ' . sql_error() . '</tt></p>' |
|
| 88 | + _T('titre_probleme_technique').'<p><tt>'.sql_errno().' '.sql_error().'</tt></p>' |
|
| 89 | 89 | ); |
| 90 | 90 | } elseif (@$raison['statut']) { |
| 91 | 91 | // un simple visiteur n'a pas acces a l'espace prive |
| 92 | - spip_log('connexion refusee a ' . @$raison['id_auteur']); |
|
| 92 | + spip_log('connexion refusee a '.@$raison['id_auteur']); |
|
| 93 | 93 | $raison = minipres(_T('avis_erreur_connexion'), _T('avis_erreur_visiteur')); |
| 94 | 94 | } else { |
| 95 | 95 | // auteur en fin de droits ... |
@@ -179,8 +179,7 @@ discard block |
||
| 179 | 179 | $where = (is_numeric($id_auteur) |
| 180 | 180 | /*AND $id_auteur>0*/ // reprise lors des restaurations |
| 181 | 181 | ) ? |
| 182 | - "id_auteur=$id_auteur" : |
|
| 183 | - (!strlen($GLOBALS['connect_login']) ? '' : 'login=' . sql_quote($GLOBALS['connect_login'], '', 'text')); |
|
| 182 | + "id_auteur=$id_auteur" : (!strlen($GLOBALS['connect_login']) ? '' : 'login='.sql_quote($GLOBALS['connect_login'], '', 'text')); |
|
| 184 | 183 | |
| 185 | 184 | if (!$where) { |
| 186 | 185 | return ''; |
@@ -222,7 +221,7 @@ discard block |
||
| 222 | 221 | $GLOBALS['connect_login'] = $row['login']; |
| 223 | 222 | $GLOBALS['connect_statut'] = $row['statut']; |
| 224 | 223 | |
| 225 | - $GLOBALS['visiteur_session'] = array_merge((array)$GLOBALS['visiteur_session'], $row); |
|
| 224 | + $GLOBALS['visiteur_session'] = array_merge((array) $GLOBALS['visiteur_session'], $row); |
|
| 226 | 225 | |
| 227 | 226 | // au cas ou : ne pas memoriser les champs sensibles |
| 228 | 227 | unset($GLOBALS['visiteur_session']['pass']); |
@@ -295,7 +294,7 @@ discard block |
||
| 295 | 294 | * @return string |
| 296 | 295 | */ |
| 297 | 296 | function auth_a_loger() { |
| 298 | - $redirect = generer_url_public('login', 'url=' . rawurlencode(self('&', true)), true); |
|
| 297 | + $redirect = generer_url_public('login', 'url='.rawurlencode(self('&', true)), true); |
|
| 299 | 298 | |
| 300 | 299 | // un echec au "bonjour" (login initial) quand le statut est |
| 301 | 300 | // inconnu signale sans doute un probleme de cookies |
@@ -331,7 +330,7 @@ discard block |
||
| 331 | 330 | $date ??= date('Y-m-d H:i:s'); |
| 332 | 331 | |
| 333 | 332 | if (abs(strtotime($date) - $connect_quand) >= 60) { |
| 334 | - sql_updateq('spip_auteurs', ['en_ligne' => $date], 'id_auteur=' . intval($row['id_auteur'])); |
|
| 333 | + sql_updateq('spip_auteurs', ['en_ligne' => $date], 'id_auteur='.intval($row['id_auteur'])); |
|
| 335 | 334 | $row['en_ligne'] = $date; |
| 336 | 335 | } |
| 337 | 336 | |
@@ -440,13 +439,13 @@ discard block |
||
| 440 | 439 | if ( |
| 441 | 440 | !$login |
| 442 | 441 | or !$login_base = auth_retrouver_login($login, $serveur) |
| 443 | - or !$row = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur) |
|
| 442 | + or !$row = sql_fetsel('*', 'spip_auteurs', 'login='.sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur) |
|
| 444 | 443 | ) { |
| 445 | 444 | // generer de fausses infos, mais credibles, pour eviter une attaque |
| 446 | 445 | // https://core.spip.net/issues/1758 + https://core.spip.net/issues/3691 |
| 447 | 446 | include_spip('inc/securiser_action'); |
| 448 | - $fauxalea1 = md5('fauxalea' . secret_du_site() . $login . floor(date('U') / 86400)); |
|
| 449 | - $fauxalea2 = md5('fauxalea' . secret_du_site() . $login . ceil(date('U') / 86400)); |
|
| 447 | + $fauxalea1 = md5('fauxalea'.secret_du_site().$login.floor(date('U') / 86400)); |
|
| 448 | + $fauxalea2 = md5('fauxalea'.secret_du_site().$login.ceil(date('U') / 86400)); |
|
| 450 | 449 | |
| 451 | 450 | $row = [ |
| 452 | 451 | 'login' => $login, |
@@ -568,7 +567,7 @@ discard block |
||
| 568 | 567 | sql_updateq( |
| 569 | 568 | 'spip_auteurs', |
| 570 | 569 | ['prefs' => serialize($p)], |
| 571 | - 'id_auteur=' . intval($auteur['id_auteur']) |
|
| 570 | + 'id_auteur='.intval($auteur['id_auteur']) |
|
| 572 | 571 | ); |
| 573 | 572 | |
| 574 | 573 | // bloquer ici le visiteur qui tente d'abuser de ses droits |
@@ -732,7 +731,7 @@ discard block |
||
| 732 | 731 | return false; |
| 733 | 732 | } |
| 734 | 733 | |
| 735 | - $row = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login, $serveur, 'text'), '', '', '', '', $serveur); |
|
| 734 | + $row = sql_fetsel('*', 'spip_auteurs', 'login='.sql_quote($login, $serveur, 'text'), '', '', '', '', $serveur); |
|
| 736 | 735 | |
| 737 | 736 | if (!$row) { |
| 738 | 737 | if ( |
@@ -786,11 +785,11 @@ discard block |
||
| 786 | 785 | $retour = $retour ?: _T('icone_retour'); |
| 787 | 786 | $corps .= "<p>$raison</p>[<a href='$public'>$retour</a>] "; |
| 788 | 787 | if ($url) { |
| 789 | - $corps .= "[<a href='" . generer_url_action('cookie', "essai_auth_http=oui&$url") . "'>$re</a>]"; |
|
| 788 | + $corps .= "[<a href='".generer_url_action('cookie', "essai_auth_http=oui&$url")."'>$re</a>]"; |
|
| 790 | 789 | } |
| 791 | 790 | |
| 792 | 791 | if ($lien) { |
| 793 | - $corps .= " [<a href='$ecrire'>" . _T('login_espace_prive') . '</a>]'; |
|
| 792 | + $corps .= " [<a href='$ecrire'>"._T('login_espace_prive').'</a>]'; |
|
| 794 | 793 | } |
| 795 | 794 | include_spip('inc/minipres'); |
| 796 | 795 | echo minipres($pb, $corps); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | static $t1 = ['&', '<', '>']; |
| 121 | 121 | static $t2 = ['&', '<', '>']; |
| 122 | 122 | |
| 123 | - return '<pre>' . str_replace($t1, $t2, (string) $t) . '</pre>'; |
|
| 123 | + return '<pre>'.str_replace($t1, $t2, (string) $t).'</pre>'; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -140,12 +140,12 @@ discard block |
||
| 140 | 140 | foreach ($lignes as &$l) { |
| 141 | 141 | $l = join('|', $l); |
| 142 | 142 | } |
| 143 | - $corps = join("\n", $lignes) . "\n"; |
|
| 144 | - $corps = $caption . |
|
| 145 | - "\n|{{" . |
|
| 146 | - join('}}|{{', $entete) . |
|
| 147 | - '}}|' . |
|
| 148 | - "\n|" . |
|
| 143 | + $corps = join("\n", $lignes)."\n"; |
|
| 144 | + $corps = $caption. |
|
| 145 | + "\n|{{". |
|
| 146 | + join('}}|{{', $entete). |
|
| 147 | + '}}|'. |
|
| 148 | + "\n|". |
|
| 149 | 149 | str_replace("\n", "|\n|", $corps); |
| 150 | 150 | include_spip('inc/texte'); |
| 151 | 151 | |
@@ -187,9 +187,9 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | // Pourquoi SafeHtml transforme-t-il en texte les scripts dans Body ? |
| 190 | - $t = safehtml(preg_replace(',<script' . '.*?</script>,is', '', $t)); |
|
| 190 | + $t = safehtml(preg_replace(',<script'.'.*?</script>,is', '', $t)); |
|
| 191 | 191 | |
| 192 | - return (!$style ? '' : "\n<style>" . $style . '</style>') . $t; |
|
| 192 | + return (!$style ? '' : "\n<style>".$style.'</style>').$t; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | // mais apres la fonction autoriser() |
| 123 | 123 | if ($f = find_in_path('mes_fonctions.php')) { |
| 124 | 124 | global $dossier_squelettes; |
| 125 | - include_once(_ROOT_CWD . $f); |
|
| 125 | + include_once(_ROOT_CWD.$f); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $qui = $GLOBALS['visiteur_session'] ?: []; |
| 165 | 165 | $qui = array_merge(['statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'], $qui); |
| 166 | 166 | } elseif (is_numeric($qui)) { |
| 167 | - $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui); |
|
| 167 | + $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur='.$qui); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | // Admins restreints, on construit ici (pas generique mais...) |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | spip_log( |
| 177 | - "autoriser $faire $type $id (" . ($qui['nom'] ?? '') . ') ?', |
|
| 178 | - 'autoriser' . _LOG_DEBUG |
|
| 177 | + "autoriser $faire $type $id (".($qui['nom'] ?? '').') ?', |
|
| 178 | + 'autoriser'._LOG_DEBUG |
|
| 179 | 179 | ); |
| 180 | 180 | |
| 181 | 181 | // passer par objet_type pour avoir les alias |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | (isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) and autoriser_exception($faire, $type, $id, 'verifier')) |
| 192 | 192 | or (isset($GLOBALS['autoriser_exception'][$faire][$type]['*']) and autoriser_exception($faire, $type, '*', 'verifier')) |
| 193 | 193 | ) { |
| 194 | - spip_log("autoriser ($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG); |
|
| 194 | + spip_log("autoriser ($faire, $type, $id, ".($qui['nom'] ?? '').') : OK Exception', 'autoriser'._LOG_DEBUG); |
|
| 195 | 195 | return true; |
| 196 | 196 | } |
| 197 | 197 | |
@@ -200,18 +200,18 @@ discard block |
||
| 200 | 200 | // autoriser_faire[_dist], autoriser_defaut[_dist] |
| 201 | 201 | $fonctions = $type |
| 202 | 202 | ? [ |
| 203 | - 'autoriser_' . $type . '_' . $faire, |
|
| 204 | - 'autoriser_' . $type . '_' . $faire . '_dist', |
|
| 205 | - 'autoriser_' . $type, |
|
| 206 | - 'autoriser_' . $type . '_dist', |
|
| 207 | - 'autoriser_' . $faire, |
|
| 208 | - 'autoriser_' . $faire . '_dist', |
|
| 203 | + 'autoriser_'.$type.'_'.$faire, |
|
| 204 | + 'autoriser_'.$type.'_'.$faire.'_dist', |
|
| 205 | + 'autoriser_'.$type, |
|
| 206 | + 'autoriser_'.$type.'_dist', |
|
| 207 | + 'autoriser_'.$faire, |
|
| 208 | + 'autoriser_'.$faire.'_dist', |
|
| 209 | 209 | 'autoriser_defaut', |
| 210 | 210 | 'autoriser_defaut_dist' |
| 211 | 211 | ] |
| 212 | 212 | : [ |
| 213 | - 'autoriser_' . $faire, |
|
| 214 | - 'autoriser_' . $faire . '_dist', |
|
| 213 | + 'autoriser_'.$faire, |
|
| 214 | + 'autoriser_'.$faire.'_dist', |
|
| 215 | 215 | 'autoriser_defaut', |
| 216 | 216 | 'autoriser_defaut_dist' |
| 217 | 217 | ]; |
@@ -224,8 +224,8 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | spip_log( |
| 227 | - "$f($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : ' . ($a ? 'OK' : 'niet'), |
|
| 228 | - 'autoriser' . _LOG_DEBUG |
|
| 227 | + "$f($faire, $type, $id, ".($qui['nom'] ?? '').') : '.($a ? 'OK' : 'niet'), |
|
| 228 | + 'autoriser'._LOG_DEBUG |
|
| 229 | 229 | ); |
| 230 | 230 | |
| 231 | 231 | return $a; |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | function autoriser_previsualiser_dist(string $faire, string $type, $id, array $qui, array $opt): bool { |
| 375 | 375 | |
| 376 | 376 | // Le visiteur a-t-il un statut prevu par la config ? |
| 377 | - if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) { |
|
| 377 | + if (strpos($GLOBALS['meta']['preview'], ','.$qui['statut'].',') !== false) { |
|
| 378 | 378 | return test_previsualiser_objet_champ($type, $id, $qui, $opt); |
| 379 | 379 | } |
| 380 | 380 | |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | } // pas de champ passe a la demande => NIET |
| 433 | 433 | $previsu = explode(',', $c['previsu']); |
| 434 | 434 | // regarder si ce statut est autorise pour l'auteur |
| 435 | - if (in_array($opt[$champ] . '/auteur', $previsu)) { |
|
| 435 | + if (in_array($opt[$champ].'/auteur', $previsu)) { |
|
| 436 | 436 | // retrouver l’id_auteur qui a filé un lien de prévisu éventuellement, |
| 437 | 437 | // sinon l’auteur en session |
| 438 | 438 | include_spip('inc/securiser_action'); |
@@ -446,12 +446,12 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | if (!$id_auteur) { |
| 448 | 448 | return false; |
| 449 | - } elseif (autoriser('previsualiser' . $opt[$champ], $type, 0, $id_auteur)) { |
|
| 449 | + } elseif (autoriser('previsualiser'.$opt[$champ], $type, 0, $id_auteur)) { |
|
| 450 | 450 | // dans ce cas (admin en general), pas de filtrage sur ce statut |
| 451 | 451 | } elseif ( |
| 452 | 452 | !sql_countsel( |
| 453 | 453 | 'spip_auteurs_liens', |
| 454 | - 'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id) |
|
| 454 | + 'id_auteur='.intval($id_auteur).' AND objet='.sql_quote($type).' AND id_objet='.intval($id) |
|
| 455 | 455 | ) |
| 456 | 456 | ) { |
| 457 | 457 | return false; |
@@ -496,16 +496,16 @@ discard block |
||
| 496 | 496 | // multilinguisme par secteur et objet rattaché à une rubrique |
| 497 | 497 | $primary = id_table_objet($type); |
| 498 | 498 | if ($table != 'spip_rubriques') { |
| 499 | - $id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id)); |
|
| 499 | + $id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=".intval($id)); |
|
| 500 | 500 | } else { |
| 501 | 501 | $id_rubrique = $id; |
| 502 | 502 | } |
| 503 | - $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 503 | + $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique)); |
|
| 504 | 504 | if (!$id_secteur > 0) { |
| 505 | 505 | $id_secteur = $id_rubrique; |
| 506 | 506 | } |
| 507 | - $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur)); |
|
| 508 | - $langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id)); |
|
| 507 | + $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique='.intval($id_secteur)); |
|
| 508 | + $langue_objet = sql_getfetsel('lang', "$table", "$primary=".intval($id)); |
|
| 509 | 509 | if ($langue_secteur != $langue_objet) { |
| 510 | 510 | // configuration incohérente, on laisse l'utilisateur corriger la situation |
| 511 | 511 | return true; |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques |
| 514 | 514 | return false; |
| 515 | 515 | } else { |
| 516 | - $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id)); |
|
| 516 | + $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique='.intval($id)); |
|
| 517 | 517 | if ($id_parent != 0) { |
| 518 | 518 | // sous-rubriques : pas de choix de langue |
| 519 | 519 | return false; |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | |
| 566 | 566 | if (!isset($opt['statut'])) { |
| 567 | 567 | if (isset($desc['field']['statut'])) { |
| 568 | - $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id)); |
|
| 568 | + $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type).'='.intval($id)); |
|
| 569 | 569 | } else { |
| 570 | 570 | $statut = 'publie'; |
| 571 | 571 | } // pas de statut => publie |
@@ -739,11 +739,11 @@ discard block |
||
| 739 | 739 | return false; |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | - if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) { |
|
| 742 | + if (sql_countsel('spip_rubriques', 'id_parent='.intval($id))) { |
|
| 743 | 743 | return false; |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | - if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) { |
|
| 746 | + if (sql_countsel('spip_articles', 'id_rubrique='.intval($id)." AND (statut<>'poubelle')")) { |
|
| 747 | 747 | return false; |
| 748 | 748 | } |
| 749 | 749 | |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | if (!$id) { |
| 781 | 781 | return false; |
| 782 | 782 | } |
| 783 | - $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id)); |
|
| 783 | + $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article='.sql_quote($id)); |
|
| 784 | 784 | |
| 785 | 785 | return |
| 786 | 786 | $r |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | (!isset($opt['statut']) or $opt['statut'] !== 'publie') |
| 792 | 792 | and in_array($qui['statut'], ['0minirezo', '1comite']) |
| 793 | 793 | and in_array($r['statut'], ['prop', 'prepa', 'poubelle']) |
| 794 | - and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']) |
|
| 794 | + and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur']) |
|
| 795 | 795 | ) |
| 796 | 796 | ); |
| 797 | 797 | } |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | if (!$id) { |
| 850 | 850 | return false; |
| 851 | 851 | } |
| 852 | - $statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id)); |
|
| 852 | + $statut = sql_getfetsel('statut', 'spip_articles', 'id_article='.intval($id)); |
|
| 853 | 853 | } |
| 854 | 854 | |
| 855 | 855 | return |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | or |
| 861 | 861 | ($id |
| 862 | 862 | and $qui['id_auteur'] |
| 863 | - and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])); |
|
| 863 | + and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur'])); |
|
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | |
@@ -881,8 +881,8 @@ discard block |
||
| 881 | 881 | function autoriser_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool { |
| 882 | 882 | # securite, mais on aurait pas du arriver ici ! |
| 883 | 883 | if ( |
| 884 | - function_exists($f = 'autoriser_' . $type . '_voir') |
|
| 885 | - or function_exists($f = 'autoriser_' . $type . '_voir_dist') |
|
| 884 | + function_exists($f = 'autoriser_'.$type.'_voir') |
|
| 885 | + or function_exists($f = 'autoriser_'.$type.'_voir_dist') |
|
| 886 | 886 | ) { |
| 887 | 887 | return $f($faire, $type, $id, $qui, $opt); |
| 888 | 888 | } |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | $n = sql_fetsel( |
| 1014 | 1014 | 'A.id_article', |
| 1015 | 1015 | 'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)', |
| 1016 | - "A.statut='publie' AND L.id_auteur=" . sql_quote($id) |
|
| 1016 | + "A.statut='publie' AND L.id_auteur=".sql_quote($id) |
|
| 1017 | 1017 | ); |
| 1018 | 1018 | |
| 1019 | 1019 | return $n ? true : false; |
@@ -1225,7 +1225,7 @@ discard block |
||
| 1225 | 1225 | and $r = sql_allfetsel( |
| 1226 | 1226 | 'id_objet', |
| 1227 | 1227 | 'spip_auteurs_liens', |
| 1228 | - 'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0" |
|
| 1228 | + 'id_auteur='.intval($id_auteur)." AND objet='rubrique' AND id_objet!=0" |
|
| 1229 | 1229 | ) |
| 1230 | 1230 | and is_countable($r) ? count($r) : 0 |
| 1231 | 1231 | ) { |
@@ -1910,8 +1910,8 @@ discard block |
||
| 1910 | 1910 | function auteurs_objet($objet, $id_objet, $cond = '') { |
| 1911 | 1911 | $objet = objet_type($objet); |
| 1912 | 1912 | $where = [ |
| 1913 | - 'objet=' . sql_quote($objet), |
|
| 1914 | - 'id_objet=' . intval($id_objet) |
|
| 1913 | + 'objet='.sql_quote($objet), |
|
| 1914 | + 'id_objet='.intval($id_objet) |
|
| 1915 | 1915 | ]; |
| 1916 | 1916 | if (!empty($cond)) { |
| 1917 | 1917 | if (is_array($cond)) { |
@@ -1946,7 +1946,7 @@ discard block |
||
| 1946 | 1946 | return sql_allfetsel( |
| 1947 | 1947 | 'id_auteur', |
| 1948 | 1948 | 'spip_auteurs_liens', |
| 1949 | - "objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '') |
|
| 1949 | + "objet='article' AND id_objet=".intval($id_article).($cond ? " AND $cond" : '') |
|
| 1950 | 1950 | ); |
| 1951 | 1951 | } |
| 1952 | 1952 | |
@@ -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', 2_097_152); |
@@ -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,10 +115,10 @@ 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 ? $res['status'] : '-'), 'distant' . _LOG_INFO_IMPORTANTE); |
|
| 118 | + spip_log("copie_locale : Echec recuperation $source sur $localrac status : ".($res ? $res['status'] : '-'), 'distant'._LOG_INFO_IMPORTANTE); |
|
| 119 | 119 | } |
| 120 | 120 | else { |
| 121 | - spip_log("copie_locale : recuperation $source sur $localrac OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant'); |
|
| 121 | + spip_log("copie_locale : recuperation $source sur $localrac OK | taille ".$res['length'].' status '.$res['status'], 'distant'); |
|
| 122 | 122 | } |
| 123 | 123 | if (!$res or !$res['length']) { |
| 124 | 124 | // si $t c'est sans doute juste un not-modified-since |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | if (!$is_known_host) { |
| 209 | 209 | $host = trim($parsed_url['host'], '.'); |
| 210 | - if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) { |
|
| 210 | + if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) { |
|
| 211 | 211 | $ip = gethostbyname($host); |
| 212 | 212 | if ($ip === $host) { |
| 213 | 213 | // Error condition for gethostbyname() |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | if ($ip) { |
| 231 | - if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
| 231 | + if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
| 232 | 232 | return false; |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | $port = $parsed_url['port']; |
| 242 | - if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 242 | + if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 243 | 243 | return $url; |
| 244 | 244 | } |
| 245 | 245 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | if ($taille > 500) { |
| 312 | - $boundary = substr(md5(random_int(0, mt_getrandmax()) . 'spip'), 0, 8); |
|
| 312 | + $boundary = substr(md5(random_int(0, mt_getrandmax()).'spip'), 0, 8); |
|
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | |
@@ -337,16 +337,16 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | } else { |
| 339 | 339 | // fabrique une chaine HTTP simple pour un POST |
| 340 | - $entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n"; |
|
| 340 | + $entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n"; |
|
| 341 | 341 | $chaine = []; |
| 342 | 342 | if (is_array($donnees)) { |
| 343 | 343 | foreach ($donnees as $cle => $valeur) { |
| 344 | 344 | if (is_array($valeur)) { |
| 345 | 345 | foreach ($valeur as $val2) { |
| 346 | - $chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2); |
|
| 346 | + $chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2); |
|
| 347 | 347 | } |
| 348 | 348 | } else { |
| 349 | - $chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur); |
|
| 349 | + $chaine[] = rawurlencode($cle).'='.rawurlencode($valeur); |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | $chaine = implode('&', $chaine); |
@@ -451,13 +451,13 @@ discard block |
||
| 451 | 451 | $options['taille_max'] = $copy ? _COPIE_LOCALE_MAX_SIZE : _INC_DISTANT_MAX_SIZE; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - spip_log("recuperer_url " . $options['methode']. " sur $url", 'distant' . _LOG_DEBUG); |
|
| 454 | + spip_log("recuperer_url ".$options['methode']." sur $url", 'distant'._LOG_DEBUG); |
|
| 455 | 455 | |
| 456 | 456 | // Ajout des en-têtes spécifiques si besoin |
| 457 | 457 | $formatted_data = ''; |
| 458 | 458 | if (!empty($options['headers'])) { |
| 459 | 459 | foreach ($options['headers'] as $champ => $valeur) { |
| 460 | - $formatted_data .= $champ . ': ' . $valeur . "\r\n"; |
|
| 460 | + $formatted_data .= $champ.': '.$valeur."\r\n"; |
|
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | 463 | |
@@ -465,9 +465,9 @@ discard block |
||
| 465 | 465 | [$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']); |
| 466 | 466 | $head .= $formatted_data; |
| 467 | 467 | if (stripos($head, 'Content-Length:') === false) { |
| 468 | - $head .= 'Content-Length: ' . strlen($postdata) . "\r\n"; |
|
| 468 | + $head .= 'Content-Length: '.strlen($postdata)."\r\n"; |
|
| 469 | 469 | } |
| 470 | - $formatted_data = $head . "\r\n" . $postdata; |
|
| 470 | + $formatted_data = $head."\r\n".$postdata; |
|
| 471 | 471 | if ( |
| 472 | 472 | strlen($postdata) |
| 473 | 473 | and !$methode_demandee |
@@ -481,9 +481,9 @@ discard block |
||
| 481 | 481 | // Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole |
| 482 | 482 | $url = preg_replace(',^feed://,i', 'http://', $url); |
| 483 | 483 | if (!tester_url_absolue($url)) { |
| 484 | - $url = 'http://' . $url; |
|
| 484 | + $url = 'http://'.$url; |
|
| 485 | 485 | } elseif (strncmp($url, '//', 2) == 0) { |
| 486 | - $url = 'http:' . $url; |
|
| 486 | + $url = 'http:'.$url; |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | $url = url_to_ascii($url); |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $options['if_modified_since'] |
| 513 | 513 | ); |
| 514 | 514 | if (!$handle) { |
| 515 | - spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR); |
|
| 515 | + spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR); |
|
| 516 | 516 | |
| 517 | 517 | return false; |
| 518 | 518 | } |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | 'status' => 200, |
| 543 | 543 | ]; |
| 544 | 544 | } else { |
| 545 | - spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR); |
|
| 545 | + spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR); |
|
| 546 | 546 | return false; |
| 547 | 547 | } |
| 548 | 548 | } elseif ($res['location'] and $options['follow_location']) { |
@@ -558,11 +558,11 @@ discard block |
||
| 558 | 558 | $options['datas'] = ''; |
| 559 | 559 | } |
| 560 | 560 | } |
| 561 | - spip_log("recuperer_url recommence " . $options['methode']. " sur $url", 'distant' . _LOG_DEBUG); |
|
| 561 | + spip_log("recuperer_url recommence ".$options['methode']." sur $url", 'distant'._LOG_DEBUG); |
|
| 562 | 562 | |
| 563 | 563 | return recuperer_url($url, $options); |
| 564 | 564 | } elseif ($res['status'] !== 200) { |
| 565 | - spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant'); |
|
| 565 | + spip_log('HTTP status '.$res['status']." pour $url", 'distant'); |
|
| 566 | 566 | } |
| 567 | 567 | $result['status'] = $res['status']; |
| 568 | 568 | if (isset($res['headers'])) { |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | // on ne veut que les entetes |
| 580 | 580 | if (!$options['taille_max'] or $options['methode'] == 'HEAD' or $result['status'] == '304') { |
| 581 | - spip_log("RESULTAT recuperer_url " . $options['methode']. " sur $url : " . json_encode($result), 'distant' . _LOG_DEBUG); |
|
| 581 | + spip_log("RESULTAT recuperer_url ".$options['methode']." sur $url : ".json_encode($result), 'distant'._LOG_DEBUG); |
|
| 582 | 582 | return $result; |
| 583 | 583 | } |
| 584 | 584 | |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | $gz = false; |
| 590 | 590 | if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) { |
| 591 | - $gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz'); |
|
| 591 | + $gz = (_DIR_TMP.md5(uniqid(random_int(0, mt_getrandmax()))).'.tmp.gz'); |
|
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | // si on a pas deja recuperer le contenu par une methode detournee |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | |
| 625 | 625 | $trace = json_decode(json_encode($result), true); |
| 626 | 626 | $trace['page'] = '...'; |
| 627 | - spip_log("RESULTAT recuperer_url " . $options['methode']. " sur $url : " . json_encode($trace), 'distant' . _LOG_DEBUG); |
|
| 627 | + spip_log("RESULTAT recuperer_url ".$options['methode']." sur $url : ".json_encode($trace), 'distant'._LOG_DEBUG); |
|
| 628 | 628 | |
| 629 | 629 | return $result; |
| 630 | 630 | } |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | $sig['url'] = $url; |
| 679 | 679 | |
| 680 | 680 | $dir = sous_repertoire(_DIR_CACHE, 'curl'); |
| 681 | - $cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 681 | + $cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 682 | 682 | $sub = sous_repertoire($dir, substr($cache, 0, 2)); |
| 683 | 683 | $cache = "$sub$cache"; |
| 684 | 684 | |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | $fp = false; |
| 733 | 733 | if ($fichier) { |
| 734 | 734 | include_spip('inc/acces'); |
| 735 | - $tmpfile = "$fichier." . creer_uniqid() . '.tmp'; |
|
| 735 | + $tmpfile = "$fichier.".creer_uniqid().'.tmp'; |
|
| 736 | 736 | $fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX); |
| 737 | 737 | if (!$fp and file_exists($fichier)) { |
| 738 | 738 | return filesize($fichier); |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | } |
| 792 | 792 | $result['status'] = intval($r[1]); |
| 793 | 793 | while ($s = trim(fgets($handle, 16384))) { |
| 794 | - $result['headers'][] = $s . "\n"; |
|
| 794 | + $result['headers'][] = $s."\n"; |
|
| 795 | 795 | preg_match(',^([^:]*): *(.*)$,i', $s, $r); |
| 796 | 796 | [, $d, $v] = $r; |
| 797 | 797 | if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) { |
@@ -840,13 +840,13 @@ discard block |
||
| 840 | 840 | |
| 841 | 841 | // on se place tout le temps comme si on etait a la racine |
| 842 | 842 | if (_DIR_RACINE) { |
| 843 | - $d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d); |
|
| 843 | + $d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d); |
|
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | $m = md5($source); |
| 847 | 847 | |
| 848 | 848 | return $d |
| 849 | - . substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12) |
|
| 849 | + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12) |
|
| 850 | 850 | . substr($m, 0, 4) |
| 851 | 851 | . ".$extension"; |
| 852 | 852 | } |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | // Si c'est deja local pas de souci |
| 870 | 870 | if (!tester_url_absolue($source)) { |
| 871 | 871 | if (_DIR_RACINE) { |
| 872 | - $source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source); |
|
| 872 | + $source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source); |
|
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | return $source; |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | $ext |
| 888 | 888 | and preg_match(',^\w+$,', $ext) // pas de php?truc=1&... |
| 889 | 889 | and $f = nom_fichier_copie_locale($source, $ext) |
| 890 | - and file_exists(_DIR_RACINE . $f) |
|
| 890 | + and file_exists(_DIR_RACINE.$f) |
|
| 891 | 891 | ) { |
| 892 | 892 | return $f; |
| 893 | 893 | } |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | |
| 896 | 896 | // Si c'est deja dans la table des documents, |
| 897 | 897 | // ramener le nom de sa copie potentielle |
| 898 | - $ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''"); |
|
| 898 | + $ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''"); |
|
| 899 | 899 | |
| 900 | 900 | if ($ext) { |
| 901 | 901 | return nom_fichier_copie_locale($source, $ext); |
@@ -906,9 +906,9 @@ discard block |
||
| 906 | 906 | |
| 907 | 907 | $ext = $path_parts ? $path_parts['extension'] : ''; |
| 908 | 908 | |
| 909 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 909 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 910 | 910 | $f = nom_fichier_copie_locale($source, $ext); |
| 911 | - if (file_exists(_DIR_RACINE . $f)) { |
|
| 911 | + if (file_exists(_DIR_RACINE.$f)) { |
|
| 912 | 912 | return $f; |
| 913 | 913 | } |
| 914 | 914 | } |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | // Ping pour voir si son extension est connue et autorisee |
| 917 | 917 | // avec mise en cache du resultat du ping |
| 918 | 918 | |
| 919 | - $cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source); |
|
| 919 | + $cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source); |
|
| 920 | 920 | if ( |
| 921 | 921 | !@file_exists($cache) |
| 922 | 922 | or !$path_parts = @unserialize(spip_file_get_contents($cache)) |
@@ -926,10 +926,10 @@ discard block |
||
| 926 | 926 | ecrire_fichier($cache, serialize($path_parts)); |
| 927 | 927 | } |
| 928 | 928 | $ext = !empty($path_parts['extension']) ? $path_parts['extension'] : ''; |
| 929 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 929 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 930 | 930 | return nom_fichier_copie_locale($source, $ext); |
| 931 | 931 | } |
| 932 | - spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR); |
|
| 932 | + spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR); |
|
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | } else { |
| 1014 | 1014 | if ($a['body']) { |
| 1015 | 1015 | $a['extension'] = $extension; |
| 1016 | - $a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension); |
|
| 1016 | + $a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension); |
|
| 1017 | 1017 | ecrire_fichier($a['fichier'], $a['body']); |
| 1018 | 1018 | $size_image = @spip_getimagesize($a['fichier']); |
| 1019 | 1019 | $a['largeur'] = intval($size_image[0]); |
@@ -1081,20 +1081,20 @@ discard block |
||
| 1081 | 1081 | !$t |
| 1082 | 1082 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1083 | 1083 | ) { |
| 1084 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1084 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1085 | 1085 | } |
| 1086 | 1086 | if ( |
| 1087 | 1087 | !$t |
| 1088 | 1088 | and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m) |
| 1089 | 1089 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext) |
| 1090 | 1090 | ) { |
| 1091 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1091 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1092 | 1092 | } |
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | 1095 | // Autre mime/type (ou text/plain avec fichier d'extension inconnue) |
| 1096 | 1096 | if (!$t) { |
| 1097 | - $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type)); |
|
| 1097 | + $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type)); |
|
| 1098 | 1098 | } |
| 1099 | 1099 | |
| 1100 | 1100 | // Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg) |
@@ -1105,11 +1105,11 @@ discard block |
||
| 1105 | 1105 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1106 | 1106 | ) { |
| 1107 | 1107 | # eviter xxx.3 => 3gp (> SPIP 3) |
| 1108 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1108 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | 1111 | if ($t) { |
| 1112 | - spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant'); |
|
| 1112 | + spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant'); |
|
| 1113 | 1113 | return $t['extension']; |
| 1114 | 1114 | } else { |
| 1115 | 1115 | # par defaut on retombe sur '.bin' si c'est autorise |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | } |
| 1213 | 1213 | } else { |
| 1214 | 1214 | $scheme = $t['scheme']; |
| 1215 | - $noproxy = $scheme . '://'; |
|
| 1215 | + $noproxy = $scheme.'://'; |
|
| 1216 | 1216 | } |
| 1217 | 1217 | if (isset($t['user'])) { |
| 1218 | 1218 | $user = [$t['user'], $t['pass']]; |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | } |
| 1227 | 1227 | |
| 1228 | 1228 | if (!empty($t['query'])) { |
| 1229 | - $path .= '?' . $t['query']; |
|
| 1229 | + $path .= '?'.$t['query']; |
|
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | 1232 | $f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date); |
@@ -1300,29 +1300,29 @@ discard block |
||
| 1300 | 1300 | $proxy_user = ''; |
| 1301 | 1301 | $http_proxy = need_proxy($host); |
| 1302 | 1302 | if ($user) { |
| 1303 | - $user = urlencode($user[0]) . ':' . urlencode($user[1]); |
|
| 1303 | + $user = urlencode($user[0]).':'.urlencode($user[1]); |
|
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | 1306 | $connect = ''; |
| 1307 | 1307 | if ($http_proxy) { |
| 1308 | - if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) { |
|
| 1309 | - $path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : ''); |
|
| 1310 | - $connect = 'CONNECT ' . $path_host . " $vers\r\n" |
|
| 1308 | + if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) { |
|
| 1309 | + $path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : ''); |
|
| 1310 | + $connect = 'CONNECT '.$path_host." $vers\r\n" |
|
| 1311 | 1311 | . "Host: $path_host\r\n" |
| 1312 | 1312 | . "Proxy-Connection: Keep-Alive\r\n"; |
| 1313 | 1313 | } else { |
| 1314 | - $path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://") |
|
| 1314 | + $path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://") |
|
| 1315 | 1315 | . (!$user ? '' : "$user@") |
| 1316 | - . "$host" . (($port != 80) ? ":$port" : '') . $path; |
|
| 1316 | + . "$host".(($port != 80) ? ":$port" : '').$path; |
|
| 1317 | 1317 | } |
| 1318 | 1318 | $t2 = @parse_url($http_proxy); |
| 1319 | 1319 | $first_host = $t2['host']; |
| 1320 | 1320 | $port = ($t2['port'] ?? null) ?: 80; |
| 1321 | 1321 | if ($t2['user'] ?? null) { |
| 1322 | - $proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']); |
|
| 1322 | + $proxy_user = base64_encode($t2['user'].':'.$t2['pass']); |
|
| 1323 | 1323 | } |
| 1324 | 1324 | } else { |
| 1325 | - $first_host = $noproxy . $host; |
|
| 1325 | + $first_host = $noproxy.$host; |
|
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | 1328 | if ($connect) { |
@@ -1344,7 +1344,7 @@ discard block |
||
| 1344 | 1344 | ); |
| 1345 | 1345 | spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect'); |
| 1346 | 1346 | if (!$f) { |
| 1347 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1347 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1348 | 1348 | return $errno; |
| 1349 | 1349 | } |
| 1350 | 1350 | stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT); |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | or !count($res = explode(' ', $res)) |
| 1358 | 1358 | or $res[1] !== '200' |
| 1359 | 1359 | ) { |
| 1360 | - spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE); |
|
| 1360 | + spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE); |
|
| 1361 | 1361 | fclose($f); |
| 1362 | 1362 | |
| 1363 | 1363 | return false; |
@@ -1374,7 +1374,7 @@ discard block |
||
| 1374 | 1374 | } while (!$f and $ntry-- and $errno !== 110 and sleep(1)); |
| 1375 | 1375 | spip_log("Recuperer $path sur $first_host:$port par $f"); |
| 1376 | 1376 | if (!$f) { |
| 1377 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1377 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1378 | 1378 | |
| 1379 | 1379 | return $errno; |
| 1380 | 1380 | } |
@@ -1384,16 +1384,16 @@ discard block |
||
| 1384 | 1384 | $site = $GLOBALS['meta']['adresse_site'] ?? ''; |
| 1385 | 1385 | |
| 1386 | 1386 | $host_port = $host; |
| 1387 | - if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) { |
|
| 1387 | + if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) { |
|
| 1388 | 1388 | $host_port .= ":$port"; |
| 1389 | 1389 | } |
| 1390 | 1390 | $req = "$method $path $vers\r\n" |
| 1391 | 1391 | . "Host: $host_port\r\n" |
| 1392 | - . 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n" |
|
| 1393 | - . ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n")) |
|
| 1392 | + . 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n" |
|
| 1393 | + . ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n")) |
|
| 1394 | 1394 | . (!$site ? '' : "Referer: $site/$referer\r\n") |
| 1395 | - . (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n")) |
|
| 1396 | - . (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n")) |
|
| 1395 | + . (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n")) |
|
| 1396 | + . (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n")) |
|
| 1397 | 1397 | . (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n") |
| 1398 | 1398 | . (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n"); |
| 1399 | 1399 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | include_fichiers_fonctions(); |
| 99 | - foreach (['filtre_' . $fonc, 'filtre_' . $fonc . '_dist', $fonc] as $f) { |
|
| 99 | + foreach (['filtre_'.$fonc, 'filtre_'.$fonc.'_dist', $fonc] as $f) { |
|
| 100 | 100 | trouver_filtre_matrice($f); // charge des fichiers spécifiques éventuels |
| 101 | 101 | // fonction ou name\space\fonction |
| 102 | 102 | if (is_callable($f)) { |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | // affichage "GIT [master: abcdef]" |
| 240 | 240 | $commit = $desc['commit_short'] ?? $desc['commit']; |
| 241 | 241 | if ($desc['branch']) { |
| 242 | - $commit = $desc['branch'] . ': ' . $commit; |
|
| 242 | + $commit = $desc['branch'].': '.$commit; |
|
| 243 | 243 | } |
| 244 | 244 | return "{$desc['vcs']} [$commit]"; |
| 245 | 245 | } |
@@ -258,9 +258,9 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | // version installee par GIT |
| 261 | - if (lire_fichier($dir . '/.git/HEAD', $c)) { |
|
| 261 | + if (lire_fichier($dir.'/.git/HEAD', $c)) { |
|
| 262 | 262 | $currentHead = trim(substr($c, 4)); |
| 263 | - if (lire_fichier($dir . '/.git/' . $currentHead, $hash)) { |
|
| 263 | + if (lire_fichier($dir.'/.git/'.$currentHead, $hash)) { |
|
| 264 | 264 | return [ |
| 265 | 265 | 'vcs' => 'GIT', |
| 266 | 266 | 'branch' => basename($currentHead), |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | $dir = '.'; |
| 288 | 288 | } |
| 289 | 289 | // version installee par SVN |
| 290 | - if (file_exists($dir . '/.svn/wc.db') && class_exists(\SQLite3::class)) { |
|
| 291 | - $db = new SQLite3($dir . '/.svn/wc.db'); |
|
| 290 | + if (file_exists($dir.'/.svn/wc.db') && class_exists(\SQLite3::class)) { |
|
| 291 | + $db = new SQLite3($dir.'/.svn/wc.db'); |
|
| 292 | 292 | $result = $db->query('SELECT changed_revision FROM nodes WHERE local_relpath = "" LIMIT 1'); |
| 293 | 293 | if ($result) { |
| 294 | 294 | $row = $result->fetchArray(); |
@@ -306,12 +306,12 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | // La matrice est necessaire pour ne filtrer _que_ des fonctions definies dans filtres_images |
| 308 | 308 | // et laisser passer les fonctions personnelles baptisees image_... |
| 309 | -$GLOBALS['spip_matrice']['image_graver'] = true;//'inc/filtres_images_mini.php'; |
|
| 310 | -$GLOBALS['spip_matrice']['image_select'] = true;//'inc/filtres_images_mini.php'; |
|
| 311 | -$GLOBALS['spip_matrice']['image_reduire'] = true;//'inc/filtres_images_mini.php'; |
|
| 312 | -$GLOBALS['spip_matrice']['image_reduire_par'] = true;//'inc/filtres_images_mini.php'; |
|
| 313 | -$GLOBALS['spip_matrice']['image_passe_partout'] = true;//'inc/filtres_images_mini.php'; |
|
| 314 | -$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true;//'inc/filtres_images_mini.php'; |
|
| 309 | +$GLOBALS['spip_matrice']['image_graver'] = true; //'inc/filtres_images_mini.php'; |
|
| 310 | +$GLOBALS['spip_matrice']['image_select'] = true; //'inc/filtres_images_mini.php'; |
|
| 311 | +$GLOBALS['spip_matrice']['image_reduire'] = true; //'inc/filtres_images_mini.php'; |
|
| 312 | +$GLOBALS['spip_matrice']['image_reduire_par'] = true; //'inc/filtres_images_mini.php'; |
|
| 313 | +$GLOBALS['spip_matrice']['image_passe_partout'] = true; //'inc/filtres_images_mini.php'; |
|
| 314 | +$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true; //'inc/filtres_images_mini.php'; |
|
| 315 | 315 | |
| 316 | 316 | $GLOBALS['spip_matrice']['couleur_html_to_hex'] = 'inc/filtres_images_mini.php'; |
| 317 | 317 | $GLOBALS['spip_matrice']['couleur_hex_to_hsl'] = 'inc/filtres_images_mini.php'; |
@@ -470,8 +470,8 @@ discard block |
||
| 470 | 470 | */ |
| 471 | 471 | function filtre_debug($val, $key = null) { |
| 472 | 472 | $debug = ( |
| 473 | - is_null($key) ? '' : (var_export($key, true) . ' = ') |
|
| 474 | - ) . var_export($val, true); |
|
| 473 | + is_null($key) ? '' : (var_export($key, true).' = ') |
|
| 474 | + ).var_export($val, true); |
|
| 475 | 475 | |
| 476 | 476 | include_spip('inc/autoriser'); |
| 477 | 477 | if (autoriser('webmestre')) { |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | $is_file = false; |
| 526 | 526 | } |
| 527 | 527 | if ($is_file) { |
| 528 | - $is_local_file = function ($path) { |
|
| 528 | + $is_local_file = function($path) { |
|
| 529 | 529 | if (strpos($path, '?') !== false) { |
| 530 | 530 | $path = supprimer_timestamp($path); |
| 531 | 531 | // remove ?24px added by find_in_theme on .svg files |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | if (preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match)) { |
| 578 | 578 | $srcover = $match[1]; |
| 579 | 579 | array_shift($args); |
| 580 | - array_unshift($args, "<img src='" . $match[1] . "' />"); |
|
| 580 | + array_unshift($args, "<img src='".$match[1]."' />"); |
|
| 581 | 581 | $srcover_filter = call_user_func_array($filtre, $args); |
| 582 | 582 | $srcover_filter = extraire_attribut($srcover_filter, 'src'); |
| 583 | 583 | $reduit = str_replace($srcover, $srcover_filter, $reduit); |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | if (!$srcHeight) { |
| 654 | 654 | $hauteur_img[$src] = $srcHeight = $imagesize[1]; |
| 655 | 655 | } |
| 656 | - if (!$srcSize){ |
|
| 656 | + if (!$srcSize) { |
|
| 657 | 657 | $poids_img[$src] = filesize($src); |
| 658 | 658 | } |
| 659 | 659 | } |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | if (!$srcHeight) { |
| 668 | 668 | $hauteur_img[$src] = $srcHeight = $height; |
| 669 | 669 | } |
| 670 | - if (!$srcSize){ |
|
| 670 | + if (!$srcSize) { |
|
| 671 | 671 | $poids_img[$src] = $srcSize = strlen($src); |
| 672 | 672 | } |
| 673 | 673 | } |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | if (!$srcHeight) { |
| 686 | 686 | $hauteur_img[$src] = $srcHeight = $valeurs['hauteur_dest']; |
| 687 | 687 | } |
| 688 | - if (!$srcSize){ |
|
| 688 | + if (!$srcSize) { |
|
| 689 | 689 | $poids_img[$src] = $srcSize = 0; |
| 690 | 690 | } |
| 691 | 691 | } |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | return $infos['poids']; |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | -function taille_image($img, $force_refresh = false){ |
|
| 714 | +function taille_image($img, $force_refresh = false) { |
|
| 715 | 715 | $infos = infos_image($img, $force_refresh); |
| 716 | 716 | return [$infos['hauteur'], $infos['largeur']]; |
| 717 | 717 | } |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | // " -> " et tout ce genre de choses |
| 981 | 981 | $u = $GLOBALS['meta']['pcre_u']; |
| 982 | 982 | $texte = str_replace(' ', ' ', $texte); |
| 983 | - $texte = preg_replace('/\s{2,}/S' . $u, ' ', $texte); |
|
| 983 | + $texte = preg_replace('/\s{2,}/S'.$u, ' ', $texte); |
|
| 984 | 984 | // ne pas echapper les sinqle quotes car certains outils de syndication gerent mal |
| 985 | 985 | $texte = entites_html($texte, false, false); |
| 986 | 986 | // mais bien echapper les double quotes ! |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | **/ |
| 1041 | 1041 | function supprimer_numero($texte) { |
| 1042 | 1042 | return preg_replace( |
| 1043 | - ',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S', |
|
| 1043 | + ',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S', |
|
| 1044 | 1044 | '', |
| 1045 | 1045 | $texte |
| 1046 | 1046 | ); |
@@ -1068,7 +1068,7 @@ discard block |
||
| 1068 | 1068 | function recuperer_numero($texte) { |
| 1069 | 1069 | if ( |
| 1070 | 1070 | preg_match( |
| 1071 | - ',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S', |
|
| 1071 | + ',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S', |
|
| 1072 | 1072 | $texte, |
| 1073 | 1073 | $regs |
| 1074 | 1074 | ) |
@@ -1159,8 +1159,8 @@ discard block |
||
| 1159 | 1159 | **/ |
| 1160 | 1160 | function textebrut($texte) { |
| 1161 | 1161 | $u = $GLOBALS['meta']['pcre_u']; |
| 1162 | - $texte = preg_replace('/\s+/S' . $u, ' ', $texte); |
|
| 1163 | - $texte = preg_replace('/<(p|br)( [^>]*)?' . '>/iS', "\n\n", $texte); |
|
| 1162 | + $texte = preg_replace('/\s+/S'.$u, ' ', $texte); |
|
| 1163 | + $texte = preg_replace('/<(p|br)( [^>]*)?'.'>/iS', "\n\n", $texte); |
|
| 1164 | 1164 | $texte = preg_replace("/^\n+/", '', $texte); |
| 1165 | 1165 | $texte = preg_replace("/\n+$/", '', $texte); |
| 1166 | 1166 | $texte = preg_replace("/\n +/", "\n", $texte); |
@@ -1194,7 +1194,7 @@ discard block |
||
| 1194 | 1194 | ) |
| 1195 | 1195 | ) { |
| 1196 | 1196 | foreach ($liens[0] as $a) { |
| 1197 | - $rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel'); |
|
| 1197 | + $rel = 'noopener noreferrer '.extraire_attribut($a, 'rel'); |
|
| 1198 | 1198 | $ablank = inserer_attribut($a, 'rel', $rel); |
| 1199 | 1199 | $ablank = inserer_attribut($ablank, 'target', '_blank'); |
| 1200 | 1200 | $texte = str_replace($a, $ablank, $texte); |
@@ -1219,7 +1219,7 @@ discard block |
||
| 1219 | 1219 | foreach ($regs[0] as $a) { |
| 1220 | 1220 | $rel = extraire_attribut($a, 'rel') ?? ''; |
| 1221 | 1221 | if (strpos($rel, 'nofollow') === false) { |
| 1222 | - $rel = 'nofollow' . ($rel ? " $rel" : ''); |
|
| 1222 | + $rel = 'nofollow'.($rel ? " $rel" : ''); |
|
| 1223 | 1223 | $anofollow = inserer_attribut($a, 'rel', $rel); |
| 1224 | 1224 | $texte = str_replace($a, $anofollow, $texte); |
| 1225 | 1225 | } |
@@ -1248,7 +1248,7 @@ discard block |
||
| 1248 | 1248 | $u = $GLOBALS['meta']['pcre_u']; |
| 1249 | 1249 | $texte = preg_replace('@</p>@iS', "\n", $texte); |
| 1250 | 1250 | $texte = preg_replace("@<p\b.*>@UiS", '<br />', $texte); |
| 1251 | - $texte = preg_replace('@^\s*<br />@S' . $u, '', $texte); |
|
| 1251 | + $texte = preg_replace('@^\s*<br />@S'.$u, '', $texte); |
|
| 1252 | 1252 | |
| 1253 | 1253 | return $texte; |
| 1254 | 1254 | } |
@@ -1279,7 +1279,7 @@ discard block |
||
| 1279 | 1279 | return $texte; |
| 1280 | 1280 | } |
| 1281 | 1281 | include_spip('inc/texte'); |
| 1282 | - $tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ? |
|
| 1282 | + $tag = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $texte) ? |
|
| 1283 | 1283 | 'div' : 'span'; |
| 1284 | 1284 | |
| 1285 | 1285 | return "<$tag style='word-wrap:break-word;'>$texte</$tag>"; |
@@ -1391,7 +1391,7 @@ discard block |
||
| 1391 | 1391 | } |
| 1392 | 1392 | $u = $GLOBALS['meta']['pcre_u']; |
| 1393 | 1393 | if ($textebrut) { |
| 1394 | - $texte = preg_replace([",\n,", ',\s(?=\s),msS' . $u], [' ', ''], textebrut($texte)); |
|
| 1394 | + $texte = preg_replace([",\n,", ',\s(?=\s),msS'.$u], [' ', ''], textebrut($texte)); |
|
| 1395 | 1395 | } |
| 1396 | 1396 | $texte = texte_backend($texte); |
| 1397 | 1397 | $texte = str_replace(["'", '"'], [''', '"'], $texte); |
@@ -1426,7 +1426,7 @@ discard block |
||
| 1426 | 1426 | # un message pour abs_url |
| 1427 | 1427 | $GLOBALS['mode_abs_url'] = 'url'; |
| 1428 | 1428 | $url = trim($url); |
| 1429 | - $r = ',^(?:' . _PROTOCOLES_STD . '):?/?/?$,iS'; |
|
| 1429 | + $r = ',^(?:'._PROTOCOLES_STD.'):?/?/?$,iS'; |
|
| 1430 | 1430 | |
| 1431 | 1431 | return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url); |
| 1432 | 1432 | } |
@@ -1626,14 +1626,14 @@ discard block |
||
| 1626 | 1626 | if (strpos($texte, '<') !== false) { |
| 1627 | 1627 | include_spip('inc/lien'); |
| 1628 | 1628 | if (defined('_PREG_MODELE')) { |
| 1629 | - $preg_modeles = '@' . _PREG_MODELE . '@imsS'; |
|
| 1629 | + $preg_modeles = '@'._PREG_MODELE.'@imsS'; |
|
| 1630 | 1630 | $texte = echappe_html($texte, '', true, $preg_modeles); |
| 1631 | 1631 | } |
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | 1634 | $debut = ''; |
| 1635 | 1635 | $suite = $texte; |
| 1636 | - while ($t = strpos('-' . $suite, "\n", 1)) { |
|
| 1636 | + while ($t = strpos('-'.$suite, "\n", 1)) { |
|
| 1637 | 1637 | $debut .= substr($suite, 0, $t - 1); |
| 1638 | 1638 | $suite = substr($suite, $t); |
| 1639 | 1639 | $car = substr($suite, 0, 1); |
@@ -1651,11 +1651,11 @@ discard block |
||
| 1651 | 1651 | $suite = substr($suite, strlen($regs[0])); |
| 1652 | 1652 | } |
| 1653 | 1653 | } |
| 1654 | - $texte = $debut . $suite; |
|
| 1654 | + $texte = $debut.$suite; |
|
| 1655 | 1655 | |
| 1656 | 1656 | $texte = echappe_retour($texte); |
| 1657 | 1657 | |
| 1658 | - return $texte . $fin; |
|
| 1658 | + return $texte.$fin; |
|
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | 1661 | |
@@ -1717,7 +1717,7 @@ discard block |
||
| 1717 | 1717 | } |
| 1718 | 1718 | |
| 1719 | 1719 | foreach ($regs as $reg) { |
| 1720 | - $cle = ($reg[1] ? $reg[1] . ':' : '') . $reg[2]; |
|
| 1720 | + $cle = ($reg[1] ? $reg[1].':' : '').$reg[2]; |
|
| 1721 | 1721 | $desc = $traduire($cle, $lang, true); |
| 1722 | 1722 | $l = $desc->langue; |
| 1723 | 1723 | // si pas de traduction, on laissera l'écriture de l'idiome entier dans le texte. |
@@ -1831,9 +1831,9 @@ discard block |
||
| 1831 | 1831 | // il ne faut pas echapper en div si propre produit un seul paragraphe |
| 1832 | 1832 | include_spip('inc/texte'); |
| 1833 | 1833 | $trad_propre = preg_replace(',(^<p[^>]*>|</p>$),Uims', '', propre($trad)); |
| 1834 | - $mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $trad_propre) ? 'div' : 'span'; |
|
| 1834 | + $mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $trad_propre) ? 'div' : 'span'; |
|
| 1835 | 1835 | if ($mode === 'div') { |
| 1836 | - $trad = rtrim($trad) . "\n\n"; |
|
| 1836 | + $trad = rtrim($trad)."\n\n"; |
|
| 1837 | 1837 | } |
| 1838 | 1838 | $trad = code_echappement($trad, 'multi', false, $mode); |
| 1839 | 1839 | $trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l)); |
@@ -2001,7 +2001,7 @@ discard block |
||
| 2001 | 2001 | } |
| 2002 | 2002 | |
| 2003 | 2003 | // un index compris entre 0 et num exclus |
| 2004 | - $i = ((intval($i) -1) % $num); // dans ]-$num;$num[ |
|
| 2004 | + $i = ((intval($i) - 1) % $num); // dans ]-$num;$num[ |
|
| 2005 | 2005 | $i = ($i + $num) % $num; // dans [0;$num[ |
| 2006 | 2006 | // renvoyer le i-ieme argument, modulo le nombre d'arguments |
| 2007 | 2007 | return $args[$i]; |
@@ -2033,7 +2033,7 @@ discard block |
||
| 2033 | 2033 | if (is_array($balise)) { |
| 2034 | 2034 | array_walk( |
| 2035 | 2035 | $balise, |
| 2036 | - function (&$a, $key, $t) { |
|
| 2036 | + function(&$a, $key, $t) { |
|
| 2037 | 2037 | $a = extraire_attribut($a, $t); |
| 2038 | 2038 | }, |
| 2039 | 2039 | $attribut |
@@ -2130,14 +2130,14 @@ discard block |
||
| 2130 | 2130 | |
| 2131 | 2131 | if ($old !== null) { |
| 2132 | 2132 | // Remplacer l'ancien attribut du meme nom |
| 2133 | - $balise = $r[1] . $insert . $r[5]; |
|
| 2133 | + $balise = $r[1].$insert.$r[5]; |
|
| 2134 | 2134 | } else { |
| 2135 | 2135 | // preferer une balise " />" (comme <img />) |
| 2136 | 2136 | if (preg_match(',/>,', $balise)) { |
| 2137 | - $balise = preg_replace(',\s?/>,S', $insert . ' />', $balise, 1); |
|
| 2137 | + $balise = preg_replace(',\s?/>,S', $insert.' />', $balise, 1); |
|
| 2138 | 2138 | } // sinon une balise <a ...> ... </a> |
| 2139 | 2139 | else { |
| 2140 | - $balise = preg_replace(',\s?>,S', $insert . '>', $balise, 1); |
|
| 2140 | + $balise = preg_replace(',\s?>,S', $insert.'>', $balise, 1); |
|
| 2141 | 2141 | } |
| 2142 | 2142 | } |
| 2143 | 2143 | |
@@ -2192,7 +2192,7 @@ discard block |
||
| 2192 | 2192 | if ( |
| 2193 | 2193 | $class_courante |
| 2194 | 2194 | and strpos($class_courante, (string) $c) !== false |
| 2195 | - and preg_match('/(^|\s)' . preg_quote($c) . '($|\s)/', $class_courante) |
|
| 2195 | + and preg_match('/(^|\s)'.preg_quote($c).'($|\s)/', $class_courante) |
|
| 2196 | 2196 | ) { |
| 2197 | 2197 | $is_class_presente = true; |
| 2198 | 2198 | } |
@@ -2200,12 +2200,12 @@ discard block |
||
| 2200 | 2200 | in_array($operation, ['ajouter', 'commuter']) |
| 2201 | 2201 | and !$is_class_presente |
| 2202 | 2202 | ) { |
| 2203 | - $class_new = ltrim(rtrim($class_new ?? '') . ' ' . $c); |
|
| 2203 | + $class_new = ltrim(rtrim($class_new ?? '').' '.$c); |
|
| 2204 | 2204 | } elseif ( |
| 2205 | 2205 | in_array($operation, ['supprimer', 'commuter']) |
| 2206 | 2206 | and $is_class_presente |
| 2207 | 2207 | ) { |
| 2208 | - $class_new = trim(preg_replace('/(^|\s)' . preg_quote($c) . '($|\s)/', "\\1", $class_new)); |
|
| 2208 | + $class_new = trim(preg_replace('/(^|\s)'.preg_quote($c).'($|\s)/', "\\1", $class_new)); |
|
| 2209 | 2209 | } |
| 2210 | 2210 | } |
| 2211 | 2211 | |
@@ -2268,7 +2268,7 @@ discard block |
||
| 2268 | 2268 | // Quelques fonctions de calcul arithmetique |
| 2269 | 2269 | // |
| 2270 | 2270 | function floatstr($a) { |
| 2271 | - return str_replace(',', '.', (string)floatval($a)); |
|
| 2271 | + return str_replace(',', '.', (string) floatval($a)); |
|
| 2272 | 2272 | } |
| 2273 | 2273 | function strize($f, $a, $b) { |
| 2274 | 2274 | return floatstr($f(floatstr($a), floatstr($b))); |
@@ -2404,13 +2404,13 @@ discard block |
||
| 2404 | 2404 | if (!defined('_TAGS_NOM_AUTEUR')) { |
| 2405 | 2405 | define('_TAGS_NOM_AUTEUR', ''); |
| 2406 | 2406 | } |
| 2407 | - $tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR)); |
|
| 2407 | + $tags_acceptes = array_unique(explode(',', 'multi,'._TAGS_NOM_AUTEUR)); |
|
| 2408 | 2408 | foreach ($tags_acceptes as $tag) { |
| 2409 | 2409 | if (strlen($tag)) { |
| 2410 | - $remp1[] = '<' . trim($tag) . '>'; |
|
| 2411 | - $remp1[] = '</' . trim($tag) . '>'; |
|
| 2412 | - $remp2[] = '\x60' . trim($tag) . '\x61'; |
|
| 2413 | - $remp2[] = '\x60/' . trim($tag) . '\x61'; |
|
| 2410 | + $remp1[] = '<'.trim($tag).'>'; |
|
| 2411 | + $remp1[] = '</'.trim($tag).'>'; |
|
| 2412 | + $remp2[] = '\x60'.trim($tag).'\x61'; |
|
| 2413 | + $remp2[] = '\x60/'.trim($tag).'\x61'; |
|
| 2414 | 2414 | } |
| 2415 | 2415 | } |
| 2416 | 2416 | $v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom))); |
@@ -2464,7 +2464,7 @@ discard block |
||
| 2464 | 2464 | . http_img_pack( |
| 2465 | 2465 | 'attachment-16.png', |
| 2466 | 2466 | $t, |
| 2467 | - 'title="' . attribut_html($t) . '"' |
|
| 2467 | + 'title="'.attribut_html($t).'"' |
|
| 2468 | 2468 | ) |
| 2469 | 2469 | . '</a>', |
| 2470 | 2470 | $tag |
@@ -2528,10 +2528,10 @@ discard block |
||
| 2528 | 2528 | $fichier = basename($url); |
| 2529 | 2529 | |
| 2530 | 2530 | return '<a rel="enclosure"' |
| 2531 | - . ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2532 | - . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2533 | - . ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '') |
|
| 2534 | - . '>' . $fichier . '</a>'; |
|
| 2531 | + . ($url ? ' href="'.spip_htmlspecialchars($url).'"' : '') |
|
| 2532 | + . ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '') |
|
| 2533 | + . ($length ? ' title="'.spip_htmlspecialchars($length).'"' : '') |
|
| 2534 | + . '>'.$fichier.'</a>'; |
|
| 2535 | 2535 | } |
| 2536 | 2536 | |
| 2537 | 2537 | /** |
@@ -2559,9 +2559,9 @@ discard block |
||
| 2559 | 2559 | } # vieux data |
| 2560 | 2560 | $fichier = basename($url); |
| 2561 | 2561 | $enclosures[] = '<enclosure' |
| 2562 | - . ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2563 | - . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2564 | - . ($length ? ' length="' . $length . '"' : '') |
|
| 2562 | + . ($url ? ' url="'.spip_htmlspecialchars($url).'"' : '') |
|
| 2563 | + . ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '') |
|
| 2564 | + . ($length ? ' length="'.$length.'"' : '') |
|
| 2565 | 2565 | . ' />'; |
| 2566 | 2566 | } |
| 2567 | 2567 | } |
@@ -2587,7 +2587,7 @@ discard block |
||
| 2587 | 2587 | if (extraire_attribut($e, 'rel') == 'tag') { |
| 2588 | 2588 | $subjects .= '<dc:subject>' |
| 2589 | 2589 | . texte_backend(textebrut($e)) |
| 2590 | - . '</dc:subject>' . "\n"; |
|
| 2590 | + . '</dc:subject>'."\n"; |
|
| 2591 | 2591 | } |
| 2592 | 2592 | } |
| 2593 | 2593 | |
@@ -2623,7 +2623,7 @@ discard block |
||
| 2623 | 2623 | if (is_array($texte)) { |
| 2624 | 2624 | array_walk( |
| 2625 | 2625 | $texte, |
| 2626 | - function (&$a, $key, $t) { |
|
| 2626 | + function(&$a, $key, $t) { |
|
| 2627 | 2627 | $a = extraire_balise($a, $t); |
| 2628 | 2628 | }, |
| 2629 | 2629 | $tag |
@@ -2671,7 +2671,7 @@ discard block |
||
| 2671 | 2671 | if (is_array($texte)) { |
| 2672 | 2672 | array_walk( |
| 2673 | 2673 | $texte, |
| 2674 | - function (&$a, $key, $t) { |
|
| 2674 | + function(&$a, $key, $t) { |
|
| 2675 | 2675 | $a = extraire_balises($a, $t); |
| 2676 | 2676 | }, |
| 2677 | 2677 | $tag |
@@ -2804,7 +2804,7 @@ discard block |
||
| 2804 | 2804 | if ($fond != '404') { |
| 2805 | 2805 | $contexte = array_shift($p); |
| 2806 | 2806 | $contexte['page'] = $fond; |
| 2807 | - $action = preg_replace('/([?]' . preg_quote($fond) . '[^&=]*[0-9]+)(&|$)/', '?&', $action); |
|
| 2807 | + $action = preg_replace('/([?]'.preg_quote($fond).'[^&=]*[0-9]+)(&|$)/', '?&', $action); |
|
| 2808 | 2808 | } |
| 2809 | 2809 | } |
| 2810 | 2810 | // defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url |
@@ -2859,9 +2859,9 @@ discard block |
||
| 2859 | 2859 | . '"' |
| 2860 | 2860 | . (is_null($val) |
| 2861 | 2861 | ? '' |
| 2862 | - : ' value="' . entites_html($val) . '"' |
|
| 2862 | + : ' value="'.entites_html($val).'"' |
|
| 2863 | 2863 | ) |
| 2864 | - . ' type="hidden"' . "\n/>"; |
|
| 2864 | + . ' type="hidden"'."\n/>"; |
|
| 2865 | 2865 | } |
| 2866 | 2866 | |
| 2867 | 2867 | return join('', $hidden); |
@@ -2971,7 +2971,7 @@ discard block |
||
| 2971 | 2971 | |
| 2972 | 2972 | return preg_replace_callback( |
| 2973 | 2973 | ",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims", |
| 2974 | - fn($x) => "url('" . suivre_lien($path, $x[1]) . "')", |
|
| 2974 | + fn($x) => "url('".suivre_lien($path, $x[1])."')", |
|
| 2975 | 2975 | $contenu |
| 2976 | 2976 | ); |
| 2977 | 2977 | } |
@@ -3032,14 +3032,14 @@ discard block |
||
| 3032 | 3032 | ) { |
| 3033 | 3033 | $distant = true; |
| 3034 | 3034 | $cssf = parse_url($css); |
| 3035 | - $cssf = $cssf['path'] . ($cssf['query'] ? '?' . $cssf['query'] : ''); |
|
| 3035 | + $cssf = $cssf['path'].($cssf['query'] ? '?'.$cssf['query'] : ''); |
|
| 3036 | 3036 | $cssf = preg_replace(',[?:&=],', '_', $cssf); |
| 3037 | 3037 | } else { |
| 3038 | 3038 | $distant = false; |
| 3039 | 3039 | $cssf = $css; |
| 3040 | 3040 | // 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi |
| 3041 | 3041 | //propose (rien a faire dans ce cas) |
| 3042 | - $f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css); |
|
| 3042 | + $f = preg_replace(',(_rtl)?\.css$,i', '_'.$ndir.'.css', $css); |
|
| 3043 | 3043 | if (@file_exists($f)) { |
| 3044 | 3044 | return $f; |
| 3045 | 3045 | } |
@@ -3049,7 +3049,7 @@ discard block |
||
| 3049 | 3049 | $dir_var = sous_repertoire(_DIR_VAR, 'cache-css'); |
| 3050 | 3050 | $f = $dir_var |
| 3051 | 3051 | . preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf) |
| 3052 | - . '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css'; |
|
| 3052 | + . '.'.substr(md5($cssf), 0, 4).'_'.$ndir.'.css'; |
|
| 3053 | 3053 | |
| 3054 | 3054 | // la css peut etre distante (url absolue !) |
| 3055 | 3055 | if ($distant) { |
@@ -3095,8 +3095,8 @@ discard block |
||
| 3095 | 3095 | } // si la css_direction commence par $dir_var on la fait passer pour une absolue |
| 3096 | 3096 | elseif (substr($css_direction, 0, strlen($dir_var)) == $dir_var) { |
| 3097 | 3097 | $css_direction = substr($css_direction, strlen($dir_var)); |
| 3098 | - $src_faux_abs['/@@@@@@/' . $css_direction] = $css_direction; |
|
| 3099 | - $css_direction = '/@@@@@@/' . $css_direction; |
|
| 3098 | + $src_faux_abs['/@@@@@@/'.$css_direction] = $css_direction; |
|
| 3099 | + $css_direction = '/@@@@@@/'.$css_direction; |
|
| 3100 | 3100 | } |
| 3101 | 3101 | $src[] = $regs[0][$k]; |
| 3102 | 3102 | $src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]); |
@@ -3145,7 +3145,7 @@ discard block |
||
| 3145 | 3145 | |
| 3146 | 3146 | $f = basename($css, '.css'); |
| 3147 | 3147 | $f = sous_repertoire(_DIR_VAR, 'cache-css') |
| 3148 | - . preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f) |
|
| 3148 | + . preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-".substr(md5("$css-urlabs"), 0, 4)."\\2", $f) |
|
| 3149 | 3149 | . '.css'; |
| 3150 | 3150 | |
| 3151 | 3151 | if ((@filemtime($f) > @filemtime($css)) and (_VAR_MODE != 'recalcul')) { |
@@ -3155,7 +3155,7 @@ discard block |
||
| 3155 | 3155 | if ($url_absolue_css == $css) { |
| 3156 | 3156 | if ( |
| 3157 | 3157 | strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0 |
| 3158 | - or !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu) |
|
| 3158 | + or !lire_fichier(_DIR_RACINE.substr($css, $l), $contenu) |
|
| 3159 | 3159 | ) { |
| 3160 | 3160 | include_spip('inc/distant'); |
| 3161 | 3161 | $contenu = recuperer_url($css); |
@@ -3267,7 +3267,7 @@ discard block |
||
| 3267 | 3267 | $expression = str_replace('\/', '/', $expression); |
| 3268 | 3268 | $expression = str_replace('/', '\/', $expression); |
| 3269 | 3269 | |
| 3270 | - if (preg_match('/' . $expression . '/' . $modif, $texte ?? '', $r)) { |
|
| 3270 | + if (preg_match('/'.$expression.'/'.$modif, $texte ?? '', $r)) { |
|
| 3271 | 3271 | if (isset($r[$capte])) { |
| 3272 | 3272 | return $r[$capte]; |
| 3273 | 3273 | } else { |
@@ -3305,7 +3305,7 @@ discard block |
||
| 3305 | 3305 | $expression = str_replace('\/', '/', $expression); |
| 3306 | 3306 | $expression = str_replace('/', '\/', $expression); |
| 3307 | 3307 | |
| 3308 | - return preg_replace('/' . $expression . '/' . $modif, $replace, $texte); |
|
| 3308 | + return preg_replace('/'.$expression.'/'.$modif, $replace, $texte); |
|
| 3309 | 3309 | } |
| 3310 | 3310 | |
| 3311 | 3311 | |
@@ -3324,7 +3324,7 @@ discard block |
||
| 3324 | 3324 | function traiter_doublons_documents(&$doublons, $letexte) { |
| 3325 | 3325 | |
| 3326 | 3326 | // Verifier dans le texte & les notes (pas beau, helas) |
| 3327 | - $t = $letexte . $GLOBALS['les_notes']; |
|
| 3327 | + $t = $letexte.$GLOBALS['les_notes']; |
|
| 3328 | 3328 | |
| 3329 | 3329 | if ( |
| 3330 | 3330 | strstr($t, 'spip_document_') // evite le preg_match_all si inutile |
@@ -3338,7 +3338,7 @@ discard block |
||
| 3338 | 3338 | if (!isset($doublons['documents'])) { |
| 3339 | 3339 | $doublons['documents'] = ''; |
| 3340 | 3340 | } |
| 3341 | - $doublons['documents'] .= ',' . join(',', $matches[1]); |
|
| 3341 | + $doublons['documents'] .= ','.join(',', $matches[1]); |
|
| 3342 | 3342 | } |
| 3343 | 3343 | |
| 3344 | 3344 | return $letexte; |
@@ -3395,7 +3395,7 @@ discard block |
||
| 3395 | 3395 | if ($env) { |
| 3396 | 3396 | foreach ($env as $i => $j) { |
| 3397 | 3397 | if (is_string($j) and !in_array($i, $ignore_params)) { |
| 3398 | - $texte .= "<param name='" . attribut_html($i) . "'\n\tvalue='" . attribut_html($j) . "' />"; |
|
| 3398 | + $texte .= "<param name='".attribut_html($i)."'\n\tvalue='".attribut_html($j)."' />"; |
|
| 3399 | 3399 | } |
| 3400 | 3400 | } |
| 3401 | 3401 | } |
@@ -3434,7 +3434,7 @@ discard block |
||
| 3434 | 3434 | if ($env) { |
| 3435 | 3435 | foreach ($env as $i => $j) { |
| 3436 | 3436 | if (is_string($j) and !in_array($i, $ignore_params)) { |
| 3437 | - $texte .= attribut_html($i) . "='" . attribut_html($j) . "' "; |
|
| 3437 | + $texte .= attribut_html($i)."='".attribut_html($j)."' "; |
|
| 3438 | 3438 | } |
| 3439 | 3439 | } |
| 3440 | 3440 | } |
@@ -3508,10 +3508,10 @@ discard block |
||
| 3508 | 3508 | // si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png |
| 3509 | 3509 | if ( |
| 3510 | 3510 | preg_match(',-(\d+)[.](png|gif|svg)$,', $img_file, $m) |
| 3511 | - and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])) . '-xx.svg' |
|
| 3511 | + and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])).'-xx.svg' |
|
| 3512 | 3512 | and file_exists($variante_svg_generique) |
| 3513 | 3513 | ) { |
| 3514 | - if ($variante_svg_size = substr($variante_svg_generique, 0, -6) . $m[1] . '.svg' and file_exists($variante_svg_size)) { |
|
| 3514 | + if ($variante_svg_size = substr($variante_svg_generique, 0, -6).$m[1].'.svg' and file_exists($variante_svg_size)) { |
|
| 3515 | 3515 | $img_file = $variante_svg_size; |
| 3516 | 3516 | } |
| 3517 | 3517 | else { |
@@ -3569,7 +3569,7 @@ discard block |
||
| 3569 | 3569 | return ''; |
| 3570 | 3570 | } |
| 3571 | 3571 | } |
| 3572 | - $atts .= " width='" . $largeur . "' height='" . $hauteur . "'"; |
|
| 3572 | + $atts .= " width='".$largeur."' height='".$hauteur."'"; |
|
| 3573 | 3573 | } |
| 3574 | 3574 | |
| 3575 | 3575 | if (file_exists($img_file)) { |
@@ -3579,14 +3579,14 @@ discard block |
||
| 3579 | 3579 | $alt = ''; |
| 3580 | 3580 | } |
| 3581 | 3581 | elseif ($alt or $alt === '') { |
| 3582 | - $alt = " alt='" . attribut_html($alt) . "'"; |
|
| 3582 | + $alt = " alt='".attribut_html($alt)."'"; |
|
| 3583 | 3583 | } |
| 3584 | 3584 | else { |
| 3585 | - $alt = " alt='" . attribut_html($title) . "'"; |
|
| 3585 | + $alt = " alt='".attribut_html($title)."'"; |
|
| 3586 | 3586 | } |
| 3587 | 3587 | return "<img src='$img_file'$alt" |
| 3588 | - . ($title ? ' title="' . attribut_html($title) . '"' : '') |
|
| 3589 | - . ' ' . ltrim($atts) |
|
| 3588 | + . ($title ? ' title="'.attribut_html($title).'"' : '') |
|
| 3589 | + . ' '.ltrim($atts) |
|
| 3590 | 3590 | . ' />'; |
| 3591 | 3591 | } |
| 3592 | 3592 | |
@@ -3600,10 +3600,10 @@ discard block |
||
| 3600 | 3600 | */ |
| 3601 | 3601 | function http_style_background($img, $att = '', $size = null) { |
| 3602 | 3602 | if ($size and is_numeric($size)) { |
| 3603 | - $size = trim($size) . 'px'; |
|
| 3603 | + $size = trim($size).'px'; |
|
| 3604 | 3604 | } |
| 3605 | - return " style='background" . |
|
| 3606 | - ($att ? '' : '-image') . ': url("' . chemin_image($img) . '")' . ($att ? (' ' . $att) : '') . ';' |
|
| 3605 | + return " style='background". |
|
| 3606 | + ($att ? '' : '-image').': url("'.chemin_image($img).'")'.($att ? (' '.$att) : '').';' |
|
| 3607 | 3607 | . ($size ? "background-size:{$size};" : '') |
| 3608 | 3608 | . "'"; |
| 3609 | 3609 | } |
@@ -3718,7 +3718,7 @@ discard block |
||
| 3718 | 3718 | $img = http_img_pack( |
| 3719 | 3719 | $img, |
| 3720 | 3720 | $alt, |
| 3721 | - $class ? " class='" . attribut_html($class) . "'" : '', |
|
| 3721 | + $class ? " class='".attribut_html($class)."'" : '', |
|
| 3722 | 3722 | '', |
| 3723 | 3723 | ['chemin_image' => false, 'utiliser_suffixe_size' => false] |
| 3724 | 3724 | ); |
@@ -3803,7 +3803,7 @@ discard block |
||
| 3803 | 3803 | $balise_svg_source = $balise_svg; |
| 3804 | 3804 | |
| 3805 | 3805 | // entete XML à supprimer |
| 3806 | - $svg = preg_replace(',^\s*<\?xml[^>]*\?' . '>,', '', $svg); |
|
| 3806 | + $svg = preg_replace(',^\s*<\?xml[^>]*\?'.'>,', '', $svg); |
|
| 3807 | 3807 | |
| 3808 | 3808 | // IE est toujours mon ami |
| 3809 | 3809 | $balise_svg = inserer_attribut($balise_svg, 'focusable', 'false'); |
@@ -3821,9 +3821,9 @@ discard block |
||
| 3821 | 3821 | // regler le alt |
| 3822 | 3822 | if ($alt) { |
| 3823 | 3823 | $balise_svg = inserer_attribut($balise_svg, 'role', 'img'); |
| 3824 | - $id = 'img-svg-title-' . substr(md5("$img_file:$svg:$alt"), 0, 4); |
|
| 3824 | + $id = 'img-svg-title-'.substr(md5("$img_file:$svg:$alt"), 0, 4); |
|
| 3825 | 3825 | $balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id); |
| 3826 | - $title = "<title id=\"$id\">" . entites_html($alt) . "</title>\n"; |
|
| 3826 | + $title = "<title id=\"$id\">".entites_html($alt)."</title>\n"; |
|
| 3827 | 3827 | $balise_svg .= $title; |
| 3828 | 3828 | } |
| 3829 | 3829 | else { |
@@ -3871,7 +3871,7 @@ discard block |
||
| 3871 | 3871 | if (is_array($tableau)) { |
| 3872 | 3872 | foreach ($tableau as $k => $v) { |
| 3873 | 3873 | $res = recuperer_fond( |
| 3874 | - 'modeles/' . $modele, |
|
| 3874 | + 'modeles/'.$modele, |
|
| 3875 | 3875 | array_merge(['cle' => $k], (is_array($v) ? $v : ['valeur' => $v])) |
| 3876 | 3876 | ); |
| 3877 | 3877 | $texte .= $res; |
@@ -4056,7 +4056,7 @@ discard block |
||
| 4056 | 4056 | } |
| 4057 | 4057 | |
| 4058 | 4058 | $c = serialize($c); |
| 4059 | - $cle = calculer_cle_action($form . $c); |
|
| 4059 | + $cle = calculer_cle_action($form.$c); |
|
| 4060 | 4060 | $c = "$cle:$c"; |
| 4061 | 4061 | |
| 4062 | 4062 | // on ne stocke pas les contextes dans des fichiers en cache |
@@ -4114,15 +4114,15 @@ discard block |
||
| 4114 | 4114 | } |
| 4115 | 4115 | // toujours encoder l'url source dans le bloc ajax |
| 4116 | 4116 | $r = self(); |
| 4117 | - $r = ' data-origin="' . $r . '"'; |
|
| 4117 | + $r = ' data-origin="'.$r.'"'; |
|
| 4118 | 4118 | $class = 'ajaxbloc'; |
| 4119 | 4119 | if ($ajaxid and is_string($ajaxid)) { |
| 4120 | 4120 | // ajaxid est normalement conforme a un nom de classe css |
| 4121 | 4121 | // on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution |
| 4122 | - $class .= ' ajax-id-' . entites_html($ajaxid); |
|
| 4122 | + $class .= ' ajax-id-'.entites_html($ajaxid); |
|
| 4123 | 4123 | } |
| 4124 | 4124 | |
| 4125 | - return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n"; |
|
| 4125 | + return "<div class='$class' "."data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n"; |
|
| 4126 | 4126 | } |
| 4127 | 4127 | |
| 4128 | 4128 | /** |
@@ -4166,7 +4166,7 @@ discard block |
||
| 4166 | 4166 | $cle = substr($c, 0, $p); |
| 4167 | 4167 | $c = substr($c, $p + 1); |
| 4168 | 4168 | |
| 4169 | - if ($cle == calculer_cle_action($form . $c)) { |
|
| 4169 | + if ($cle == calculer_cle_action($form.$c)) { |
|
| 4170 | 4170 | $env = @unserialize($c); |
| 4171 | 4171 | return $env; |
| 4172 | 4172 | } |
@@ -4287,13 +4287,13 @@ discard block |
||
| 4287 | 4287 | } |
| 4288 | 4288 | } |
| 4289 | 4289 | } |
| 4290 | - $att .= 'class="' . ($class ? attribut_html($class) . ' ' : '') . (defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on') . '"'; |
|
| 4290 | + $att .= 'class="'.($class ? attribut_html($class).' ' : '').(defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on').'"'; |
|
| 4291 | 4291 | } else { |
| 4292 | 4292 | $bal = 'a'; |
| 4293 | 4293 | $att = "href='$url'" |
| 4294 | - . ($title ? " title='" . attribut_html($title) . "'" : '') |
|
| 4295 | - . ($class ? " class='" . attribut_html($class) . "'" : '') |
|
| 4296 | - . ($rel ? " rel='" . attribut_html($rel) . "'" : '') |
|
| 4294 | + . ($title ? " title='".attribut_html($title)."'" : '') |
|
| 4295 | + . ($class ? " class='".attribut_html($class)."'" : '') |
|
| 4296 | + . ($rel ? " rel='".attribut_html($rel)."'" : '') |
|
| 4297 | 4297 | . $evt; |
| 4298 | 4298 | } |
| 4299 | 4299 | if ($libelle === null) { |
@@ -4432,7 +4432,7 @@ discard block |
||
| 4432 | 4432 | |
| 4433 | 4433 | // Icône |
| 4434 | 4434 | $icone = http_img_pack($fond, $alt, "width='$size' height='$size'"); |
| 4435 | - $icone = '<span class="icone-image' . ($fonction ? " icone-fonction icone-fonction-$fonction" : '') . "\">$icone</span>"; |
|
| 4435 | + $icone = '<span class="icone-image'.($fonction ? " icone-fonction icone-fonction-$fonction" : '')."\">$icone</span>"; |
|
| 4436 | 4436 | |
| 4437 | 4437 | // Markup final |
| 4438 | 4438 | if ($type == 'lien') { |
@@ -4709,20 +4709,20 @@ discard block |
||
| 4709 | 4709 | $class_form = 'ajax'; |
| 4710 | 4710 | $class = str_replace('ajax', '', $class); |
| 4711 | 4711 | } |
| 4712 | - $class_btn = 'submit ' . trim($class); |
|
| 4712 | + $class_btn = 'submit '.trim($class); |
|
| 4713 | 4713 | |
| 4714 | 4714 | if ($confirm) { |
| 4715 | - $confirm = 'confirm("' . attribut_html($confirm) . '")'; |
|
| 4715 | + $confirm = 'confirm("'.attribut_html($confirm).'")'; |
|
| 4716 | 4716 | if ($callback) { |
| 4717 | 4717 | $callback = "$confirm?($callback):false"; |
| 4718 | 4718 | } else { |
| 4719 | 4719 | $callback = $confirm; |
| 4720 | 4720 | } |
| 4721 | 4721 | } |
| 4722 | - $onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : ''; |
|
| 4722 | + $onclick = $callback ? " onclick='return ".addcslashes($callback, "'")."'" : ''; |
|
| 4723 | 4723 | $title = $title ? " title='$title'" : ''; |
| 4724 | 4724 | |
| 4725 | - return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>" . form_hidden($url) |
|
| 4725 | + return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>".form_hidden($url) |
|
| 4726 | 4726 | . "<button type='submit' class='$class_btn'$title$onclick>$libelle</button></div></form>"; |
| 4727 | 4727 | } |
| 4728 | 4728 | |
@@ -4787,14 +4787,14 @@ discard block |
||
| 4787 | 4787 | $champ_titre = ''; |
| 4788 | 4788 | if ($demande_titre) { |
| 4789 | 4789 | // si pas de titre declare mais champ titre, il sera peuple par le select * |
| 4790 | - $champ_titre = (!empty($desc['titre'])) ? ', ' . $desc['titre'] : ''; |
|
| 4790 | + $champ_titre = (!empty($desc['titre'])) ? ', '.$desc['titre'] : ''; |
|
| 4791 | 4791 | } |
| 4792 | 4792 | include_spip('base/abstract_sql'); |
| 4793 | 4793 | include_spip('base/connect_sql'); |
| 4794 | 4794 | $objets[$type_objet][$id_objet] = sql_fetsel( |
| 4795 | - '*' . $champ_titre, |
|
| 4795 | + '*'.$champ_titre, |
|
| 4796 | 4796 | $desc['table_sql'], |
| 4797 | - id_table_objet($type_objet) . ' = ' . intval($id_objet) |
|
| 4797 | + id_table_objet($type_objet).' = '.intval($id_objet) |
|
| 4798 | 4798 | ); |
| 4799 | 4799 | |
| 4800 | 4800 | // Toujours noter la longueur d'introduction, même si pas demandé cette fois-ci |
@@ -4887,8 +4887,7 @@ discard block |
||
| 4887 | 4887 | if (isset($ligne_sql['chapo'])) { |
| 4888 | 4888 | $chapo = $ligne_sql['chapo']; |
| 4889 | 4889 | $texte = strlen($descriptif) ? |
| 4890 | - '' : |
|
| 4891 | - "$chapo \n\n $texte"; |
|
| 4890 | + '' : "$chapo \n\n $texte"; |
|
| 4892 | 4891 | } |
| 4893 | 4892 | |
| 4894 | 4893 | // Longueur en paramètre, sinon celle renseignée dans la description de l'objet, sinon valeur en dur |
@@ -4963,7 +4962,7 @@ discard block |
||
| 4963 | 4962 | return $texte; |
| 4964 | 4963 | } |
| 4965 | 4964 | |
| 4966 | - $traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement); |
|
| 4965 | + $traitement = str_replace('%s', "'".texte_script($texte)."'", $traitement); |
|
| 4967 | 4966 | |
| 4968 | 4967 | // Fournir $connect et $Pile[0] au traitement si besoin |
| 4969 | 4968 | $Pile = [0 => $env]; |
@@ -4997,7 +4996,7 @@ discard block |
||
| 4997 | 4996 | } |
| 4998 | 4997 | $url = generer_objet_url($id_objet, $objet, '', '', null, '', $connect); |
| 4999 | 4998 | |
| 5000 | - return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . '</a>'; |
|
| 4999 | + return "<a href='$url' class='$objet'>".couper($titre, $longueur).'</a>'; |
|
| 5001 | 5000 | } |
| 5002 | 5001 | |
| 5003 | 5002 | /** |
@@ -5023,10 +5022,10 @@ discard block |
||
| 5023 | 5022 | function wrap($texte, $wrap) { |
| 5024 | 5023 | $balises = extraire_balises($wrap); |
| 5025 | 5024 | if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) { |
| 5026 | - $texte = $wrap . $texte; |
|
| 5025 | + $texte = $wrap.$texte; |
|
| 5027 | 5026 | $regs = array_reverse($regs[1]); |
| 5028 | - $wrap = '</' . implode('></', $regs) . '>'; |
|
| 5029 | - $texte = $texte . $wrap; |
|
| 5027 | + $wrap = '</'.implode('></', $regs).'>'; |
|
| 5028 | + $texte = $texte.$wrap; |
|
| 5030 | 5029 | } |
| 5031 | 5030 | |
| 5032 | 5031 | return $texte; |
@@ -5057,7 +5056,7 @@ discard block |
||
| 5057 | 5056 | |
| 5058 | 5057 | // caster $u en array si besoin |
| 5059 | 5058 | if (is_object($u)) { |
| 5060 | - $u = (array)$u; |
|
| 5059 | + $u = (array) $u; |
|
| 5061 | 5060 | } |
| 5062 | 5061 | |
| 5063 | 5062 | if (is_array($u)) { |
@@ -5079,7 +5078,7 @@ discard block |
||
| 5079 | 5078 | // sinon on passe a la ligne et on indente |
| 5080 | 5079 | $i_str = str_pad('', $indent, ' '); |
| 5081 | 5080 | foreach ($u as $k => $v) { |
| 5082 | - $out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2); |
|
| 5081 | + $out .= $join.$i_str."$k: ".filtre_print_dist($v, $join, $indent + 2); |
|
| 5083 | 5082 | } |
| 5084 | 5083 | |
| 5085 | 5084 | return $out; |
@@ -5133,7 +5132,7 @@ discard block |
||
| 5133 | 5132 | * @return string |
| 5134 | 5133 | */ |
| 5135 | 5134 | function objet_icone($objet, $taille = 24, $class = '') { |
| 5136 | - $icone = objet_info($objet, 'icone_objet') . '-' . $taille . '.png'; |
|
| 5135 | + $icone = objet_info($objet, 'icone_objet').'-'.$taille.'.png'; |
|
| 5137 | 5136 | $icone = chemin_image($icone); |
| 5138 | 5137 | $balise_img = charger_filtre('balise_img'); |
| 5139 | 5138 | |
@@ -5159,7 +5158,7 @@ discard block |
||
| 5159 | 5158 | */ |
| 5160 | 5159 | function objet_T($objet, $chaine, $args = [], $options = []) { |
| 5161 | 5160 | $chaine = explode(':', $chaine); |
| 5162 | - if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, ['force' => false]))) { |
|
| 5161 | + if ($t = _T($objet.':'.end($chaine), $args, array_merge($options, ['force' => false]))) { |
|
| 5163 | 5162 | return $t; |
| 5164 | 5163 | } |
| 5165 | 5164 | $chaine = implode(':', $chaine); |
@@ -5225,7 +5224,7 @@ discard block |
||
| 5225 | 5224 | $cache = recuperer_fond($fond, $contexte, $options, $connect); |
| 5226 | 5225 | |
| 5227 | 5226 | // calculer le nom de la css |
| 5228 | - $dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension); |
|
| 5227 | + $dir_var = sous_repertoire(_DIR_VAR, 'cache-'.$extension); |
|
| 5229 | 5228 | $nom_safe = preg_replace(',\W,', '_', str_replace('.', '_', $fond)); |
| 5230 | 5229 | $contexte_implicite = calculer_contexte_implicite(); |
| 5231 | 5230 | |
@@ -5233,14 +5232,14 @@ discard block |
||
| 5233 | 5232 | // mais on peut hasher selon le contenu a la demande, si plusieurs contextes produisent un meme contenu |
| 5234 | 5233 | // reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine |
| 5235 | 5234 | if (isset($options['hash_on_content']) and $options['hash_on_content']) { |
| 5236 | - $hash = md5($contexte_implicite['host'] . '::' . $cache); |
|
| 5235 | + $hash = md5($contexte_implicite['host'].'::'.$cache); |
|
| 5237 | 5236 | } |
| 5238 | 5237 | else { |
| 5239 | 5238 | unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js |
| 5240 | 5239 | ksort($contexte); |
| 5241 | - $hash = md5($fond . json_encode($contexte_implicite, JSON_THROW_ON_ERROR) . json_encode($contexte, JSON_THROW_ON_ERROR) . $connect); |
|
| 5240 | + $hash = md5($fond.json_encode($contexte_implicite, JSON_THROW_ON_ERROR).json_encode($contexte, JSON_THROW_ON_ERROR).$connect); |
|
| 5242 | 5241 | } |
| 5243 | - $filename = $dir_var . $extension . "dyn-$nom_safe-" . substr($hash, 0, 8) . ".$extension"; |
|
| 5242 | + $filename = $dir_var.$extension."dyn-$nom_safe-".substr($hash, 0, 8).".$extension"; |
|
| 5244 | 5243 | |
| 5245 | 5244 | // mettre a jour le fichier si il n'existe pas |
| 5246 | 5245 | // ou trop ancien |
@@ -5248,8 +5247,8 @@ discard block |
||
| 5248 | 5247 | // et recopie sur le fichier cible uniquement si il change |
| 5249 | 5248 | if ( |
| 5250 | 5249 | !file_exists($filename) |
| 5251 | - or !file_exists($filename . '.last') |
|
| 5252 | - or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename . '.last') < $cache['lastmodified']) |
|
| 5250 | + or !file_exists($filename.'.last') |
|
| 5251 | + or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename.'.last') < $cache['lastmodified']) |
|
| 5253 | 5252 | or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') |
| 5254 | 5253 | ) { |
| 5255 | 5254 | $contenu = $cache['texte']; |
@@ -5270,10 +5269,10 @@ discard block |
||
| 5270 | 5269 | } |
| 5271 | 5270 | // pas de date dans le commentaire car sinon ca invalide le md5 et force la maj |
| 5272 | 5271 | // mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non |
| 5273 | - $comment .= "}\n md5:" . md5($contenu) . " */\n"; |
|
| 5272 | + $comment .= "}\n md5:".md5($contenu)." */\n"; |
|
| 5274 | 5273 | } |
| 5275 | 5274 | // et ecrire le fichier si il change |
| 5276 | - ecrire_fichier_calcule_si_modifie($filename, $comment . $contenu, false, true); |
|
| 5275 | + ecrire_fichier_calcule_si_modifie($filename, $comment.$contenu, false, true); |
|
| 5277 | 5276 | } |
| 5278 | 5277 | |
| 5279 | 5278 | return timestamp($filename); |
@@ -5499,7 +5498,7 @@ discard block |
||
| 5499 | 5498 | if ($e > 0 and strlen($mid) > 8) { |
| 5500 | 5499 | $mid = '***...***'; |
| 5501 | 5500 | } |
| 5502 | - return substr($passe, 0, $e) . $mid . ($e > 0 ? substr($passe, -$e) : ''); |
|
| 5501 | + return substr($passe, 0, $e).$mid.($e > 0 ? substr($passe, -$e) : ''); |
|
| 5503 | 5502 | } |
| 5504 | 5503 | |
| 5505 | 5504 | |
@@ -5561,7 +5560,7 @@ discard block |
||
| 5561 | 5560 | case 'id': |
| 5562 | 5561 | case 'anchor': |
| 5563 | 5562 | if (preg_match(',^\d,', $texte)) { |
| 5564 | - $texte = substr($type, 0, 1) . $texte; |
|
| 5563 | + $texte = substr($type, 0, 1).$texte; |
|
| 5565 | 5564 | } |
| 5566 | 5565 | } |
| 5567 | 5566 | |
@@ -5571,9 +5570,9 @@ discard block |
||
| 5571 | 5570 | |
| 5572 | 5571 | if (strlen($texte) < $longueur_mini and $longueur_mini < $longueur_maxi) { |
| 5573 | 5572 | if (preg_match(',^\d,', $texte)) { |
| 5574 | - $texte = ($type ? substr($type, 0, 1) : 's') . $texte; |
|
| 5573 | + $texte = ($type ? substr($type, 0, 1) : 's').$texte; |
|
| 5575 | 5574 | } |
| 5576 | - $texte .= $separateur . md5($original); |
|
| 5575 | + $texte .= $separateur.md5($original); |
|
| 5577 | 5576 | $texte = substr($texte, 0, $longueur_mini); |
| 5578 | 5577 | } |
| 5579 | 5578 | |