@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | // si port est fourni mais pas host, c'est un socket -> compat avec vieille syntaxe de mysql_connect() et anciens fichiers connect.php |
| 49 | 49 | if ( |
| 50 | 50 | $port and !is_numeric($socket = $port) |
| 51 | - and (!$host or $host=='localhost')) { |
|
| 51 | + and (!$host or $host == 'localhost')) { |
|
| 52 | 52 | $link = @mysqli_connect($host, $login, $pass, '', null, $socket); |
| 53 | 53 | } |
| 54 | 54 | elseif ($port) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | if (!$link) { |
| 62 | - spip_log('Echec mysqli_connect. Erreur : ' . mysqli_connect_error(), 'mysql.' . _LOG_HS); |
|
| 62 | + spip_log('Echec mysqli_connect. Erreur : '.mysqli_connect_error(), 'mysql.'._LOG_HS); |
|
| 63 | 63 | |
| 64 | 64 | return false; |
| 65 | 65 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - spip_log("Connexion MySQLi vers $host, base $db, prefixe $prefixe " . ($ok ? "operationnelle" : 'impossible'), |
|
| 79 | + spip_log("Connexion MySQLi vers $host, base $db, prefixe $prefixe ".($ok ? "operationnelle" : 'impossible'), |
|
| 80 | 80 | _LOG_DEBUG); |
| 81 | 81 | |
| 82 | 82 | return !$ok ? false : array( |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | function spip_mysql_set_charset($charset, $serveur = '', $requeter = true) { |
| 167 | 167 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 168 | - spip_log("changement de charset sql : " . "SET NAMES " . _q($charset), _LOG_DEBUG); |
|
| 168 | + spip_log("changement de charset sql : "."SET NAMES "._q($charset), _LOG_DEBUG); |
|
| 169 | 169 | |
| 170 | - return mysqli_query($connexion['link'], $connexion['last'] = "SET NAMES " . _q($charset)); |
|
| 170 | + return mysqli_query($connexion['link'], $connexion['last'] = "SET NAMES "._q($charset)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | function spip_mysql_get_charset($charset = array(), $serveur = '', $requeter = true) { |
| 183 | 183 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 184 | 184 | $connexion['last'] = $c = "SHOW CHARACTER SET" |
| 185 | - . (!$charset ? '' : (" LIKE " . _q($charset['charset']))); |
|
| 185 | + . (!$charset ? '' : (" LIKE "._q($charset['charset']))); |
|
| 186 | 186 | |
| 187 | 187 | return spip_mysql_fetch(mysqli_query($connexion['link'], $c), null, $serveur); |
| 188 | 188 | } |
@@ -242,19 +242,19 @@ discard block |
||
| 242 | 242 | $debug = ''; |
| 243 | 243 | if (defined('_DEBUG_SLOW_QUERIES') and _DEBUG_SLOW_QUERIES) { |
| 244 | 244 | if (isset($GLOBALS['debug']['aucasou'])) { |
| 245 | - list(, $id, , $infos) = $GLOBALS['debug']['aucasou']; |
|
| 246 | - $debug .= "BOUCLE$id @ " . (isset($infos[0]) ? $infos[0] : '') . " | "; |
|
| 245 | + list(, $id,, $infos) = $GLOBALS['debug']['aucasou']; |
|
| 246 | + $debug .= "BOUCLE$id @ ".(isset($infos[0]) ? $infos[0] : '')." | "; |
|
| 247 | 247 | } |
| 248 | 248 | if (isset($_SERVER['REQUEST_URI'])) { |
| 249 | 249 | $debug .= $_SERVER['REQUEST_URI']; |
| 250 | 250 | } |
| 251 | 251 | if (!empty($GLOBALS['ip'])) { |
| 252 | - $debug .= ' + ' . $GLOBALS['ip']; |
|
| 252 | + $debug .= ' + '.$GLOBALS['ip']; |
|
| 253 | 253 | } |
| 254 | - $debug = ' /* ' . mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)) . ' */'; |
|
| 254 | + $debug = ' /* '.mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)).' */'; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - $r = mysqli_query($link, $query . $debug); |
|
| 257 | + $r = mysqli_query($link, $query.$debug); |
|
| 258 | 258 | |
| 259 | 259 | //Eviter de propager le GoneAway sur les autres requetes d'un même processus PHP |
| 260 | 260 | if ($e = spip_mysql_errno($serveur)) { // Log d'un Gone Away |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 268 | 268 | $link = $connexion['link']; |
| 269 | 269 | //On retente au cas où |
| 270 | - $r = mysqli_query($link, $query . $debug); |
|
| 270 | + $r = mysqli_query($link, $query.$debug); |
|
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | // d'utiliser ceux-ci, copie-colle de phpmyadmin |
| 296 | 296 | $query = preg_replace(",^TABLE\s*`([^`]*)`,i", "TABLE \\1", $query); |
| 297 | 297 | |
| 298 | - return spip_mysql_query("ALTER " . $query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 298 | + return spip_mysql_query("ALTER ".$query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | * @return bool Toujours true |
| 309 | 309 | */ |
| 310 | 310 | function spip_mysql_optimize($table, $serveur = '', $requeter = true) { |
| 311 | - spip_mysql_query("OPTIMIZE TABLE " . $table); |
|
| 311 | + spip_mysql_query("OPTIMIZE TABLE ".$table); |
|
| 312 | 312 | |
| 313 | 313 | return true; |
| 314 | 314 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $link = $connexion['link']; |
| 332 | 332 | $db = $connexion['db']; |
| 333 | 333 | |
| 334 | - $query = 'EXPLAIN ' . _mysql_traite_query($query, $db, $prefixe); |
|
| 334 | + $query = 'EXPLAIN '._mysql_traite_query($query, $db, $prefixe); |
|
| 335 | 335 | $r = mysqli_query($link, $query); |
| 336 | 336 | |
| 337 | 337 | return spip_mysql_fetch($r, null, $serveur); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | . calculer_mysql_expression('WHERE', $where) |
| 383 | 383 | . calculer_mysql_expression('GROUP BY', $groupby, ',') |
| 384 | 384 | . calculer_mysql_expression('HAVING', $having) |
| 385 | - . ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) : '') |
|
| 385 | + . ($orderby ? ("\nORDER BY ".spip_mysql_order($orderby)) : '') |
|
| 386 | 386 | . ($limit ? "\nLIMIT $limit" : ''); |
| 387 | 387 | |
| 388 | 388 | // renvoyer la requete inerte si demandee |
@@ -472,12 +472,12 @@ discard block |
||
| 472 | 472 | $exp = "\n$expression "; |
| 473 | 473 | |
| 474 | 474 | if (!is_array($v)) { |
| 475 | - return $exp . $v; |
|
| 475 | + return $exp.$v; |
|
| 476 | 476 | } else { |
| 477 | 477 | if (strtoupper($join) === 'AND') { |
| 478 | - return $exp . join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 478 | + return $exp.join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 479 | 479 | } else { |
| 480 | - return $exp . join($join, $v); |
|
| 480 | + return $exp.join($join, $v); |
|
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | } |
@@ -495,17 +495,17 @@ discard block |
||
| 495 | 495 | if (substr($k, -1) == '@') { |
| 496 | 496 | // c'est une jointure qui se refere au from precedent |
| 497 | 497 | // pas de virgule |
| 498 | - $res .= ' ' . $v; |
|
| 498 | + $res .= ' '.$v; |
|
| 499 | 499 | } else { |
| 500 | 500 | if (!is_numeric($k)) { |
| 501 | 501 | $p = strpos($v, " "); |
| 502 | 502 | if ($p) { |
| 503 | - $v = substr($v, 0, $p) . " AS `$k`" . substr($v, $p); |
|
| 503 | + $v = substr($v, 0, $p)." AS `$k`".substr($v, $p); |
|
| 504 | 504 | } else { |
| 505 | 505 | $v .= " AS `$k`"; |
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | - $res .= ', ' . $v; |
|
| 508 | + $res .= ', '.$v; |
|
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | |
@@ -534,13 +534,13 @@ discard block |
||
| 534 | 534 | function _mysql_traite_query($query, $db = '', $prefixe = '') { |
| 535 | 535 | |
| 536 | 536 | if ($GLOBALS['mysql_rappel_nom_base'] and $db) { |
| 537 | - $pref = '`' . $db . '`.'; |
|
| 537 | + $pref = '`'.$db.'`.'; |
|
| 538 | 538 | } else { |
| 539 | 539 | $pref = ''; |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | if ($prefixe) { |
| 543 | - $pref .= $prefixe . "_"; |
|
| 543 | + $pref .= $prefixe."_"; |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | if (!preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) { |
@@ -554,12 +554,12 @@ discard block |
||
| 554 | 554 | if (stripos($suite, "SELECT") !== false) { |
| 555 | 555 | list($suite, $textes) = query_echappe_textes($suite); |
| 556 | 556 | if (preg_match('/^(.*?)([(]\s*SELECT\b.*)$/si', $suite, $r)) { |
| 557 | - $suite = $r[1] . _mysql_traite_query($r[2], $db, $prefixe); |
|
| 557 | + $suite = $r[1]._mysql_traite_query($r[2], $db, $prefixe); |
|
| 558 | 558 | } |
| 559 | 559 | $suite = query_reinjecte_textes($suite, $textes); |
| 560 | 560 | } |
| 561 | 561 | } |
| 562 | - $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1' . $pref, $query) . $suite; |
|
| 562 | + $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1'.$pref, $query).$suite; |
|
| 563 | 563 | |
| 564 | 564 | // en option, remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
| 565 | 565 | // remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | $link = _mysql_link($serveur); |
| 594 | 594 | $ok = mysqli_select_db($link, $db); |
| 595 | 595 | if (!$ok) { |
| 596 | - spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE); |
|
| 596 | + spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE); |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | return $ok; |
@@ -683,10 +683,10 @@ discard block |
||
| 683 | 683 | |
| 684 | 684 | $character_set = ""; |
| 685 | 685 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 686 | - $character_set .= " CHARACTER SET " . $GLOBALS['meta']['charset_sql_base']; |
|
| 686 | + $character_set .= " CHARACTER SET ".$GLOBALS['meta']['charset_sql_base']; |
|
| 687 | 687 | } |
| 688 | 688 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 689 | - $character_set .= " COLLATE " . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 689 | + $character_set .= " COLLATE ".$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | foreach ($champs as $k => $v) { |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | if (preg_match(',(char|text),i', $defs[1]) |
| 696 | 696 | and !preg_match(',(binary|CHARACTER|COLLATE),i', $v) |
| 697 | 697 | ) { |
| 698 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 698 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | $s = ","; |
| 708 | 708 | } |
| 709 | 709 | $temporary = $temporary ? 'TEMPORARY' : ''; |
| 710 | - $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ")" |
|
| 710 | + $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').")" |
|
| 711 | 711 | . " ENGINE=MyISAM" |
| 712 | 712 | . ($character_set ? " DEFAULT $character_set" : "") |
| 713 | 713 | . "\n"; |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | return false; |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 790 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 791 | 791 | |
| 792 | 792 | return spip_mysql_query($query, $serveur, $requeter); |
| 793 | 793 | } |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | * Ressource à utiliser avec sql_fetch() |
| 846 | 846 | **/ |
| 847 | 847 | function spip_mysql_showbase($match, $serveur = '', $requeter = true) { |
| 848 | - return spip_mysql_query("SHOW TABLES LIKE " . _q($match), $serveur, $requeter); |
|
| 848 | + return spip_mysql_query("SHOW TABLES LIKE "._q($match), $serveur, $requeter); |
|
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | /** |
@@ -939,22 +939,22 @@ discard block |
||
| 939 | 939 | } |
| 940 | 940 | if ($val['Default'] === '0' || $val['Default']) { |
| 941 | 941 | if (preg_match('/[A-Z_]/', $val['Default'])) { |
| 942 | - $nfields[$val["Field"]] .= ' DEFAULT ' . $val['Default']; |
|
| 942 | + $nfields[$val["Field"]] .= ' DEFAULT '.$val['Default']; |
|
| 943 | 943 | } else { |
| 944 | - $nfields[$val["Field"]] .= " DEFAULT '" . $val['Default'] . "'"; |
|
| 944 | + $nfields[$val["Field"]] .= " DEFAULT '".$val['Default']."'"; |
|
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | 947 | if ($val['Extra']) { |
| 948 | - $nfields[$val["Field"]] .= ' ' . $val['Extra']; |
|
| 948 | + $nfields[$val["Field"]] .= ' '.$val['Extra']; |
|
| 949 | 949 | } |
| 950 | 950 | if ($val['Key'] == 'PRI') { |
| 951 | 951 | $nkeys['PRIMARY KEY'] = $val["Field"]; |
| 952 | 952 | } else { |
| 953 | 953 | if ($val['Key'] == 'MUL') { |
| 954 | - $nkeys['KEY ' . $val["Field"]] = $val["Field"]; |
|
| 954 | + $nkeys['KEY '.$val["Field"]] = $val["Field"]; |
|
| 955 | 955 | } else { |
| 956 | 956 | if ($val['Key'] == 'UNI') { |
| 957 | - $nkeys['UNIQUE KEY ' . $val["Field"]] = $val["Field"]; |
|
| 957 | + $nkeys['UNIQUE KEY '.$val["Field"]] = $val["Field"]; |
|
| 958 | 958 | } |
| 959 | 959 | } |
| 960 | 960 | } |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | $serveur = '', |
| 1026 | 1026 | $requeter = true |
| 1027 | 1027 | ) { |
| 1028 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1028 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1029 | 1029 | |
| 1030 | 1030 | $r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 1031 | 1031 | if (!$requeter) { |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | if ($s) { |
| 1066 | 1066 | $trace = debug_backtrace(); |
| 1067 | 1067 | if ($trace[0]['function'] != "spip_mysql_error") { |
| 1068 | - spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR); |
|
| 1068 | + spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR); |
|
| 1069 | 1069 | } |
| 1070 | 1070 | } |
| 1071 | 1071 | |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1233 | 1233 | } |
| 1234 | 1234 | |
| 1235 | - return spip_mysql_insert($table, "(" . join(',', array_keys($couples)) . ")", "(" . join(',', $couples) . ")", $desc, |
|
| 1235 | + return spip_mysql_insert($table, "(".join(',', array_keys($couples)).")", "(".join(',', $couples).")", $desc, |
|
| 1236 | 1236 | $serveur, $requeter); |
| 1237 | 1237 | } |
| 1238 | 1238 | |
@@ -1266,7 +1266,7 @@ discard block |
||
| 1266 | 1266 | } |
| 1267 | 1267 | $fields = isset($desc['field']) ? $desc['field'] : array(); |
| 1268 | 1268 | |
| 1269 | - $cles = "(" . join(',', array_keys(reset($tab_couples))) . ')'; |
|
| 1269 | + $cles = "(".join(',', array_keys(reset($tab_couples))).')'; |
|
| 1270 | 1270 | $valeurs = array(); |
| 1271 | 1271 | $r = false; |
| 1272 | 1272 | |
@@ -1275,7 +1275,7 @@ discard block |
||
| 1275 | 1275 | foreach ($couples as $champ => $val) { |
| 1276 | 1276 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1277 | 1277 | } |
| 1278 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1278 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1279 | 1279 | if (count($valeurs) >= 100) { |
| 1280 | 1280 | $r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter); |
| 1281 | 1281 | $valeurs = array(); |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | function spip_mysql_update($table, $champs, $where = '', $desc = array(), $serveur = '', $requeter = true) { |
| 1313 | 1313 | $set = array(); |
| 1314 | 1314 | foreach ($champs as $champ => $val) { |
| 1315 | - $set[] = $champ . "=$val"; |
|
| 1315 | + $set[] = $champ."=$val"; |
|
| 1316 | 1316 | } |
| 1317 | 1317 | if (!empty($set)) { |
| 1318 | 1318 | return spip_mysql_query( |
@@ -1366,7 +1366,7 @@ discard block |
||
| 1366 | 1366 | } |
| 1367 | 1367 | $set = array(); |
| 1368 | 1368 | foreach ($champs as $champ => $val) { |
| 1369 | - $set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]); |
|
| 1369 | + $set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]); |
|
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | 1372 | return spip_mysql_query( |
@@ -1431,8 +1431,8 @@ discard block |
||
| 1431 | 1431 | * - False en cas d'erreur. |
| 1432 | 1432 | **/ |
| 1433 | 1433 | function spip_mysql_replace($table, $couples, $desc = array(), $serveur = '', $requeter = true) { |
| 1434 | - return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join(',', |
|
| 1435 | - array_map('_q', $couples)) . ')', $serveur, $requeter); |
|
| 1434 | + return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join(',', |
|
| 1435 | + array_map('_q', $couples)).')', $serveur, $requeter); |
|
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | |
@@ -1461,10 +1461,10 @@ discard block |
||
| 1461 | 1461 | * - False en cas d'erreur. |
| 1462 | 1462 | **/ |
| 1463 | 1463 | function spip_mysql_replace_multi($table, $tab_couples, $desc = array(), $serveur = '', $requeter = true) { |
| 1464 | - $cles = "(" . join(',', array_keys($tab_couples[0])) . ')'; |
|
| 1464 | + $cles = "(".join(',', array_keys($tab_couples[0])).')'; |
|
| 1465 | 1465 | $valeurs = array(); |
| 1466 | 1466 | foreach ($tab_couples as $couples) { |
| 1467 | - $valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')'; |
|
| 1467 | + $valeurs[] = '('.join(',', array_map('_q', $couples)).')'; |
|
| 1468 | 1468 | } |
| 1469 | 1469 | $valeurs = implode(', ', $valeurs); |
| 1470 | 1470 | |
@@ -1484,28 +1484,28 @@ discard block |
||
| 1484 | 1484 | */ |
| 1485 | 1485 | function spip_mysql_multi($objet, $lang) { |
| 1486 | 1486 | $lengthlang = strlen("[$lang]"); |
| 1487 | - $posmulti = "INSTR(" . $objet . ", '<multi>')"; |
|
| 1488 | - $posfinmulti = "INSTR(" . $objet . ", '</multi>')"; |
|
| 1489 | - $debutchaine = "LEFT(" . $objet . ", $posmulti-1)"; |
|
| 1490 | - $finchaine = "RIGHT(" . $objet . ", CHAR_LENGTH(" . $objet . ") -(7+$posfinmulti))"; |
|
| 1491 | - $chainemulti = "TRIM(SUBSTRING(" . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1492 | - $poslang = "INSTR($chainemulti,'[" . $lang . "]')"; |
|
| 1487 | + $posmulti = "INSTR(".$objet.", '<multi>')"; |
|
| 1488 | + $posfinmulti = "INSTR(".$objet.", '</multi>')"; |
|
| 1489 | + $debutchaine = "LEFT(".$objet.", $posmulti-1)"; |
|
| 1490 | + $finchaine = "RIGHT(".$objet.", CHAR_LENGTH(".$objet.") -(7+$posfinmulti))"; |
|
| 1491 | + $chainemulti = "TRIM(SUBSTRING(".$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1492 | + $poslang = "INSTR($chainemulti,'[".$lang."]')"; |
|
| 1493 | 1493 | $poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)"; |
| 1494 | - $chainelang = "TRIM(SUBSTRING(" . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1495 | - $posfinlang = "INSTR(" . $chainelang . ", '[')"; |
|
| 1494 | + $chainelang = "TRIM(SUBSTRING(".$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1495 | + $posfinlang = "INSTR(".$chainelang.", '[')"; |
|
| 1496 | 1496 | $chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)"; |
| 1497 | 1497 | //$chainelang = "LEFT($chainelang,$posfinlang-1)"; |
| 1498 | - $retour = "(TRIM(IF($posmulti = 0 , " . |
|
| 1499 | - " TRIM(" . $objet . "), " . |
|
| 1500 | - " CONCAT( " . |
|
| 1501 | - " $debutchaine, " . |
|
| 1502 | - " IF( " . |
|
| 1503 | - " $poslang = 0, " . |
|
| 1504 | - " $chainemulti, " . |
|
| 1505 | - " $chainelang" . |
|
| 1506 | - " ), " . |
|
| 1507 | - " $finchaine" . |
|
| 1508 | - " ) " . |
|
| 1498 | + $retour = "(TRIM(IF($posmulti = 0 , ". |
|
| 1499 | + " TRIM(".$objet."), ". |
|
| 1500 | + " CONCAT( ". |
|
| 1501 | + " $debutchaine, ". |
|
| 1502 | + " IF( ". |
|
| 1503 | + " $poslang = 0, ". |
|
| 1504 | + " $chainemulti, ". |
|
| 1505 | + " $chainelang". |
|
| 1506 | + " ), ". |
|
| 1507 | + " $finchaine". |
|
| 1508 | + " ) ". |
|
| 1509 | 1509 | "))) AS multi"; |
| 1510 | 1510 | |
| 1511 | 1511 | return $retour; |
@@ -1522,7 +1522,7 @@ discard block |
||
| 1522 | 1522 | * Valeur hexadécimale pour MySQL |
| 1523 | 1523 | **/ |
| 1524 | 1524 | function spip_mysql_hex($v) { |
| 1525 | - return "0x" . $v; |
|
| 1525 | + return "0x".$v; |
|
| 1526 | 1526 | } |
| 1527 | 1527 | |
| 1528 | 1528 | /** |
@@ -1562,7 +1562,7 @@ discard block |
||
| 1562 | 1562 | * Expression SQL |
| 1563 | 1563 | **/ |
| 1564 | 1564 | function spip_mysql_date_proche($champ, $interval, $unite) { |
| 1565 | - $use_now = ( ($champ === 'maj' or strpos($champ, '.maj')) ? true : false ); |
|
| 1565 | + $use_now = (($champ === 'maj' or strpos($champ, '.maj')) ? true : false); |
|
| 1566 | 1566 | return '(' |
| 1567 | 1567 | . $champ |
| 1568 | 1568 | . (($interval <= 0) ? '>' : '<') |
@@ -1616,7 +1616,7 @@ discard block |
||
| 1616 | 1616 | elseif (is_numeric($v)) { |
| 1617 | 1617 | return strval($v); |
| 1618 | 1618 | } |
| 1619 | - return "'" . addslashes($v) . "'"; |
|
| 1619 | + return "'".addslashes($v)."'"; |
|
| 1620 | 1620 | } |
| 1621 | 1621 | |
| 1622 | 1622 | if (is_null($v) |
@@ -1638,7 +1638,7 @@ discard block |
||
| 1638 | 1638 | } |
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | - return ("'" . addslashes($v) . "'"); |
|
| 1641 | + return ("'".addslashes($v)."'"); |
|
| 1642 | 1642 | } |
| 1643 | 1643 | |
| 1644 | 1644 | |
@@ -1667,9 +1667,9 @@ discard block |
||
| 1667 | 1667 | $connexion = &$GLOBALS['connexions'][0]; |
| 1668 | 1668 | $bd = $connexion['db']; |
| 1669 | 1669 | $prefixe = $connexion['prefixe']; |
| 1670 | - $nom = "$bd:$prefixe:$nom" . _LOCK_TIME; |
|
| 1670 | + $nom = "$bd:$prefixe:$nom"._LOCK_TIME; |
|
| 1671 | 1671 | |
| 1672 | - $connexion['last'] = $q = "SELECT GET_LOCK(" . _q($nom) . ", $timeout) AS n"; |
|
| 1672 | + $connexion['last'] = $q = "SELECT GET_LOCK("._q($nom).", $timeout) AS n"; |
|
| 1673 | 1673 | |
| 1674 | 1674 | $q = @sql_fetch(mysqli_query(_mysql_link(), $q)); |
| 1675 | 1675 | if (!$q) { |
@@ -1696,9 +1696,9 @@ discard block |
||
| 1696 | 1696 | $connexion = &$GLOBALS['connexions'][0]; |
| 1697 | 1697 | $bd = $connexion['db']; |
| 1698 | 1698 | $prefixe = $connexion['prefixe']; |
| 1699 | - $nom = "$bd:$prefixe:$nom" . _LOCK_TIME; |
|
| 1699 | + $nom = "$bd:$prefixe:$nom"._LOCK_TIME; |
|
| 1700 | 1700 | |
| 1701 | - $connexion['last'] = $q = "SELECT RELEASE_LOCK(" . _q($nom) . ")"; |
|
| 1701 | + $connexion['last'] = $q = "SELECT RELEASE_LOCK("._q($nom).")"; |
|
| 1702 | 1702 | mysqli_query(_mysql_link(), $q); |
| 1703 | 1703 | } |
| 1704 | 1704 | |
@@ -1734,7 +1734,7 @@ discard block |
||
| 1734 | 1734 | } else { |
| 1735 | 1735 | $GLOBALS['mysql_rappel_nom_base'] = false; |
| 1736 | 1736 | |
| 1737 | - return "\$GLOBALS['mysql_rappel_nom_base'] = false; " . |
|
| 1737 | + return "\$GLOBALS['mysql_rappel_nom_base'] = false; ". |
|
| 1738 | 1738 | "/* echec de test_rappel_nom_base_mysql a l'installation. */\n"; |
| 1739 | 1739 | } |
| 1740 | 1740 | } |
@@ -50,11 +50,9 @@ discard block |
||
| 50 | 50 | $port and !is_numeric($socket = $port) |
| 51 | 51 | and (!$host or $host=='localhost')) { |
| 52 | 52 | $link = @mysqli_connect($host, $login, $pass, '', null, $socket); |
| 53 | - } |
|
| 54 | - elseif ($port) { |
|
| 53 | + } elseif ($port) { |
|
| 55 | 54 | $link = @mysqli_connect($host, $login, $pass, '', $port); |
| 56 | - } |
|
| 57 | - else { |
|
| 55 | + } else { |
|
| 58 | 56 | $link = @mysqli_connect($host, $login, $pass); |
| 59 | 57 | } |
| 60 | 58 | |
@@ -1612,8 +1610,7 @@ discard block |
||
| 1612 | 1610 | if (!$type) { |
| 1613 | 1611 | if (is_bool($v)) { |
| 1614 | 1612 | return strval(intval($v)); |
| 1615 | - } |
|
| 1616 | - elseif (is_numeric($v)) { |
|
| 1613 | + } elseif (is_numeric($v)) { |
|
| 1617 | 1614 | return strval($v); |
| 1618 | 1615 | } |
| 1619 | 1616 | return "'" . addslashes($v) . "'"; |
@@ -2000,8 +2000,7 @@ |
||
| 2000 | 2000 | // si on ne connait pas le type on le deduit de $v autant que possible |
| 2001 | 2001 | if (is_bool($v)) { |
| 2002 | 2002 | return strval(intval($v)); |
| 2003 | - } |
|
| 2004 | - elseif (is_numeric($v)) { |
|
| 2003 | + } elseif (is_numeric($v)) { |
|
| 2005 | 2004 | return strval($v); |
| 2006 | 2005 | } |
| 2007 | 2006 | } |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | if ($compil_info) { |
| 55 | 55 | $contexte_compil = array( |
| 56 | - $trace[0]['file'],// sourcefile |
|
| 56 | + $trace[0]['file'], // sourcefile |
|
| 57 | 57 | '', //nom |
| 58 | - (isset($trace[1]) ? $trace[1]['function'] . "(){\n" : '') |
|
| 59 | - . $trace[0]['function'] . "();" |
|
| 58 | + (isset($trace[1]) ? $trace[1]['function']."(){\n" : '') |
|
| 59 | + . $trace[0]['function']."();" |
|
| 60 | 60 | . (isset($trace[1]) ? "\n}" : ''), //id_boucle |
| 61 | 61 | $trace[0]['line'], // ligne |
| 62 | 62 | $GLOBALS['spip_lang'], // lang |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | return $contexte_compil; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $message = count($trace) ? $trace[0]['file'] . " L" . $trace[0]['line'] : ""; |
|
| 68 | + $message = count($trace) ? $trace[0]['file']." L".$trace[0]['line'] : ""; |
|
| 69 | 69 | $f = array(); |
| 70 | 70 | while (count($trace) and $t = array_shift($trace)) { |
| 71 | 71 | if (in_array($t['function'], array('include_once', 'include_spip', 'find_in_path'))) { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $f[] = $t['function']; |
| 75 | 75 | } |
| 76 | 76 | if (count($f)) { |
| 77 | - $message .= " [" . implode("(),", $f) . "()]"; |
|
| 77 | + $message .= " [".implode("(),", $f)."()]"; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return $message; |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | } |
| 256 | 256 | // le debug, c'est pour ce qui a ete produit par le compilateur |
| 257 | 257 | if (isset($GLOBALS['debug']['aucasou'])) { |
| 258 | - list($table, $id, ) = $GLOBALS['debug']['aucasou']; |
|
| 259 | - $nom = $GLOBALS['debug_objets']['courant'] . $id; |
|
| 258 | + list($table, $id,) = $GLOBALS['debug']['aucasou']; |
|
| 259 | + $nom = $GLOBALS['debug_objets']['courant'].$id; |
|
| 260 | 260 | $GLOBALS['debug_objets']['requete'][$nom] = $query; |
| 261 | 261 | } |
| 262 | 262 | $res = $f($select, $from, $where, $groupby, $orderby, $limit, $having, $serveur, true); |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | // la globale n'est remplie qu'apres l'appel de sql_serveur. |
| 1134 | 1134 | if ($spip == null) { |
| 1135 | 1135 | $connexion = $GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 1136 | - $spip = $connexion['prefixe'] . '\_%'; |
|
| 1136 | + $spip = $connexion['prefixe'].'\_%'; |
|
| 1137 | 1137 | } |
| 1138 | 1138 | |
| 1139 | 1139 | return $f($spip, $serveur, $option !== false); |
@@ -2017,7 +2017,7 @@ discard block |
||
| 2017 | 2017 | function sql_in($val, $valeurs, $not = '', $serveur = '', $option = true) { |
| 2018 | 2018 | if (!is_array($valeurs)) { |
| 2019 | 2019 | $valeurs = strval($valeurs); |
| 2020 | - if(isset($valeurs[0]) and $valeurs[0] === ',') { |
|
| 2020 | + if (isset($valeurs[0]) and $valeurs[0] === ',') { |
|
| 2021 | 2021 | $valeurs = substr($valeurs, 1); |
| 2022 | 2022 | } |
| 2023 | 2023 | // on explode en tableau pour pouvoir securiser le contenu |
@@ -2028,7 +2028,7 @@ discard block |
||
| 2028 | 2028 | return false; |
| 2029 | 2029 | } |
| 2030 | 2030 | // sql_quote produit une chaine dans tous les cas |
| 2031 | - $valeurs = array_filter($valeurs, function ($v) { return !is_array($v);}); |
|
| 2031 | + $valeurs = array_filter($valeurs, function($v) { return !is_array($v); }); |
|
| 2032 | 2032 | $valeurs = array_unique($valeurs); |
| 2033 | 2033 | $valeurs = $f($valeurs); |
| 2034 | 2034 | |
@@ -2223,9 +2223,9 @@ discard block |
||
| 2223 | 2223 | $jour = 0; |
| 2224 | 2224 | } |
| 2225 | 2225 | |
| 2226 | - return sprintf("%04u", $annee) . '-' . sprintf("%02u", $mois) . '-' |
|
| 2227 | - . sprintf("%02u", $jour) . ' ' . sprintf("%02u", $h) . ':' |
|
| 2228 | - . sprintf("%02u", $m) . ':' . sprintf("%02u", $s); |
|
| 2226 | + return sprintf("%04u", $annee).'-'.sprintf("%02u", $mois).'-' |
|
| 2227 | + . sprintf("%02u", $jour).' '.sprintf("%02u", $h).':' |
|
| 2228 | + . sprintf("%02u", $m).':'.sprintf("%02u", $s); |
|
| 2229 | 2229 | } |
| 2230 | 2230 | |
| 2231 | 2231 | |
@@ -2287,7 +2287,7 @@ discard block |
||
| 2287 | 2287 | */ |
| 2288 | 2288 | function prefixer_table_spip($table, $prefixe) { |
| 2289 | 2289 | if ($prefixe) { |
| 2290 | - $table = preg_replace('/^spip_/', $prefixe . '_', $table); |
|
| 2290 | + $table = preg_replace('/^spip_/', $prefixe.'_', $table); |
|
| 2291 | 2291 | } |
| 2292 | 2292 | return $table; |
| 2293 | 2293 | } |
| 2294 | 2294 | \ No newline at end of file |