@@ -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 | } |
| 298 | 298 | |
@@ -389,11 +389,11 @@ discard block |
||
| 389 | 389 | } elseif (is_array($a)) { |
| 390 | 390 | return join(',', array_map('_q', $a)); |
| 391 | 391 | } elseif (is_scalar($a)) { |
| 392 | - return ("'" . addslashes($a) . "'"); |
|
| 392 | + return ("'".addslashes($a)."'"); |
|
| 393 | 393 | } elseif ($a === null) { |
| 394 | 394 | return "''"; |
| 395 | 395 | } |
| 396 | - throw new \RuntimeException("Can’t use _q with " . gettype($a)); |
|
| 396 | + throw new \RuntimeException("Can’t use _q with ".gettype($a)); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -436,14 +436,14 @@ discard block |
||
| 436 | 436 | $parts = []; |
| 437 | 437 | $currentpos = 0; |
| 438 | 438 | $k = 0; |
| 439 | - while(count($textes)) { |
|
| 439 | + while (count($textes)) { |
|
| 440 | 440 | $part = array_shift($textes); |
| 441 | 441 | $nextpos = strpos($query_echappees, $part, $currentpos); |
| 442 | 442 | // si besoin recoller ensemble les doubles '' de sqlite (echappement des ') |
| 443 | 443 | while (count($textes) and substr($part, -1) === "'") { |
| 444 | 444 | $next = reset($textes); |
| 445 | 445 | if (strpos($next, "'") === 0 |
| 446 | - and strpos($query_echappees, $part . $next, $currentpos) === $nextpos) { |
|
| 446 | + and strpos($query_echappees, $part.$next, $currentpos) === $nextpos) { |
|
| 447 | 447 | $part .= array_shift($textes); |
| 448 | 448 | } |
| 449 | 449 | else { |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | // et on replace les parts une par une en commencant par la fin |
| 463 | - while ($k>0) { |
|
| 463 | + while ($k > 0) { |
|
| 464 | 464 | $query_echappees = substr_replace($query_echappees, $parts[$k]['placeholder'], $parts[$k]['position'], strlen($parts[$k]['texte'])); |
| 465 | 465 | $k--; |
| 466 | 466 | } |