@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | static $dirs = []; |
| 44 | 44 | $liste = []; |
| 45 | 45 | foreach (creer_chemin() as $dir) { |
| 46 | - if (!isset($dirs[$a = $dir . $dirname])) { |
|
| 46 | + if (!isset($dirs[$a = $dir.$dirname])) { |
|
| 47 | 47 | $dirs[$a] = (is_dir($a) || !$a); |
| 48 | 48 | } |
| 49 | 49 | if ($dirs[$a]) { |
@@ -69,21 +69,21 @@ discard block |
||
| 69 | 69 | **/ |
| 70 | 70 | function chercher_module_lang($module, $lang = '') { |
| 71 | 71 | if ($lang) { |
| 72 | - $lang = '_' . $lang; |
|
| 72 | + $lang = '_'.$lang; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // 1) dans un repertoire nomme lang/ se trouvant sur le chemin |
| 76 | 76 | if ( |
| 77 | 77 | $f = ($module == 'local' |
| 78 | - ? find_in_path($module . $lang . '.php', 'lang/') |
|
| 79 | - : find_langs_in_path($module . $lang . '.php', 'lang/')) |
|
| 78 | + ? find_in_path($module.$lang.'.php', 'lang/') |
|
| 79 | + : find_langs_in_path($module.$lang.'.php', 'lang/')) |
|
| 80 | 80 | ) { |
| 81 | 81 | return is_array($f) ? $f : [$f]; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // 2) directement dans le chemin (old style, uniquement pour local) |
| 85 | 85 | return (($module == 'local') or strpos($module, '/')) |
| 86 | - ? (($f = find_in_path($module . $lang . '.php')) ? [$f] : false) |
|
| 86 | + ? (($f = find_in_path($module.$lang.'.php')) ? [$f] : false) |
|
| 87 | 87 | : false; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | **/ |
| 108 | 108 | function charger_langue($lang, $module = 'spip') { |
| 109 | 109 | static $langs = []; |
| 110 | - $var = 'i18n_' . $module . '_' . $lang; |
|
| 110 | + $var = 'i18n_'.$module.'_'.$lang; |
|
| 111 | 111 | if (!isset($langs[$lang])) { |
| 112 | 112 | $langs[$lang] = []; |
| 113 | 113 | if ($lang) { |
@@ -122,13 +122,13 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | foreach ($langs[$lang] as $l) { |
| 124 | 124 | if ($fichiers_lang = chercher_module_lang($module, $l)) { |
| 125 | - $GLOBALS['idx_lang'] = 'i18n_' . $module . '_' . $l; |
|
| 125 | + $GLOBALS['idx_lang'] = 'i18n_'.$module.'_'.$l; |
|
| 126 | 126 | $GLOBALS[$GLOBALS['idx_lang']] = lire_fichier_langue(array_shift($fichiers_lang)); |
| 127 | 127 | surcharger_langue($fichiers_lang); |
| 128 | 128 | if ($l !== $lang) { |
| 129 | - $GLOBALS[$var] = &$GLOBALS['i18n_' . $module . '_' . $l]; |
|
| 129 | + $GLOBALS[$var] = &$GLOBALS['i18n_'.$module.'_'.$l]; |
|
| 130 | 130 | } |
| 131 | - $GLOBALS['lang_' . $var] = $l; |
|
| 131 | + $GLOBALS['lang_'.$var] = $l; |
|
| 132 | 132 | #spip_log("module de langue : {$module}_$l.php", 'traduire'); |
| 133 | 133 | break; |
| 134 | 134 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | function lire_fichier_langue(string $fichier): array { |
| 148 | 148 | $idx_lang_before = $GLOBALS['idx_lang'] ?? null; |
| 149 | - $idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang') . '@temporaire'; |
|
| 149 | + $idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang').'@temporaire'; |
|
| 150 | 150 | $GLOBALS['idx_lang'] = $idx_lang_tmp; |
| 151 | 151 | $idx_lang = include $fichier; |
| 152 | 152 | $GLOBALS['idx_lang'] = $idx_lang_before; |
@@ -257,27 +257,27 @@ discard block |
||
| 257 | 257 | } else { |
| 258 | 258 | $modules = ['spip', 'ecrire']; |
| 259 | 259 | $code = $ori; |
| 260 | - $ori_complet = implode('|', $modules) . ':' . $ori; |
|
| 260 | + $ori_complet = implode('|', $modules).':'.$ori; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | $desc = new Description(); |
| 264 | 264 | |
| 265 | 265 | // parcourir tous les modules jusqu'a ce qu'on trouve |
| 266 | 266 | foreach ($modules as $module) { |
| 267 | - $var = 'i18n_' . $module . '_' . $lang; |
|
| 267 | + $var = 'i18n_'.$module.'_'.$lang; |
|
| 268 | 268 | |
| 269 | 269 | if (empty($GLOBALS[$var])) { |
| 270 | 270 | charger_langue($lang, $module); |
| 271 | 271 | // surcharges persos -- on cherche |
| 272 | 272 | // (lang/)local_xx.php et/ou (lang/)local.php ... |
| 273 | - if (!isset($local['local_' . $lang])) { |
|
| 273 | + if (!isset($local['local_'.$lang])) { |
|
| 274 | 274 | // redéfinir la langue en cours pour les surcharges (chercher_langue a pu le changer) |
| 275 | 275 | $GLOBALS['idx_lang'] = $var; |
| 276 | 276 | // ... (lang/)local_xx.php |
| 277 | - $local['local_' . $lang] = chercher_module_lang('local', $lang); |
|
| 277 | + $local['local_'.$lang] = chercher_module_lang('local', $lang); |
|
| 278 | 278 | } |
| 279 | - if ($local['local_' . $lang]) { |
|
| 280 | - surcharger_langue($local['local_' . $lang]); |
|
| 279 | + if ($local['local_'.$lang]) { |
|
| 280 | + surcharger_langue($local['local_'.$lang]); |
|
| 281 | 281 | } |
| 282 | 282 | // ... puis (lang/)local.php |
| 283 | 283 | if (!isset($local['local'])) { |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | if (isset($GLOBALS[$var][$code])) { |
| 292 | 292 | $desc->code = $code; |
| 293 | 293 | $desc->module = $module; |
| 294 | - $desc->langue = $GLOBALS['lang_' . $var] ?? $lang; |
|
| 294 | + $desc->langue = $GLOBALS['lang_'.$var] ?? $lang; |
|
| 295 | 295 | $desc->texte = $GLOBALS[$var][$code]; |
| 296 | 296 | break; |
| 297 | 297 | } |
@@ -349,13 +349,13 @@ discard block |
||
| 349 | 349 | if (!$desc->mode and $desc->texte) { |
| 350 | 350 | // ne pas modifier 2 fois l'affichage |
| 351 | 351 | $desc->mode = 'traduction'; |
| 352 | - $classe = 'debug-traduction' . ($desc->module == 'ecrire' ? '-prive' : ''); |
|
| 352 | + $classe = 'debug-traduction'.($desc->module == 'ecrire' ? '-prive' : ''); |
|
| 353 | 353 | $desc->texte = '<span ' |
| 354 | - . 'lang=' . $desc->langue |
|
| 355 | - . ' class=' . $classe |
|
| 356 | - . ' data-module=' . $desc->module |
|
| 357 | - . ' data-code=' . $desc->code |
|
| 358 | - . ' title=' . $modules . '(' . $desc->langue . ')>' |
|
| 354 | + . 'lang='.$desc->langue |
|
| 355 | + . ' class='.$classe |
|
| 356 | + . ' data-module='.$desc->module |
|
| 357 | + . ' data-code='.$desc->code |
|
| 358 | + . ' title='.$modules.'('.$desc->langue.')>' |
|
| 359 | 359 | . $desc->texte |
| 360 | 360 | . '</span>'; |
| 361 | 361 | $desc->texte = str_replace( |
@@ -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 | if (is_callable($f)) { |
| 102 | 102 | return $f; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | // affichage "GIT [master: abcdef]" |
| 232 | 232 | $commit = $desc['commit_short'] ?? $desc['commit']; |
| 233 | 233 | if ($desc['branch']) { |
| 234 | - $commit = $desc['branch'] . ': ' . $commit; |
|
| 234 | + $commit = $desc['branch'].': '.$commit; |
|
| 235 | 235 | } |
| 236 | 236 | return "{$desc['vcs']} [$commit]"; |
| 237 | 237 | } |
@@ -250,9 +250,9 @@ discard block |
||
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | // version installee par GIT |
| 253 | - if (lire_fichier($dir . '/.git/HEAD', $c)) { |
|
| 253 | + if (lire_fichier($dir.'/.git/HEAD', $c)) { |
|
| 254 | 254 | $currentHead = trim(substr($c, 4)); |
| 255 | - if (lire_fichier($dir . '/.git/' . $currentHead, $hash)) { |
|
| 255 | + if (lire_fichier($dir.'/.git/'.$currentHead, $hash)) { |
|
| 256 | 256 | return [ |
| 257 | 257 | 'vcs' => 'GIT', |
| 258 | 258 | 'branch' => basename($currentHead), |
@@ -267,12 +267,12 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | // La matrice est necessaire pour ne filtrer _que_ des fonctions definies dans filtres_images |
| 269 | 269 | // et laisser passer les fonctions personnelles baptisees image_... |
| 270 | -$GLOBALS['spip_matrice']['image_graver'] = true;//'inc/filtres_images_mini.php'; |
|
| 271 | -$GLOBALS['spip_matrice']['image_select'] = true;//'inc/filtres_images_mini.php'; |
|
| 272 | -$GLOBALS['spip_matrice']['image_reduire'] = true;//'inc/filtres_images_mini.php'; |
|
| 273 | -$GLOBALS['spip_matrice']['image_reduire_par'] = true;//'inc/filtres_images_mini.php'; |
|
| 274 | -$GLOBALS['spip_matrice']['image_passe_partout'] = true;//'inc/filtres_images_mini.php'; |
|
| 275 | -$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true;//'inc/filtres_images_mini.php'; |
|
| 270 | +$GLOBALS['spip_matrice']['image_graver'] = true; //'inc/filtres_images_mini.php'; |
|
| 271 | +$GLOBALS['spip_matrice']['image_select'] = true; //'inc/filtres_images_mini.php'; |
|
| 272 | +$GLOBALS['spip_matrice']['image_reduire'] = true; //'inc/filtres_images_mini.php'; |
|
| 273 | +$GLOBALS['spip_matrice']['image_reduire_par'] = true; //'inc/filtres_images_mini.php'; |
|
| 274 | +$GLOBALS['spip_matrice']['image_passe_partout'] = true; //'inc/filtres_images_mini.php'; |
|
| 275 | +$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true; //'inc/filtres_images_mini.php'; |
|
| 276 | 276 | |
| 277 | 277 | $GLOBALS['spip_matrice']['couleur_html_to_hex'] = 'inc/filtres_images_mini.php'; |
| 278 | 278 | $GLOBALS['spip_matrice']['couleur_hex_to_hsl'] = 'inc/filtres_images_mini.php'; |
@@ -431,8 +431,8 @@ discard block |
||
| 431 | 431 | */ |
| 432 | 432 | function filtre_debug($val, $key = null) { |
| 433 | 433 | $debug = ( |
| 434 | - is_null($key) ? '' : (var_export($key, true) . ' = ') |
|
| 435 | - ) . var_export($val, true); |
|
| 434 | + is_null($key) ? '' : (var_export($key, true).' = ') |
|
| 435 | + ).var_export($val, true); |
|
| 436 | 436 | |
| 437 | 437 | include_spip('inc/autoriser'); |
| 438 | 438 | if (autoriser('webmestre')) { |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | $is_file = false; |
| 489 | 489 | } |
| 490 | 490 | if ($is_file) { |
| 491 | - $is_local_file = function ($path) { |
|
| 491 | + $is_local_file = function($path) { |
|
| 492 | 492 | if (strpos($path, '?') !== false) { |
| 493 | 493 | $path = supprimer_timestamp($path); |
| 494 | 494 | // remove ?24px added by find_in_theme on .svg files |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | if ($mouseover = extraire_attribut($reduit, 'onmouseover')) { |
| 538 | 538 | if (preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match)) { |
| 539 | 539 | $srcover = $match[1]; |
| 540 | - $srcover_filter = $filtre("<img src='" . $match[1] . "' />", ...$args); |
|
| 540 | + $srcover_filter = $filtre("<img src='".$match[1]."' />", ...$args); |
|
| 541 | 541 | $srcover_filter = extraire_attribut($srcover_filter, 'src'); |
| 542 | 542 | $reduit = str_replace($srcover, $srcover_filter, $reduit); |
| 543 | 543 | } |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | // " -> " et tout ce genre de choses |
| 940 | 940 | $u = $GLOBALS['meta']['pcre_u']; |
| 941 | 941 | $texte = str_replace(' ', ' ', $texte); |
| 942 | - $texte = preg_replace('/\s{2,}/S' . $u, ' ', $texte); |
|
| 942 | + $texte = preg_replace('/\s{2,}/S'.$u, ' ', $texte); |
|
| 943 | 943 | // ne pas echapper les sinqle quotes car certains outils de syndication gerent mal |
| 944 | 944 | $texte = entites_html($texte, false, false); |
| 945 | 945 | // mais bien echapper les double quotes ! |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | return ''; |
| 1002 | 1002 | } |
| 1003 | 1003 | return preg_replace( |
| 1004 | - ',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S', |
|
| 1004 | + ',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S', |
|
| 1005 | 1005 | '', |
| 1006 | 1006 | $texte |
| 1007 | 1007 | ); |
@@ -1030,7 +1030,7 @@ discard block |
||
| 1030 | 1030 | if ( |
| 1031 | 1031 | $texte and |
| 1032 | 1032 | preg_match( |
| 1033 | - ',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S', |
|
| 1033 | + ',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S', |
|
| 1034 | 1034 | $texte, |
| 1035 | 1035 | $regs |
| 1036 | 1036 | ) |
@@ -1121,8 +1121,8 @@ discard block |
||
| 1121 | 1121 | **/ |
| 1122 | 1122 | function textebrut($texte) { |
| 1123 | 1123 | $u = $GLOBALS['meta']['pcre_u']; |
| 1124 | - $texte = preg_replace('/\s+/S' . $u, ' ', $texte); |
|
| 1125 | - $texte = preg_replace('/<(p|br)( [^>]*)?' . '>/iS', "\n\n", $texte); |
|
| 1124 | + $texte = preg_replace('/\s+/S'.$u, ' ', $texte); |
|
| 1125 | + $texte = preg_replace('/<(p|br)( [^>]*)?'.'>/iS', "\n\n", $texte); |
|
| 1126 | 1126 | $texte = preg_replace("/^\n+/", '', $texte); |
| 1127 | 1127 | $texte = preg_replace("/\n+$/", '', $texte); |
| 1128 | 1128 | $texte = preg_replace("/\n +/", "\n", $texte); |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | ) |
| 1157 | 1157 | ) { |
| 1158 | 1158 | foreach ($liens[0] as $a) { |
| 1159 | - $rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel'); |
|
| 1159 | + $rel = 'noopener noreferrer '.extraire_attribut($a, 'rel'); |
|
| 1160 | 1160 | $ablank = inserer_attribut($a, 'rel', $rel); |
| 1161 | 1161 | $ablank = inserer_attribut($ablank, 'target', '_blank'); |
| 1162 | 1162 | $texte = str_replace($a, $ablank, $texte); |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | foreach ($regs[0] as $a) { |
| 1182 | 1182 | $rel = extraire_attribut($a, 'rel') ?? ''; |
| 1183 | 1183 | if (strpos($rel, 'nofollow') === false) { |
| 1184 | - $rel = 'nofollow' . ($rel ? " $rel" : ''); |
|
| 1184 | + $rel = 'nofollow'.($rel ? " $rel" : ''); |
|
| 1185 | 1185 | $anofollow = inserer_attribut($a, 'rel', $rel); |
| 1186 | 1186 | $texte = str_replace($a, $anofollow, $texte); |
| 1187 | 1187 | } |
@@ -1210,7 +1210,7 @@ discard block |
||
| 1210 | 1210 | $u = $GLOBALS['meta']['pcre_u']; |
| 1211 | 1211 | $texte = preg_replace('@</p>@iS', "\n", $texte); |
| 1212 | 1212 | $texte = preg_replace("@<p\b.*>@UiS", '<br />', $texte); |
| 1213 | - $texte = preg_replace('@^\s*<br />@S' . $u, '', $texte); |
|
| 1213 | + $texte = preg_replace('@^\s*<br />@S'.$u, '', $texte); |
|
| 1214 | 1214 | |
| 1215 | 1215 | return $texte; |
| 1216 | 1216 | } |
@@ -1241,7 +1241,7 @@ discard block |
||
| 1241 | 1241 | return $texte; |
| 1242 | 1242 | } |
| 1243 | 1243 | include_spip('inc/texte'); |
| 1244 | - $tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ? |
|
| 1244 | + $tag = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $texte) ? |
|
| 1245 | 1245 | 'div' : 'span'; |
| 1246 | 1246 | |
| 1247 | 1247 | return "<$tag style='word-wrap:break-word;'>$texte</$tag>"; |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | } |
| 1354 | 1354 | $u = $GLOBALS['meta']['pcre_u']; |
| 1355 | 1355 | if ($textebrut) { |
| 1356 | - $texte = preg_replace([",\n,", ',\s(?=\s),msS' . $u], [' ', ''], textebrut($texte)); |
|
| 1356 | + $texte = preg_replace([",\n,", ',\s(?=\s),msS'.$u], [' ', ''], textebrut($texte)); |
|
| 1357 | 1357 | } |
| 1358 | 1358 | $texte = texte_backend($texte); |
| 1359 | 1359 | $texte = str_replace(["'", '"'], [''', '"'], $texte); |
@@ -1388,7 +1388,7 @@ discard block |
||
| 1388 | 1388 | # un message pour abs_url |
| 1389 | 1389 | $GLOBALS['mode_abs_url'] = 'url'; |
| 1390 | 1390 | $url = trim($url); |
| 1391 | - $r = ',^(?:' . _PROTOCOLES_STD . '):?/?/?$,iS'; |
|
| 1391 | + $r = ',^(?:'._PROTOCOLES_STD.'):?/?/?$,iS'; |
|
| 1392 | 1392 | |
| 1393 | 1393 | return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url); |
| 1394 | 1394 | } |
@@ -1595,7 +1595,7 @@ discard block |
||
| 1595 | 1595 | |
| 1596 | 1596 | $debut = ''; |
| 1597 | 1597 | $suite = $texte; |
| 1598 | - while ($t = strpos('-' . $suite, "\n", 1)) { |
|
| 1598 | + while ($t = strpos('-'.$suite, "\n", 1)) { |
|
| 1599 | 1599 | $debut .= substr($suite, 0, $t - 1); |
| 1600 | 1600 | $suite = substr($suite, $t); |
| 1601 | 1601 | $car = substr($suite, 0, 1); |
@@ -1613,7 +1613,7 @@ discard block |
||
| 1613 | 1613 | $suite = substr($suite, strlen($regs[0])); |
| 1614 | 1614 | } |
| 1615 | 1615 | } |
| 1616 | - $texte = $debut . $suite; |
|
| 1616 | + $texte = $debut.$suite; |
|
| 1617 | 1617 | |
| 1618 | 1618 | if ($collecteurModeles) { |
| 1619 | 1619 | $texte = $collecteurModeles->retablir($texte); |
@@ -1621,7 +1621,7 @@ discard block |
||
| 1621 | 1621 | |
| 1622 | 1622 | $texte = echappe_retour($texte); |
| 1623 | 1623 | |
| 1624 | - return $texte . $fin; |
|
| 1624 | + return $texte.$fin; |
|
| 1625 | 1625 | } |
| 1626 | 1626 | |
| 1627 | 1627 | |
@@ -1897,7 +1897,7 @@ discard block |
||
| 1897 | 1897 | if (is_array($balise)) { |
| 1898 | 1898 | array_walk( |
| 1899 | 1899 | $balise, |
| 1900 | - function (&$a, $key, $t) { |
|
| 1900 | + function(&$a, $key, $t) { |
|
| 1901 | 1901 | $a = extraire_attribut($a, $t); |
| 1902 | 1902 | }, |
| 1903 | 1903 | $attribut |
@@ -1995,14 +1995,14 @@ discard block |
||
| 1995 | 1995 | |
| 1996 | 1996 | if ($old !== null) { |
| 1997 | 1997 | // Remplacer l'ancien attribut du meme nom |
| 1998 | - $balise = $r[1] . $insert . $r[5]; |
|
| 1998 | + $balise = $r[1].$insert.$r[5]; |
|
| 1999 | 1999 | } else { |
| 2000 | 2000 | // preferer une balise " />" (comme <img />) |
| 2001 | 2001 | if (preg_match(',/>,', $balise)) { |
| 2002 | - $balise = preg_replace(',\s?/>,S', $insert . ' />', $balise, 1); |
|
| 2002 | + $balise = preg_replace(',\s?/>,S', $insert.' />', $balise, 1); |
|
| 2003 | 2003 | } // sinon une balise <a ...> ... </a> |
| 2004 | 2004 | else { |
| 2005 | - $balise = preg_replace(',\s?>,S', $insert . '>', $balise, 1); |
|
| 2005 | + $balise = preg_replace(',\s?>,S', $insert.'>', $balise, 1); |
|
| 2006 | 2006 | } |
| 2007 | 2007 | } |
| 2008 | 2008 | |
@@ -2057,7 +2057,7 @@ discard block |
||
| 2057 | 2057 | if ( |
| 2058 | 2058 | $class_courante |
| 2059 | 2059 | and str_contains($class_courante, (string) $c) |
| 2060 | - and preg_match('/(^|\s)' . preg_quote($c) . '($|\s)/', $class_courante) |
|
| 2060 | + and preg_match('/(^|\s)'.preg_quote($c).'($|\s)/', $class_courante) |
|
| 2061 | 2061 | ) { |
| 2062 | 2062 | $is_class_presente = true; |
| 2063 | 2063 | } |
@@ -2065,12 +2065,12 @@ discard block |
||
| 2065 | 2065 | in_array($operation, ['ajouter', 'commuter']) |
| 2066 | 2066 | and !$is_class_presente |
| 2067 | 2067 | ) { |
| 2068 | - $class_new = ltrim(rtrim($class_new ?? '') . ' ' . $c); |
|
| 2068 | + $class_new = ltrim(rtrim($class_new ?? '').' '.$c); |
|
| 2069 | 2069 | } elseif ( |
| 2070 | 2070 | in_array($operation, ['supprimer', 'commuter']) |
| 2071 | 2071 | and $is_class_presente |
| 2072 | 2072 | ) { |
| 2073 | - $class_new = trim(preg_replace('/(^|\s)' . preg_quote($c) . '($|\s)/', "\\1", $class_new)); |
|
| 2073 | + $class_new = trim(preg_replace('/(^|\s)'.preg_quote($c).'($|\s)/', "\\1", $class_new)); |
|
| 2074 | 2074 | } |
| 2075 | 2075 | } |
| 2076 | 2076 | |
@@ -2133,7 +2133,7 @@ discard block |
||
| 2133 | 2133 | // Quelques fonctions de calcul arithmetique |
| 2134 | 2134 | // |
| 2135 | 2135 | function floatstr($a) { |
| 2136 | - return str_replace(',', '.', (string)floatval($a)); |
|
| 2136 | + return str_replace(',', '.', (string) floatval($a)); |
|
| 2137 | 2137 | } |
| 2138 | 2138 | function strize($f, $a, $b) { |
| 2139 | 2139 | return floatstr($f(floatstr($a), floatstr($b))); |
@@ -2274,13 +2274,13 @@ discard block |
||
| 2274 | 2274 | if (!defined('_TAGS_NOM_AUTEUR')) { |
| 2275 | 2275 | define('_TAGS_NOM_AUTEUR', ''); |
| 2276 | 2276 | } |
| 2277 | - $tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR)); |
|
| 2277 | + $tags_acceptes = array_unique(explode(',', 'multi,'._TAGS_NOM_AUTEUR)); |
|
| 2278 | 2278 | foreach ($tags_acceptes as $tag) { |
| 2279 | 2279 | if (strlen($tag)) { |
| 2280 | - $remp1[] = '<' . trim($tag) . '>'; |
|
| 2281 | - $remp1[] = '</' . trim($tag) . '>'; |
|
| 2282 | - $remp2[] = '\x60' . trim($tag) . '\x61'; |
|
| 2283 | - $remp2[] = '\x60/' . trim($tag) . '\x61'; |
|
| 2280 | + $remp1[] = '<'.trim($tag).'>'; |
|
| 2281 | + $remp1[] = '</'.trim($tag).'>'; |
|
| 2282 | + $remp2[] = '\x60'.trim($tag).'\x61'; |
|
| 2283 | + $remp2[] = '\x60/'.trim($tag).'\x61'; |
|
| 2284 | 2284 | } |
| 2285 | 2285 | } |
| 2286 | 2286 | $v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom))); |
@@ -2400,10 +2400,10 @@ discard block |
||
| 2400 | 2400 | $fichier = basename($url); |
| 2401 | 2401 | |
| 2402 | 2402 | return '<a rel="enclosure"' |
| 2403 | - . ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2404 | - . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2405 | - . ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '') |
|
| 2406 | - . '>' . $fichier . '</a>'; |
|
| 2403 | + . ($url ? ' href="'.spip_htmlspecialchars($url).'"' : '') |
|
| 2404 | + . ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '') |
|
| 2405 | + . ($length ? ' title="'.spip_htmlspecialchars($length).'"' : '') |
|
| 2406 | + . '>'.$fichier.'</a>'; |
|
| 2407 | 2407 | } |
| 2408 | 2408 | |
| 2409 | 2409 | /** |
@@ -2431,9 +2431,9 @@ discard block |
||
| 2431 | 2431 | } # vieux data |
| 2432 | 2432 | $fichier = basename($url); |
| 2433 | 2433 | $enclosures[] = '<enclosure' |
| 2434 | - . ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2435 | - . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2436 | - . ($length ? ' length="' . $length . '"' : '') |
|
| 2434 | + . ($url ? ' url="'.spip_htmlspecialchars($url).'"' : '') |
|
| 2435 | + . ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '') |
|
| 2436 | + . ($length ? ' length="'.$length.'"' : '') |
|
| 2437 | 2437 | . ' />'; |
| 2438 | 2438 | } |
| 2439 | 2439 | } |
@@ -2459,7 +2459,7 @@ discard block |
||
| 2459 | 2459 | if (extraire_attribut($e, 'rel') == 'tag') { |
| 2460 | 2460 | $subjects .= '<dc:subject>' |
| 2461 | 2461 | . texte_backend(textebrut($e)) |
| 2462 | - . '</dc:subject>' . "\n"; |
|
| 2462 | + . '</dc:subject>'."\n"; |
|
| 2463 | 2463 | } |
| 2464 | 2464 | } |
| 2465 | 2465 | |
@@ -2495,7 +2495,7 @@ discard block |
||
| 2495 | 2495 | if (is_array($texte)) { |
| 2496 | 2496 | array_walk( |
| 2497 | 2497 | $texte, |
| 2498 | - function (&$a, $key, $t) { |
|
| 2498 | + function(&$a, $key, $t) { |
|
| 2499 | 2499 | $a = extraire_balise($a, $t); |
| 2500 | 2500 | }, |
| 2501 | 2501 | $tag |
@@ -2543,7 +2543,7 @@ discard block |
||
| 2543 | 2543 | if (is_array($texte)) { |
| 2544 | 2544 | array_walk( |
| 2545 | 2545 | $texte, |
| 2546 | - function (&$a, $key, $t) { |
|
| 2546 | + function(&$a, $key, $t) { |
|
| 2547 | 2547 | $a = extraire_balises($a, $t); |
| 2548 | 2548 | }, |
| 2549 | 2549 | $tag |
@@ -2676,7 +2676,7 @@ discard block |
||
| 2676 | 2676 | if ($fond != '404') { |
| 2677 | 2677 | $contexte = array_shift($p); |
| 2678 | 2678 | $contexte['page'] = $fond; |
| 2679 | - $action = preg_replace('/([?]' . preg_quote($fond) . '[^&=]*[0-9]+)(&|$)/', '?&', $action); |
|
| 2679 | + $action = preg_replace('/([?]'.preg_quote($fond).'[^&=]*[0-9]+)(&|$)/', '?&', $action); |
|
| 2680 | 2680 | } |
| 2681 | 2681 | } |
| 2682 | 2682 | // defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url |
@@ -2731,9 +2731,9 @@ discard block |
||
| 2731 | 2731 | . '"' |
| 2732 | 2732 | . (is_null($val) |
| 2733 | 2733 | ? '' |
| 2734 | - : ' value="' . entites_html($val) . '"' |
|
| 2734 | + : ' value="'.entites_html($val).'"' |
|
| 2735 | 2735 | ) |
| 2736 | - . ' type="hidden"' . "\n/>"; |
|
| 2736 | + . ' type="hidden"'."\n/>"; |
|
| 2737 | 2737 | } |
| 2738 | 2738 | |
| 2739 | 2739 | return join('', $hidden); |
@@ -2843,7 +2843,7 @@ discard block |
||
| 2843 | 2843 | |
| 2844 | 2844 | return preg_replace_callback( |
| 2845 | 2845 | ",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims", |
| 2846 | - fn($x) => "url('" . suivre_lien($path, $x[1]) . "')", |
|
| 2846 | + fn($x) => "url('".suivre_lien($path, $x[1])."')", |
|
| 2847 | 2847 | $contenu |
| 2848 | 2848 | ); |
| 2849 | 2849 | } |
@@ -2904,14 +2904,14 @@ discard block |
||
| 2904 | 2904 | ) { |
| 2905 | 2905 | $distant = true; |
| 2906 | 2906 | $cssf = parse_url($css); |
| 2907 | - $cssf = $cssf['path'] . ($cssf['query'] ? '?' . $cssf['query'] : ''); |
|
| 2907 | + $cssf = $cssf['path'].($cssf['query'] ? '?'.$cssf['query'] : ''); |
|
| 2908 | 2908 | $cssf = preg_replace(',[?:&=],', '_', $cssf); |
| 2909 | 2909 | } else { |
| 2910 | 2910 | $distant = false; |
| 2911 | 2911 | $cssf = $css; |
| 2912 | 2912 | // 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi |
| 2913 | 2913 | //propose (rien a faire dans ce cas) |
| 2914 | - $f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css); |
|
| 2914 | + $f = preg_replace(',(_rtl)?\.css$,i', '_'.$ndir.'.css', $css); |
|
| 2915 | 2915 | if (@file_exists($f)) { |
| 2916 | 2916 | return $f; |
| 2917 | 2917 | } |
@@ -2921,7 +2921,7 @@ discard block |
||
| 2921 | 2921 | $dir_var = sous_repertoire(_DIR_VAR, 'cache-css'); |
| 2922 | 2922 | $f = $dir_var |
| 2923 | 2923 | . preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf) |
| 2924 | - . '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css'; |
|
| 2924 | + . '.'.substr(md5($cssf), 0, 4).'_'.$ndir.'.css'; |
|
| 2925 | 2925 | |
| 2926 | 2926 | // la css peut etre distante (url absolue !) |
| 2927 | 2927 | if ($distant) { |
@@ -2967,8 +2967,8 @@ discard block |
||
| 2967 | 2967 | } // si la css_direction commence par $dir_var on la fait passer pour une absolue |
| 2968 | 2968 | elseif (substr($css_direction, 0, strlen($dir_var)) == $dir_var) { |
| 2969 | 2969 | $css_direction = substr($css_direction, strlen($dir_var)); |
| 2970 | - $src_faux_abs['/@@@@@@/' . $css_direction] = $css_direction; |
|
| 2971 | - $css_direction = '/@@@@@@/' . $css_direction; |
|
| 2970 | + $src_faux_abs['/@@@@@@/'.$css_direction] = $css_direction; |
|
| 2971 | + $css_direction = '/@@@@@@/'.$css_direction; |
|
| 2972 | 2972 | } |
| 2973 | 2973 | $src[] = $regs[0][$k]; |
| 2974 | 2974 | $src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]); |
@@ -3017,7 +3017,7 @@ discard block |
||
| 3017 | 3017 | |
| 3018 | 3018 | $f = basename($css, '.css'); |
| 3019 | 3019 | $f = sous_repertoire(_DIR_VAR, 'cache-css') |
| 3020 | - . preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f) |
|
| 3020 | + . preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-".substr(md5("$css-urlabs"), 0, 4)."\\2", $f) |
|
| 3021 | 3021 | . '.css'; |
| 3022 | 3022 | |
| 3023 | 3023 | if ((@filemtime($f) > @filemtime($css)) and (_VAR_MODE != 'recalcul')) { |
@@ -3027,7 +3027,7 @@ discard block |
||
| 3027 | 3027 | if ($url_absolue_css == $css) { |
| 3028 | 3028 | if ( |
| 3029 | 3029 | strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0 |
| 3030 | - or !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu) |
|
| 3030 | + or !lire_fichier(_DIR_RACINE.substr($css, $l), $contenu) |
|
| 3031 | 3031 | ) { |
| 3032 | 3032 | include_spip('inc/distant'); |
| 3033 | 3033 | $contenu = recuperer_url($css); |
@@ -3139,7 +3139,7 @@ discard block |
||
| 3139 | 3139 | $expression = str_replace('\/', '/', $expression); |
| 3140 | 3140 | $expression = str_replace('/', '\/', $expression); |
| 3141 | 3141 | |
| 3142 | - if (preg_match('/' . $expression . '/' . $modif, $texte ?? '', $r)) { |
|
| 3142 | + if (preg_match('/'.$expression.'/'.$modif, $texte ?? '', $r)) { |
|
| 3143 | 3143 | if (isset($r[$capte])) { |
| 3144 | 3144 | return $r[$capte]; |
| 3145 | 3145 | } else { |
@@ -3177,7 +3177,7 @@ discard block |
||
| 3177 | 3177 | $expression = str_replace('\/', '/', $expression); |
| 3178 | 3178 | $expression = str_replace('/', '\/', $expression); |
| 3179 | 3179 | |
| 3180 | - return preg_replace('/' . $expression . '/' . $modif, $replace, $texte); |
|
| 3180 | + return preg_replace('/'.$expression.'/'.$modif, $replace, $texte); |
|
| 3181 | 3181 | } |
| 3182 | 3182 | |
| 3183 | 3183 | |
@@ -3196,7 +3196,7 @@ discard block |
||
| 3196 | 3196 | function traiter_doublons_documents(&$doublons, $letexte) { |
| 3197 | 3197 | |
| 3198 | 3198 | // Verifier dans le texte & les notes (pas beau, helas) |
| 3199 | - $t = $letexte . $GLOBALS['les_notes']; |
|
| 3199 | + $t = $letexte.$GLOBALS['les_notes']; |
|
| 3200 | 3200 | |
| 3201 | 3201 | if ( |
| 3202 | 3202 | strstr($t, 'spip_document_') // evite le preg_match_all si inutile |
@@ -3210,7 +3210,7 @@ discard block |
||
| 3210 | 3210 | if (!isset($doublons['documents'])) { |
| 3211 | 3211 | $doublons['documents'] = ''; |
| 3212 | 3212 | } |
| 3213 | - $doublons['documents'] .= ',' . join(',', $matches[1]); |
|
| 3213 | + $doublons['documents'] .= ','.join(',', $matches[1]); |
|
| 3214 | 3214 | } |
| 3215 | 3215 | |
| 3216 | 3216 | return $letexte; |
@@ -3267,7 +3267,7 @@ discard block |
||
| 3267 | 3267 | if ($env) { |
| 3268 | 3268 | foreach ($env as $i => $j) { |
| 3269 | 3269 | if (is_string($j) and !in_array($i, $ignore_params)) { |
| 3270 | - $texte .= "<param name='" . attribut_html($i) . "'\n\tvalue='" . attribut_html($j) . "' />"; |
|
| 3270 | + $texte .= "<param name='".attribut_html($i)."'\n\tvalue='".attribut_html($j)."' />"; |
|
| 3271 | 3271 | } |
| 3272 | 3272 | } |
| 3273 | 3273 | } |
@@ -3306,7 +3306,7 @@ discard block |
||
| 3306 | 3306 | if ($env) { |
| 3307 | 3307 | foreach ($env as $i => $j) { |
| 3308 | 3308 | if (is_string($j) and !in_array($i, $ignore_params)) { |
| 3309 | - $texte .= attribut_html($i) . "='" . attribut_html($j) . "' "; |
|
| 3309 | + $texte .= attribut_html($i)."='".attribut_html($j)."' "; |
|
| 3310 | 3310 | } |
| 3311 | 3311 | } |
| 3312 | 3312 | } |
@@ -3380,10 +3380,10 @@ discard block |
||
| 3380 | 3380 | // si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png |
| 3381 | 3381 | if ( |
| 3382 | 3382 | preg_match(',-(\d+)[.](png|gif|svg)$,', $img_file, $m) |
| 3383 | - and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])) . '-xx.svg' |
|
| 3383 | + and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])).'-xx.svg' |
|
| 3384 | 3384 | and file_exists($variante_svg_generique) |
| 3385 | 3385 | ) { |
| 3386 | - if ($variante_svg_size = substr($variante_svg_generique, 0, -6) . $m[1] . '.svg' and file_exists($variante_svg_size)) { |
|
| 3386 | + if ($variante_svg_size = substr($variante_svg_generique, 0, -6).$m[1].'.svg' and file_exists($variante_svg_size)) { |
|
| 3387 | 3387 | $img_file = $variante_svg_size; |
| 3388 | 3388 | } |
| 3389 | 3389 | else { |
@@ -3441,7 +3441,7 @@ discard block |
||
| 3441 | 3441 | return ''; |
| 3442 | 3442 | } |
| 3443 | 3443 | } |
| 3444 | - $atts .= " width='" . $largeur . "' height='" . $hauteur . "'"; |
|
| 3444 | + $atts .= " width='".$largeur."' height='".$hauteur."'"; |
|
| 3445 | 3445 | } |
| 3446 | 3446 | |
| 3447 | 3447 | if (file_exists($img_file)) { |
@@ -3451,14 +3451,14 @@ discard block |
||
| 3451 | 3451 | $alt = ''; |
| 3452 | 3452 | } |
| 3453 | 3453 | elseif ($alt or $alt === '') { |
| 3454 | - $alt = " alt='" . attribut_html($alt) . "'"; |
|
| 3454 | + $alt = " alt='".attribut_html($alt)."'"; |
|
| 3455 | 3455 | } |
| 3456 | 3456 | else { |
| 3457 | - $alt = " alt='" . attribut_html($title) . "'"; |
|
| 3457 | + $alt = " alt='".attribut_html($title)."'"; |
|
| 3458 | 3458 | } |
| 3459 | - return "<img src='" . attribut_html($img_file) . "'$alt" |
|
| 3460 | - . ($title ? ' title="' . attribut_html($title) . '"' : '') |
|
| 3461 | - . ' ' . ltrim($atts) |
|
| 3459 | + return "<img src='".attribut_html($img_file)."'$alt" |
|
| 3460 | + . ($title ? ' title="'.attribut_html($title).'"' : '') |
|
| 3461 | + . ' '.ltrim($atts) |
|
| 3462 | 3462 | . ' />'; |
| 3463 | 3463 | } |
| 3464 | 3464 | |
@@ -3472,10 +3472,10 @@ discard block |
||
| 3472 | 3472 | */ |
| 3473 | 3473 | function http_style_background($img, $att = '', $size = null) { |
| 3474 | 3474 | if ($size and is_numeric($size)) { |
| 3475 | - $size = trim($size) . 'px'; |
|
| 3475 | + $size = trim($size).'px'; |
|
| 3476 | 3476 | } |
| 3477 | - return " style='background" . |
|
| 3478 | - ($att ? '' : '-image') . ': url("' . chemin_image($img) . '")' . ($att ? (' ' . $att) : '') . ';' |
|
| 3477 | + return " style='background". |
|
| 3478 | + ($att ? '' : '-image').': url("'.chemin_image($img).'")'.($att ? (' '.$att) : '').';' |
|
| 3479 | 3479 | . ($size ? "background-size:{$size};" : '') |
| 3480 | 3480 | . "'"; |
| 3481 | 3481 | } |
@@ -3590,7 +3590,7 @@ discard block |
||
| 3590 | 3590 | $img = http_img_pack( |
| 3591 | 3591 | $img, |
| 3592 | 3592 | $alt, |
| 3593 | - $class ? " class='" . attribut_html($class) . "'" : '', |
|
| 3593 | + $class ? " class='".attribut_html($class)."'" : '', |
|
| 3594 | 3594 | '', |
| 3595 | 3595 | ['chemin_image' => false, 'utiliser_suffixe_size' => false] |
| 3596 | 3596 | ); |
@@ -3675,7 +3675,7 @@ discard block |
||
| 3675 | 3675 | $balise_svg_source = $balise_svg; |
| 3676 | 3676 | |
| 3677 | 3677 | // entete XML à supprimer |
| 3678 | - $svg = preg_replace(',^\s*<\?xml[^>]*\?' . '>,', '', $svg); |
|
| 3678 | + $svg = preg_replace(',^\s*<\?xml[^>]*\?'.'>,', '', $svg); |
|
| 3679 | 3679 | |
| 3680 | 3680 | // IE est toujours mon ami |
| 3681 | 3681 | $balise_svg = inserer_attribut($balise_svg, 'focusable', 'false'); |
@@ -3693,9 +3693,9 @@ discard block |
||
| 3693 | 3693 | // regler le alt |
| 3694 | 3694 | if ($alt) { |
| 3695 | 3695 | $balise_svg = inserer_attribut($balise_svg, 'role', 'img'); |
| 3696 | - $id = 'img-svg-title-' . substr(md5("$img_file:$svg:$alt"), 0, 4); |
|
| 3696 | + $id = 'img-svg-title-'.substr(md5("$img_file:$svg:$alt"), 0, 4); |
|
| 3697 | 3697 | $balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id); |
| 3698 | - $title = "<title id=\"$id\">" . entites_html($alt) . "</title>\n"; |
|
| 3698 | + $title = "<title id=\"$id\">".entites_html($alt)."</title>\n"; |
|
| 3699 | 3699 | $balise_svg .= $title; |
| 3700 | 3700 | } |
| 3701 | 3701 | else { |
@@ -3743,7 +3743,7 @@ discard block |
||
| 3743 | 3743 | if (is_array($tableau)) { |
| 3744 | 3744 | foreach ($tableau as $k => $v) { |
| 3745 | 3745 | $res = recuperer_fond( |
| 3746 | - 'modeles/' . $modele, |
|
| 3746 | + 'modeles/'.$modele, |
|
| 3747 | 3747 | array_merge(['cle' => $k], (is_array($v) ? $v : ['valeur' => $v])) |
| 3748 | 3748 | ); |
| 3749 | 3749 | $texte .= $res; |
@@ -3928,7 +3928,7 @@ discard block |
||
| 3928 | 3928 | } |
| 3929 | 3929 | |
| 3930 | 3930 | $c = serialize($c); |
| 3931 | - $cle = calculer_cle_action($form . $c); |
|
| 3931 | + $cle = calculer_cle_action($form.$c); |
|
| 3932 | 3932 | $c = "$cle:$c"; |
| 3933 | 3933 | |
| 3934 | 3934 | // on ne stocke pas les contextes dans des fichiers en cache |
@@ -3986,15 +3986,15 @@ discard block |
||
| 3986 | 3986 | } |
| 3987 | 3987 | // toujours encoder l'url source dans le bloc ajax |
| 3988 | 3988 | $r = self(); |
| 3989 | - $r = ' data-origin="' . $r . '"'; |
|
| 3989 | + $r = ' data-origin="'.$r.'"'; |
|
| 3990 | 3990 | $class = 'ajaxbloc'; |
| 3991 | 3991 | if ($ajaxid and is_string($ajaxid)) { |
| 3992 | 3992 | // ajaxid est normalement conforme a un nom de classe css |
| 3993 | 3993 | // on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution |
| 3994 | - $class .= ' ajax-id-' . entites_html($ajaxid); |
|
| 3994 | + $class .= ' ajax-id-'.entites_html($ajaxid); |
|
| 3995 | 3995 | } |
| 3996 | 3996 | |
| 3997 | - return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n"; |
|
| 3997 | + return "<div class='$class' "."data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n"; |
|
| 3998 | 3998 | } |
| 3999 | 3999 | |
| 4000 | 4000 | /** |
@@ -4038,7 +4038,7 @@ discard block |
||
| 4038 | 4038 | $cle = substr($c, 0, $p); |
| 4039 | 4039 | $c = substr($c, $p + 1); |
| 4040 | 4040 | |
| 4041 | - if ($cle == calculer_cle_action($form . $c)) { |
|
| 4041 | + if ($cle == calculer_cle_action($form.$c)) { |
|
| 4042 | 4042 | $env = @unserialize($c); |
| 4043 | 4043 | return $env; |
| 4044 | 4044 | } |
@@ -4159,13 +4159,13 @@ discard block |
||
| 4159 | 4159 | } |
| 4160 | 4160 | } |
| 4161 | 4161 | } |
| 4162 | - $att .= 'class="' . ($class ? attribut_html($class) . ' ' : '') . (defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on') . '"'; |
|
| 4162 | + $att .= 'class="'.($class ? attribut_html($class).' ' : '').(defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on').'"'; |
|
| 4163 | 4163 | } else { |
| 4164 | 4164 | $bal = 'a'; |
| 4165 | 4165 | $att = "href='$url'" |
| 4166 | - . ($title ? " title='" . attribut_html($title) . "'" : '') |
|
| 4167 | - . ($class ? " class='" . attribut_html($class) . "'" : '') |
|
| 4168 | - . ($rel ? " rel='" . attribut_html($rel) . "'" : '') |
|
| 4166 | + . ($title ? " title='".attribut_html($title)."'" : '') |
|
| 4167 | + . ($class ? " class='".attribut_html($class)."'" : '') |
|
| 4168 | + . ($rel ? " rel='".attribut_html($rel)."'" : '') |
|
| 4169 | 4169 | . $evt; |
| 4170 | 4170 | } |
| 4171 | 4171 | if ($libelle === null) { |
@@ -4304,7 +4304,7 @@ discard block |
||
| 4304 | 4304 | |
| 4305 | 4305 | // Icône |
| 4306 | 4306 | $icone = http_img_pack($fond, $alt, "width='$size' height='$size'"); |
| 4307 | - $icone = '<span class="icone-image' . ($fonction ? " icone-fonction icone-fonction-$fonction" : '') . "\">$icone</span>"; |
|
| 4307 | + $icone = '<span class="icone-image'.($fonction ? " icone-fonction icone-fonction-$fonction" : '')."\">$icone</span>"; |
|
| 4308 | 4308 | |
| 4309 | 4309 | // Markup final |
| 4310 | 4310 | if ($type == 'lien') { |
@@ -4579,20 +4579,20 @@ discard block |
||
| 4579 | 4579 | $class_form = 'ajax'; |
| 4580 | 4580 | $class = str_replace('ajax', '', $class); |
| 4581 | 4581 | } |
| 4582 | - $class_btn = 'submit ' . trim($class); |
|
| 4582 | + $class_btn = 'submit '.trim($class); |
|
| 4583 | 4583 | |
| 4584 | 4584 | if ($confirm) { |
| 4585 | - $confirm = 'confirm("' . attribut_html($confirm) . '")'; |
|
| 4585 | + $confirm = 'confirm("'.attribut_html($confirm).'")'; |
|
| 4586 | 4586 | if ($callback) { |
| 4587 | 4587 | $callback = "$confirm?($callback):false"; |
| 4588 | 4588 | } else { |
| 4589 | 4589 | $callback = $confirm; |
| 4590 | 4590 | } |
| 4591 | 4591 | } |
| 4592 | - $onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : ''; |
|
| 4592 | + $onclick = $callback ? " onclick='return ".addcslashes($callback, "'")."'" : ''; |
|
| 4593 | 4593 | $title = $title ? " title='$title'" : ''; |
| 4594 | 4594 | |
| 4595 | - return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>" . form_hidden($url) |
|
| 4595 | + return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>".form_hidden($url) |
|
| 4596 | 4596 | . "<button type='submit' class='$class_btn'$title$onclick>$libelle</button></div></form>"; |
| 4597 | 4597 | } |
| 4598 | 4598 | |
@@ -4657,14 +4657,14 @@ discard block |
||
| 4657 | 4657 | $champ_titre = ''; |
| 4658 | 4658 | if ($demande_titre) { |
| 4659 | 4659 | // si pas de titre declare mais champ titre, il sera peuple par le select * |
| 4660 | - $champ_titre = (!empty($desc['titre'])) ? ', ' . $desc['titre'] : ''; |
|
| 4660 | + $champ_titre = (!empty($desc['titre'])) ? ', '.$desc['titre'] : ''; |
|
| 4661 | 4661 | } |
| 4662 | 4662 | include_spip('base/abstract_sql'); |
| 4663 | 4663 | include_spip('base/connect_sql'); |
| 4664 | 4664 | $objets[$type_objet][$id_objet] = sql_fetsel( |
| 4665 | - '*' . $champ_titre, |
|
| 4665 | + '*'.$champ_titre, |
|
| 4666 | 4666 | $desc['table_sql'], |
| 4667 | - id_table_objet($type_objet) . ' = ' . intval($id_objet) |
|
| 4667 | + id_table_objet($type_objet).' = '.intval($id_objet) |
|
| 4668 | 4668 | ); |
| 4669 | 4669 | |
| 4670 | 4670 | // Toujours noter la longueur d'introduction, même si pas demandé cette fois-ci |
@@ -4757,8 +4757,7 @@ discard block |
||
| 4757 | 4757 | if (isset($ligne_sql['chapo'])) { |
| 4758 | 4758 | $chapo = $ligne_sql['chapo']; |
| 4759 | 4759 | $texte = strlen($descriptif) ? |
| 4760 | - '' : |
|
| 4761 | - "$chapo \n\n $texte"; |
|
| 4760 | + '' : "$chapo \n\n $texte"; |
|
| 4762 | 4761 | } |
| 4763 | 4762 | |
| 4764 | 4763 | // Longueur en paramètre, sinon celle renseignée dans la description de l'objet, sinon valeur en dur |
@@ -4833,7 +4832,7 @@ discard block |
||
| 4833 | 4832 | return $texte; |
| 4834 | 4833 | } |
| 4835 | 4834 | |
| 4836 | - $traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement); |
|
| 4835 | + $traitement = str_replace('%s', "'".texte_script($texte)."'", $traitement); |
|
| 4837 | 4836 | |
| 4838 | 4837 | // signaler qu'on est dans l'espace prive pour les filtres qui se servent de ce flag |
| 4839 | 4838 | if (test_espace_prive()) { |
@@ -4872,7 +4871,7 @@ discard block |
||
| 4872 | 4871 | } |
| 4873 | 4872 | $url = generer_objet_url($id_objet, $objet, '', '', null, '', $connect); |
| 4874 | 4873 | |
| 4875 | - return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . '</a>'; |
|
| 4874 | + return "<a href='$url' class='$objet'>".couper($titre, $longueur).'</a>'; |
|
| 4876 | 4875 | } |
| 4877 | 4876 | |
| 4878 | 4877 | /** |
@@ -4898,10 +4897,10 @@ discard block |
||
| 4898 | 4897 | function wrap($texte, $wrap) { |
| 4899 | 4898 | $balises = extraire_balises($wrap); |
| 4900 | 4899 | if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) { |
| 4901 | - $texte = $wrap . $texte; |
|
| 4900 | + $texte = $wrap.$texte; |
|
| 4902 | 4901 | $regs = array_reverse($regs[1]); |
| 4903 | - $wrap = '</' . implode('></', $regs) . '>'; |
|
| 4904 | - $texte = $texte . $wrap; |
|
| 4902 | + $wrap = '</'.implode('></', $regs).'>'; |
|
| 4903 | + $texte = $texte.$wrap; |
|
| 4905 | 4904 | } |
| 4906 | 4905 | |
| 4907 | 4906 | return $texte; |
@@ -4932,7 +4931,7 @@ discard block |
||
| 4932 | 4931 | |
| 4933 | 4932 | // caster $u en array si besoin |
| 4934 | 4933 | if (is_object($u)) { |
| 4935 | - $u = (array)$u; |
|
| 4934 | + $u = (array) $u; |
|
| 4936 | 4935 | } |
| 4937 | 4936 | |
| 4938 | 4937 | if (is_array($u)) { |
@@ -4954,7 +4953,7 @@ discard block |
||
| 4954 | 4953 | // sinon on passe a la ligne et on indente |
| 4955 | 4954 | $i_str = str_pad('', $indent, ' '); |
| 4956 | 4955 | foreach ($u as $k => $v) { |
| 4957 | - $out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2); |
|
| 4956 | + $out .= $join.$i_str."$k: ".filtre_print_dist($v, $join, $indent + 2); |
|
| 4958 | 4957 | } |
| 4959 | 4958 | |
| 4960 | 4959 | return $out; |
@@ -5008,7 +5007,7 @@ discard block |
||
| 5008 | 5007 | * @return string |
| 5009 | 5008 | */ |
| 5010 | 5009 | function objet_icone($objet, $taille = 24, $class = '') { |
| 5011 | - $icone = objet_info($objet, 'icone_objet') . '-' . $taille . '.png'; |
|
| 5010 | + $icone = objet_info($objet, 'icone_objet').'-'.$taille.'.png'; |
|
| 5012 | 5011 | $icone = chemin_image($icone); |
| 5013 | 5012 | $balise_img = charger_filtre('balise_img'); |
| 5014 | 5013 | |
@@ -5034,7 +5033,7 @@ discard block |
||
| 5034 | 5033 | */ |
| 5035 | 5034 | function objet_T($objet, $chaine, $args = [], $options = []) { |
| 5036 | 5035 | $chaine = explode(':', $chaine); |
| 5037 | - if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, ['force' => false]))) { |
|
| 5036 | + if ($t = _T($objet.':'.end($chaine), $args, array_merge($options, ['force' => false]))) { |
|
| 5038 | 5037 | return $t; |
| 5039 | 5038 | } |
| 5040 | 5039 | $chaine = implode(':', $chaine); |
@@ -5100,7 +5099,7 @@ discard block |
||
| 5100 | 5099 | $cache = recuperer_fond($fond, $contexte, $options, $connect); |
| 5101 | 5100 | |
| 5102 | 5101 | // calculer le nom de la css |
| 5103 | - $dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension); |
|
| 5102 | + $dir_var = sous_repertoire(_DIR_VAR, 'cache-'.$extension); |
|
| 5104 | 5103 | $nom_safe = preg_replace(',\W,', '_', str_replace('.', '_', $fond)); |
| 5105 | 5104 | $contexte_implicite = calculer_contexte_implicite(); |
| 5106 | 5105 | |
@@ -5108,14 +5107,14 @@ discard block |
||
| 5108 | 5107 | // mais on peut hasher selon le contenu a la demande, si plusieurs contextes produisent un meme contenu |
| 5109 | 5108 | // reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine |
| 5110 | 5109 | if (isset($options['hash_on_content']) and $options['hash_on_content']) { |
| 5111 | - $hash = md5($contexte_implicite['host'] . '::' . $cache); |
|
| 5110 | + $hash = md5($contexte_implicite['host'].'::'.$cache); |
|
| 5112 | 5111 | } |
| 5113 | 5112 | else { |
| 5114 | 5113 | unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js |
| 5115 | 5114 | ksort($contexte); |
| 5116 | - $hash = md5($fond . json_encode($contexte_implicite, JSON_THROW_ON_ERROR) . json_encode($contexte, JSON_THROW_ON_ERROR) . $connect); |
|
| 5115 | + $hash = md5($fond.json_encode($contexte_implicite, JSON_THROW_ON_ERROR).json_encode($contexte, JSON_THROW_ON_ERROR).$connect); |
|
| 5117 | 5116 | } |
| 5118 | - $filename = $dir_var . $extension . "dyn-$nom_safe-" . substr($hash, 0, 8) . ".$extension"; |
|
| 5117 | + $filename = $dir_var.$extension."dyn-$nom_safe-".substr($hash, 0, 8).".$extension"; |
|
| 5119 | 5118 | |
| 5120 | 5119 | // mettre a jour le fichier si il n'existe pas |
| 5121 | 5120 | // ou trop ancien |
@@ -5123,8 +5122,8 @@ discard block |
||
| 5123 | 5122 | // et recopie sur le fichier cible uniquement si il change |
| 5124 | 5123 | if ( |
| 5125 | 5124 | !file_exists($filename) |
| 5126 | - or !file_exists($filename . '.last') |
|
| 5127 | - or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename . '.last') < $cache['lastmodified']) |
|
| 5125 | + or !file_exists($filename.'.last') |
|
| 5126 | + or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename.'.last') < $cache['lastmodified']) |
|
| 5128 | 5127 | or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') |
| 5129 | 5128 | ) { |
| 5130 | 5129 | $contenu = $cache['texte']; |
@@ -5148,10 +5147,10 @@ discard block |
||
| 5148 | 5147 | } |
| 5149 | 5148 | // pas de date dans le commentaire car sinon ca invalide le md5 et force la maj |
| 5150 | 5149 | // mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non |
| 5151 | - $comment .= "}\n md5:" . md5($contenu) . " */\n"; |
|
| 5150 | + $comment .= "}\n md5:".md5($contenu)." */\n"; |
|
| 5152 | 5151 | } |
| 5153 | 5152 | // et ecrire le fichier si il change |
| 5154 | - ecrire_fichier_calcule_si_modifie($filename, $comment . $contenu, false, true); |
|
| 5153 | + ecrire_fichier_calcule_si_modifie($filename, $comment.$contenu, false, true); |
|
| 5155 | 5154 | } |
| 5156 | 5155 | |
| 5157 | 5156 | return timestamp($filename); |
@@ -5384,7 +5383,7 @@ discard block |
||
| 5384 | 5383 | if ($e > 0 and strlen($mid) > 8) { |
| 5385 | 5384 | $mid = '***...***'; |
| 5386 | 5385 | } |
| 5387 | - return substr($passe, 0, $e) . $mid . ($e > 0 ? substr($passe, -$e) : ''); |
|
| 5386 | + return substr($passe, 0, $e).$mid.($e > 0 ? substr($passe, -$e) : ''); |
|
| 5388 | 5387 | } |
| 5389 | 5388 | |
| 5390 | 5389 | |
@@ -5446,7 +5445,7 @@ discard block |
||
| 5446 | 5445 | case 'id': |
| 5447 | 5446 | case 'anchor': |
| 5448 | 5447 | if (preg_match(',^\d,', $texte)) { |
| 5449 | - $texte = substr($type, 0, 1) . $texte; |
|
| 5448 | + $texte = substr($type, 0, 1).$texte; |
|
| 5450 | 5449 | } |
| 5451 | 5450 | } |
| 5452 | 5451 | |
@@ -5456,9 +5455,9 @@ discard block |
||
| 5456 | 5455 | |
| 5457 | 5456 | if (strlen($texte) < $longueur_mini and $longueur_mini < $longueur_maxi) { |
| 5458 | 5457 | if (preg_match(',^\d,', $texte)) { |
| 5459 | - $texte = ($type ? substr($type, 0, 1) : 's') . $texte; |
|
| 5458 | + $texte = ($type ? substr($type, 0, 1) : 's').$texte; |
|
| 5460 | 5459 | } |
| 5461 | - $texte .= $separateur . md5($original); |
|
| 5460 | + $texte .= $separateur.md5($original); |
|
| 5462 | 5461 | $texte = substr($texte, 0, $longueur_mini); |
| 5463 | 5462 | } |
| 5464 | 5463 | |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | if (strlen($dossier) and substr($dossier, -1) != '/') { |
| 54 | 54 | $dossier .= '/'; |
| 55 | 55 | } |
| 56 | - $f = str_replace('/', '_', $dossier) . $nom; |
|
| 56 | + $f = str_replace('/', '_', $dossier).$nom; |
|
| 57 | 57 | |
| 58 | 58 | if (function_exists($f)) { |
| 59 | 59 | return $f; |
| 60 | 60 | } |
| 61 | - if (function_exists($g = $f . '_dist')) { |
|
| 61 | + if (function_exists($g = $f.'_dist')) { |
|
| 62 | 62 | return $g; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | // passer en minuscules (cf les balises de formulaires) |
| 80 | 80 | // et inclure le fichier |
| 81 | 81 | if ( |
| 82 | - !$inc = include_spip($dossier . ($d = strtolower($nom))) |
|
| 82 | + !$inc = include_spip($dossier.($d = strtolower($nom))) |
|
| 83 | 83 | // si le fichier truc/machin/nom.php n'existe pas, |
| 84 | 84 | // la fonction peut etre definie dans truc/machin.php qui regroupe plusieurs petites fonctions |
| 85 | 85 | and strlen(dirname($dossier)) and dirname($dossier) != '.' |
@@ -98,19 +98,19 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Echec : message d'erreur |
| 101 | - spip_log("fonction $nom ($f ou $g) indisponible" . |
|
| 101 | + spip_log("fonction $nom ($f ou $g) indisponible". |
|
| 102 | 102 | ($inc ? '' : " (fichier $d absent de $dossier)")); |
| 103 | 103 | |
| 104 | 104 | include_spip('inc/minipres'); |
| 105 | 105 | echo minipres( |
| 106 | 106 | _T('forum_titre_erreur'), |
| 107 | 107 | $inc ? |
| 108 | - _T('fonction_introuvable', ['fonction' => '<code>' . spip_htmlentities($f) . '</code>']) |
|
| 108 | + _T('fonction_introuvable', ['fonction' => '<code>'.spip_htmlentities($f).'</code>']) |
|
| 109 | 109 | . '<br />' |
| 110 | - . _T('fonction_introuvable', ['fonction' => '<code>' . spip_htmlentities($g) . '</code>']) |
|
| 110 | + . _T('fonction_introuvable', ['fonction' => '<code>'.spip_htmlentities($g).'</code>']) |
|
| 111 | 111 | : |
| 112 | - _T('fichier_introuvable', ['fichier' => '<code>' . spip_htmlentities($d) . '</code>']), |
|
| 113 | - ['all_inline' => true,'status' => 404] |
|
| 112 | + _T('fichier_introuvable', ['fichier' => '<code>'.spip_htmlentities($d).'</code>']), |
|
| 113 | + ['all_inline' => true, 'status' => 404] |
|
| 114 | 114 | ); |
| 115 | 115 | exit; |
| 116 | 116 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * - string : chemin du fichier trouvé |
| 157 | 157 | **/ |
| 158 | 158 | function include_spip($f, $include = true) { |
| 159 | - return find_in_path($f . '.php', '', $include); |
|
| 159 | + return find_in_path($f.'.php', '', $include); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * - string : chemin du fichier trouvé |
| 177 | 177 | **/ |
| 178 | 178 | function require_spip($f) { |
| 179 | - return find_in_path($f . '.php', '', 'required'); |
|
| 179 | + return find_in_path($f.'.php', '', 'required'); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | // donc il faut l'inclure "en globals" |
| 194 | 194 | if ($f = find_in_path('mes_fonctions.php')) { |
| 195 | 195 | global $dossier_squelettes; |
| 196 | - include_once(_ROOT_CWD . $f); |
|
| 196 | + include_once(_ROOT_CWD.$f); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | if (@is_readable(_CACHE_PLUGINS_FCT)) { |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | // appliquer notre fonction si elle existe |
| 301 | - $fonc = 'execute_pipeline_' . strtolower($action); |
|
| 301 | + $fonc = 'execute_pipeline_'.strtolower($action); |
|
| 302 | 302 | if (function_exists($fonc)) { |
| 303 | 303 | $val = $fonc($val); |
| 304 | 304 | } // plantage ? |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | function spip_log($message = null, $name = null) { |
| 364 | 364 | static $pre = []; |
| 365 | 365 | static $log; |
| 366 | - preg_match('/^([a-z_]*)\.?(\d)?$/iS', (string)$name, $regs); |
|
| 366 | + preg_match('/^([a-z_]*)\.?(\d)?$/iS', (string) $name, $regs); |
|
| 367 | 367 | if (!isset($regs[1]) or !$logname = $regs[1]) { |
| 368 | 368 | $logname = null; |
| 369 | 369 | } |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | if (!is_string($message)) { |
| 392 | 392 | $message = print_r($message, true); |
| 393 | 393 | } |
| 394 | - $log($pre[$niveau] . ' ' . $message, $logname); |
|
| 394 | + $log($pre[$niveau].' '.$message, $logname); |
|
| 395 | 395 | } |
| 396 | 396 | } |
| 397 | 397 | |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | foreach ($regexp as $r => $e) { |
| 598 | 598 | $regexp[$r] = str_replace('[]', '\[\]', preg_replace(',[^\w\d\[\]-],', '', $e)); |
| 599 | 599 | } |
| 600 | - $regexp = ',^(' . implode('|', $regexp) . '[[]?[]]?)(=.*)?$,'; |
|
| 600 | + $regexp = ',^('.implode('|', $regexp).'[[]?[]]?)(=.*)?$,'; |
|
| 601 | 601 | $ajouts = array_flip(explode('|', $c)); |
| 602 | 602 | $u = is_array($v) ? $v : rawurlencode((string) $v); |
| 603 | 603 | $testv = (is_array($v) ? count($v) : strlen((string) $v)); |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | // Ajout. Pour une variable, remplacer au meme endroit, |
| 625 | 625 | // pour un tableau ce sera fait dans la prochaine boucle |
| 626 | 626 | elseif (substr($r[1], -2) != '[]') { |
| 627 | - $url[$n] = $r[1] . '=' . $u; |
|
| 627 | + $url[$n] = $r[1].'='.$u; |
|
| 628 | 628 | unset($ajouts[$r[1]]); |
| 629 | 629 | } |
| 630 | 630 | // Pour les tableaux on laisse tomber les valeurs de |
@@ -645,11 +645,11 @@ discard block |
||
| 645 | 645 | } elseif ($testv) { |
| 646 | 646 | foreach ($ajouts as $k => $n) { |
| 647 | 647 | if (!is_array($v)) { |
| 648 | - $url[] = $k . '=' . $u; |
|
| 648 | + $url[] = $k.'='.$u; |
|
| 649 | 649 | } else { |
| 650 | - $id = (substr($k, -2) == '[]') ? $k : ($k . '[]'); |
|
| 650 | + $id = (substr($k, -2) == '[]') ? $k : ($k.'[]'); |
|
| 651 | 651 | foreach ($v as $w) { |
| 652 | - $url[] = $id . '=' . (is_array($w) ? 'Array' : rawurlencode($w)); |
|
| 652 | + $url[] = $id.'='.(is_array($w) ? 'Array' : rawurlencode($w)); |
|
| 653 | 653 | } |
| 654 | 654 | } |
| 655 | 655 | } |
@@ -660,10 +660,10 @@ discard block |
||
| 660 | 660 | |
| 661 | 661 | // recomposer l'adresse |
| 662 | 662 | if ($url) { |
| 663 | - $a .= '?' . join($sep, $url); |
|
| 663 | + $a .= '?'.join($sep, $url); |
|
| 664 | 664 | } |
| 665 | 665 | |
| 666 | - return $a . $ancre; |
|
| 666 | + return $a.$ancre; |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | /** |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | translitteration($ancre) |
| 694 | 694 | ); |
| 695 | 695 | } |
| 696 | - return $url . (strlen($ancre) ? '#' . $ancre : ''); |
|
| 696 | + return $url.(strlen($ancre) ? '#'.$ancre : ''); |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | /** |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | * @return bool |
| 810 | 810 | */ |
| 811 | 811 | function test_plugin_actif($plugin) { |
| 812 | - return ($plugin and defined('_DIR_PLUGIN_' . strtoupper($plugin))) ? true : false; |
|
| 812 | + return ($plugin and defined('_DIR_PLUGIN_'.strtoupper($plugin))) ? true : false; |
|
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | /** |
@@ -941,7 +941,7 @@ discard block |
||
| 941 | 941 | $value = interdire_scripts($value, -1); |
| 942 | 942 | } |
| 943 | 943 | if (!empty($options['class'])) { |
| 944 | - $value = "<span class='" . $options['class'] . "'>$value</span>"; |
|
| 944 | + $value = "<span class='".$options['class']."'>$value</span>"; |
|
| 945 | 945 | } |
| 946 | 946 | $text = str_replace("@$name@", $value, $text); |
| 947 | 947 | unset($args[$name]); |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | // Si des variables n'ont pas ete inserees, le signaler |
| 951 | 951 | // (chaines de langues pas a jour) |
| 952 | 952 | if ($args) { |
| 953 | - spip_log("$f: variables inutilisees " . join(', ', array_keys($args)), _LOG_DEBUG); |
|
| 953 | + spip_log("$f: variables inutilisees ".join(', ', array_keys($args)), _LOG_DEBUG); |
|
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | 956 | |
@@ -974,7 +974,7 @@ discard block |
||
| 974 | 974 | function joli_repertoire($rep) { |
| 975 | 975 | $a = substr($rep, 0, 1); |
| 976 | 976 | if ($a <> '.' and $a <> '/') { |
| 977 | - $rep = (_DIR_RESTREINT ? '' : _DIR_RESTREINT_ABS) . $rep; |
|
| 977 | + $rep = (_DIR_RESTREINT ? '' : _DIR_RESTREINT_ABS).$rep; |
|
| 978 | 978 | } |
| 979 | 979 | $rep = preg_replace(',(^\.\.\/),', '', $rep); |
| 980 | 980 | |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | $p -= ($x * 1000); |
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | - return $s . sprintf($s ? '%07.3f ms' : '%.3f ms', $p); |
|
| 1031 | + return $s.sprintf($s ? '%07.3f ms' : '%.3f ms', $p); |
|
| 1032 | 1032 | } |
| 1033 | 1033 | } |
| 1034 | 1034 | |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | if ($taches and count($taches) and !spip_connect()) { |
| 1096 | 1096 | return false; |
| 1097 | 1097 | } |
| 1098 | - spip_log('cron !', 'jq' . _LOG_DEBUG); |
|
| 1098 | + spip_log('cron !', 'jq'._LOG_DEBUG); |
|
| 1099 | 1099 | if ($genie = charger_fonction('genie', 'inc', true)) { |
| 1100 | 1100 | return $genie($taches); |
| 1101 | 1101 | } |
@@ -1199,7 +1199,7 @@ discard block |
||
| 1199 | 1199 | |
| 1200 | 1200 | if ($queue_next_job_time == -1) { |
| 1201 | 1201 | if (!defined('_JQ_NEXT_JOB_TIME_FILENAME')) { |
| 1202 | - define('_JQ_NEXT_JOB_TIME_FILENAME', _DIR_TMP . 'job_queue_next.txt'); |
|
| 1202 | + define('_JQ_NEXT_JOB_TIME_FILENAME', _DIR_TMP.'job_queue_next.txt'); |
|
| 1203 | 1203 | } |
| 1204 | 1204 | // utiliser un cache memoire si dispo |
| 1205 | 1205 | if (function_exists('cache_get') and defined('_MEMOIZE_MEMORY') and _MEMOIZE_MEMORY) { |
@@ -1268,8 +1268,8 @@ discard block |
||
| 1268 | 1268 | $src = ''; |
| 1269 | 1269 | } |
| 1270 | 1270 | if ($script) { |
| 1271 | - $script = ("/*<![CDATA[*/\n" . |
|
| 1272 | - preg_replace(',</([^>]*)>,', '<\/\1>', $script) . |
|
| 1271 | + $script = ("/*<![CDATA[*/\n". |
|
| 1272 | + preg_replace(',</([^>]*)>,', '<\/\1>', $script). |
|
| 1273 | 1273 | '/*]]>*/'); |
| 1274 | 1274 | } |
| 1275 | 1275 | if ($noscript) { |
@@ -1355,13 +1355,13 @@ discard block |
||
| 1355 | 1355 | if ($path_base == null) { |
| 1356 | 1356 | // Chemin standard depuis l'espace public |
| 1357 | 1357 | $path = defined('_SPIP_PATH') ? _SPIP_PATH : |
| 1358 | - _DIR_RACINE . ':' . |
|
| 1359 | - _DIR_RACINE . 'squelettes-dist/:' . |
|
| 1360 | - _DIR_RACINE . 'prive/:' . |
|
| 1358 | + _DIR_RACINE.':'. |
|
| 1359 | + _DIR_RACINE.'squelettes-dist/:'. |
|
| 1360 | + _DIR_RACINE.'prive/:'. |
|
| 1361 | 1361 | _DIR_RESTREINT; |
| 1362 | 1362 | // Ajouter squelettes/ |
| 1363 | - if (@is_dir(_DIR_RACINE . 'squelettes')) { |
|
| 1364 | - $path = _DIR_RACINE . 'squelettes/:' . $path; |
|
| 1363 | + if (@is_dir(_DIR_RACINE.'squelettes')) { |
|
| 1364 | + $path = _DIR_RACINE.'squelettes/:'.$path; |
|
| 1365 | 1365 | } |
| 1366 | 1366 | foreach (explode(':', $path) as $dir) { |
| 1367 | 1367 | if (strlen($dir) and substr($dir, -1) != '/') { |
@@ -1373,7 +1373,7 @@ discard block |
||
| 1373 | 1373 | // Et le(s) dossier(s) des squelettes nommes |
| 1374 | 1374 | if (strlen($GLOBALS['dossier_squelettes'])) { |
| 1375 | 1375 | foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d) { |
| 1376 | - array_unshift($path_full, ($d[0] == '/' ? '' : _DIR_RACINE) . $d . '/'); |
|
| 1376 | + array_unshift($path_full, ($d[0] == '/' ? '' : _DIR_RACINE).$d.'/'); |
|
| 1377 | 1377 | } |
| 1378 | 1378 | } |
| 1379 | 1379 | $GLOBALS['path_sig'] = md5(serialize($path_full)); |
@@ -1384,7 +1384,7 @@ discard block |
||
| 1384 | 1384 | |
| 1385 | 1385 | if (is_array($dir_path) or strlen($dir_path)) { |
| 1386 | 1386 | $tete = ''; |
| 1387 | - if (reset($path_base) == _DIR_RACINE . 'squelettes/') { |
|
| 1387 | + if (reset($path_base) == _DIR_RACINE.'squelettes/') { |
|
| 1388 | 1388 | $tete = array_shift($path_base); |
| 1389 | 1389 | } |
| 1390 | 1390 | $dirs = (is_array($dir_path) ? $dir_path : explode(':', $dir_path)); |
@@ -1405,7 +1405,7 @@ discard block |
||
| 1405 | 1405 | // Et le(s) dossier(s) des squelettes nommes |
| 1406 | 1406 | if (strlen($GLOBALS['dossier_squelettes'])) { |
| 1407 | 1407 | foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d) { |
| 1408 | - array_unshift($path_full, ((isset($d[0]) and $d[0] == '/') ? '' : _DIR_RACINE) . $d . '/'); |
|
| 1408 | + array_unshift($path_full, ((isset($d[0]) and $d[0] == '/') ? '' : _DIR_RACINE).$d.'/'); |
|
| 1409 | 1409 | } |
| 1410 | 1410 | } |
| 1411 | 1411 | |
@@ -1476,14 +1476,14 @@ discard block |
||
| 1476 | 1476 | // si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png |
| 1477 | 1477 | if ( |
| 1478 | 1478 | preg_match(',-(\d+)[.](png|gif|svg)$,', $file, $m) |
| 1479 | - and $file_svg_generique = substr($file, 0, -strlen($m[0])) . '-xx.svg' |
|
| 1479 | + and $file_svg_generique = substr($file, 0, -strlen($m[0])).'-xx.svg' |
|
| 1480 | 1480 | and $f = find_in_theme("$file_svg_generique") |
| 1481 | 1481 | ) { |
| 1482 | - if ($fsize = substr($f, 0, -6) . $m[1] . '.svg' and file_exists($fsize)) { |
|
| 1482 | + if ($fsize = substr($f, 0, -6).$m[1].'.svg' and file_exists($fsize)) { |
|
| 1483 | 1483 | return $themefiles["$subdir$file"] = $fsize; |
| 1484 | 1484 | } |
| 1485 | 1485 | else { |
| 1486 | - return $themefiles["$subdir$file"] = "$f?" . $m[1] . 'px'; |
|
| 1486 | + return $themefiles["$subdir$file"] = "$f?".$m[1].'px'; |
|
| 1487 | 1487 | } |
| 1488 | 1488 | } |
| 1489 | 1489 | |
@@ -1493,7 +1493,7 @@ discard block |
||
| 1493 | 1493 | return $themefiles["$subdir$file"] = $f; |
| 1494 | 1494 | } |
| 1495 | 1495 | } |
| 1496 | - spip_log("$file introuvable dans le theme prive " . reset($themes), 'theme'); |
|
| 1496 | + spip_log("$file introuvable dans le theme prive ".reset($themes), 'theme'); |
|
| 1497 | 1497 | |
| 1498 | 1498 | return $themefiles["$subdir$file"] = ''; |
| 1499 | 1499 | } |
@@ -1601,8 +1601,8 @@ discard block |
||
| 1601 | 1601 | return false; |
| 1602 | 1602 | } |
| 1603 | 1603 | if ($include and !isset($inc[$dirname][$file])) { |
| 1604 | - include_once _ROOT_CWD . $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file]; |
|
| 1605 | - $inc[$dirname][$file] = $inc[''][$dirname . $file] = true; |
|
| 1604 | + include_once _ROOT_CWD.$GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file]; |
|
| 1605 | + $inc[$dirname][$file] = $inc[''][$dirname.$file] = true; |
|
| 1606 | 1606 | } |
| 1607 | 1607 | |
| 1608 | 1608 | return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file]; |
@@ -1615,14 +1615,14 @@ discard block |
||
| 1615 | 1615 | } |
| 1616 | 1616 | |
| 1617 | 1617 | foreach (creer_chemin() as $dir) { |
| 1618 | - if (!isset($dirs[$a = $dir . $dirname])) { |
|
| 1619 | - $dirs[$a] = (is_dir(_ROOT_CWD . $a) || !$a); |
|
| 1618 | + if (!isset($dirs[$a = $dir.$dirname])) { |
|
| 1619 | + $dirs[$a] = (is_dir(_ROOT_CWD.$a) || !$a); |
|
| 1620 | 1620 | } |
| 1621 | 1621 | if ($dirs[$a]) { |
| 1622 | - if (file_exists(_ROOT_CWD . ($a .= $file))) { |
|
| 1622 | + if (file_exists(_ROOT_CWD.($a .= $file))) { |
|
| 1623 | 1623 | if ($include and !isset($inc[$dirname][$file])) { |
| 1624 | - include_once _ROOT_CWD . $a; |
|
| 1625 | - $inc[$dirname][$file] = $inc[''][$dirname . $file] = true; |
|
| 1624 | + include_once _ROOT_CWD.$a; |
|
| 1625 | + $inc[$dirname][$file] = $inc[''][$dirname.$file] = true; |
|
| 1626 | 1626 | } |
| 1627 | 1627 | if (!defined('_SAUVER_CHEMIN')) { |
| 1628 | 1628 | // si le chemin n'a pas encore ete charge, ne pas lever le flag, ne pas cacher |
@@ -1632,7 +1632,7 @@ discard block |
||
| 1632 | 1632 | define('_SAUVER_CHEMIN', true); |
| 1633 | 1633 | } |
| 1634 | 1634 | |
| 1635 | - return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname . $file] = $a; |
|
| 1635 | + return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname.$file] = $a; |
|
| 1636 | 1636 | } |
| 1637 | 1637 | } |
| 1638 | 1638 | } |
@@ -1658,7 +1658,7 @@ discard block |
||
| 1658 | 1658 | define('_SAUVER_CHEMIN', true); |
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | - return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname . $file] = false; |
|
| 1661 | + return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname.$file] = false; |
|
| 1662 | 1662 | } |
| 1663 | 1663 | |
| 1664 | 1664 | function clear_path_cache() { |
@@ -1728,12 +1728,12 @@ discard block |
||
| 1728 | 1728 | // cas borderline si dans mes_options on appelle redirige_par_entete qui utilise _T et charge un fichier de langue |
| 1729 | 1729 | // on a pas encore inclus flock.php |
| 1730 | 1730 | if (!function_exists('preg_files')) { |
| 1731 | - include_once _ROOT_RESTREINT . 'inc/flock.php'; |
|
| 1731 | + include_once _ROOT_RESTREINT.'inc/flock.php'; |
|
| 1732 | 1732 | } |
| 1733 | 1733 | |
| 1734 | 1734 | // Parcourir le chemin |
| 1735 | 1735 | foreach (creer_chemin() as $d) { |
| 1736 | - $f = $d . $dir; |
|
| 1736 | + $f = $d.$dir; |
|
| 1737 | 1737 | if (@is_dir($f)) { |
| 1738 | 1738 | $liste = preg_files($f, $pattern, $maxfiles - count($liste_fichiers), $recurs === true ? [] : $recurs); |
| 1739 | 1739 | foreach ($liste as $chemin) { |
@@ -1783,9 +1783,9 @@ discard block |
||
| 1783 | 1783 | if ($type === 'defaut') { |
| 1784 | 1784 | $objet = objet_type($quoi); |
| 1785 | 1785 | if ( |
| 1786 | - $f = charger_fonction('generer_' . $objet . '_url', 'urls', true) |
|
| 1786 | + $f = charger_fonction('generer_'.$objet.'_url', 'urls', true) |
|
| 1787 | 1787 | // deprecated |
| 1788 | - or $f = charger_fonction('generer_url_' . $objet, 'urls', true) |
|
| 1788 | + or $f = charger_fonction('generer_url_'.$objet, 'urls', true) |
|
| 1789 | 1789 | ) { |
| 1790 | 1790 | return $f; |
| 1791 | 1791 | } |
@@ -1798,7 +1798,7 @@ discard block |
||
| 1798 | 1798 | } |
| 1799 | 1799 | |
| 1800 | 1800 | // inclure le module d'url |
| 1801 | - include_spip('urls/' . $url_type); |
|
| 1801 | + include_spip('urls/'.$url_type); |
|
| 1802 | 1802 | |
| 1803 | 1803 | switch ($quoi) { |
| 1804 | 1804 | case 'page': |
@@ -1951,8 +1951,8 @@ discard block |
||
| 1951 | 1951 | include_spip('base/connect_sql'); |
| 1952 | 1952 | $id_type = id_table_objet($entite, $public); |
| 1953 | 1953 | |
| 1954 | - return _DIR_RACINE . get_spip_script('./') |
|
| 1955 | - . '?' . _SPIP_PAGE . "=$entite&$id_type=$i&connect=$public" |
|
| 1954 | + return _DIR_RACINE.get_spip_script('./') |
|
| 1955 | + . '?'._SPIP_PAGE."=$entite&$id_type=$i&connect=$public" |
|
| 1956 | 1956 | . (!$args ? '' : "&$args") |
| 1957 | 1957 | . (!$ancre ? '' : "#$ancre"); |
| 1958 | 1958 | } |
@@ -2127,7 +2127,7 @@ discard block |
||
| 2127 | 2127 | !empty($_SERVER['QUERY_STRING']) |
| 2128 | 2128 | and !strpos($_SERVER['REQUEST_URI'], '?') |
| 2129 | 2129 | ) { |
| 2130 | - $GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; |
|
| 2130 | + $GLOBALS['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING']; |
|
| 2131 | 2131 | } |
| 2132 | 2132 | } |
| 2133 | 2133 | } |
@@ -2165,9 +2165,9 @@ discard block |
||
| 2165 | 2165 | array_shift($myself); |
| 2166 | 2166 | $myself = implode('/', $myself); |
| 2167 | 2167 | } |
| 2168 | - $url = join('/', array_slice(explode('/', $myself), 0, -1 - $prof)) . '/'; |
|
| 2168 | + $url = join('/', array_slice(explode('/', $myself), 0, -1 - $prof)).'/'; |
|
| 2169 | 2169 | |
| 2170 | - $url = $http . '://' . rtrim($host, '/') . '/' . ltrim($url, '/'); |
|
| 2170 | + $url = $http.'://'.rtrim($host, '/').'/'.ltrim($url, '/'); |
|
| 2171 | 2171 | |
| 2172 | 2172 | return $url; |
| 2173 | 2173 | } |
@@ -2206,16 +2206,16 @@ discard block |
||
| 2206 | 2206 | function generer_url_ecrire(?string $script = '', $args = '', $no_entities = false, $rel = false) { |
| 2207 | 2207 | $script ??= ''; |
| 2208 | 2208 | if (!$rel) { |
| 2209 | - $rel = url_de_base() . _DIR_RESTREINT_ABS . _SPIP_ECRIRE_SCRIPT; |
|
| 2209 | + $rel = url_de_base()._DIR_RESTREINT_ABS._SPIP_ECRIRE_SCRIPT; |
|
| 2210 | 2210 | } else { |
| 2211 | 2211 | if (!is_string($rel)) { |
| 2212 | - $rel = _DIR_RESTREINT ?: './' . _SPIP_ECRIRE_SCRIPT; |
|
| 2212 | + $rel = _DIR_RESTREINT ?: './'._SPIP_ECRIRE_SCRIPT; |
|
| 2213 | 2213 | } |
| 2214 | 2214 | } |
| 2215 | 2215 | |
| 2216 | 2216 | [$script, $ancre] = array_pad(explode('#', $script), 2, null); |
| 2217 | 2217 | if ($script and ($script <> 'accueil' or $rel)) { |
| 2218 | - $args = "?exec=$script" . (!$args ? '' : "&$args"); |
|
| 2218 | + $args = "?exec=$script".(!$args ? '' : "&$args"); |
|
| 2219 | 2219 | } elseif ($args) { |
| 2220 | 2220 | $args = "?$args"; |
| 2221 | 2221 | } |
@@ -2223,7 +2223,7 @@ discard block |
||
| 2223 | 2223 | $args .= "#$ancre"; |
| 2224 | 2224 | } |
| 2225 | 2225 | |
| 2226 | - return $rel . ($no_entities ? $args : str_replace('&', '&', $args)); |
|
| 2226 | + return $rel.($no_entities ? $args : str_replace('&', '&', $args)); |
|
| 2227 | 2227 | } |
| 2228 | 2228 | |
| 2229 | 2229 | // |
@@ -2305,10 +2305,10 @@ discard block |
||
| 2305 | 2305 | $action = parametre_url($action, _SPIP_PAGE, $script, '&'); |
| 2306 | 2306 | } |
| 2307 | 2307 | if ($args) { |
| 2308 | - $action .= (strpos($action, '?') !== false ? '&' : '?') . $args; |
|
| 2308 | + $action .= (strpos($action, '?') !== false ? '&' : '?').$args; |
|
| 2309 | 2309 | } |
| 2310 | 2310 | // ne pas generer une url avec /./?page= en cas d'url absolue et de _SPIP_SCRIPT vide |
| 2311 | - $url = ($rel ? _DIR_RACINE . $action : rtrim(url_de_base(), '/') . preg_replace(',^/[.]/,', '/', "/$action")); |
|
| 2311 | + $url = ($rel ? _DIR_RACINE . $action : rtrim(url_de_base(), '/').preg_replace(',^/[.]/,', '/', "/$action")); |
|
| 2312 | 2312 | } |
| 2313 | 2313 | |
| 2314 | 2314 | if (!$no_entities) { |
@@ -2320,7 +2320,7 @@ discard block |
||
| 2320 | 2320 | |
| 2321 | 2321 | function generer_url_prive($script, $args = '', $no_entities = false) { |
| 2322 | 2322 | |
| 2323 | - return generer_url_public($script, $args, $no_entities, false, _DIR_RESTREINT_ABS . 'prive.php'); |
|
| 2323 | + return generer_url_public($script, $args, $no_entities, false, _DIR_RESTREINT_ABS.'prive.php'); |
|
| 2324 | 2324 | } |
| 2325 | 2325 | |
| 2326 | 2326 | // Pour les formulaires en methode POST, |
@@ -2355,8 +2355,7 @@ discard block |
||
| 2355 | 2355 | . "><div>\n" |
| 2356 | 2356 | . "<input type='hidden' name='exec' value='$script1' />" |
| 2357 | 2357 | . $corps |
| 2358 | - . (!$submit ? '' : |
|
| 2359 | - ("<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><input class='fondo submit btn' type='submit' value=\"" . entites_html($submit) . '" /></div>')) |
|
| 2358 | + . (!$submit ? '' : ("<div style='text-align: ".$GLOBALS['spip_lang_right']."'><input class='fondo submit btn' type='submit' value=\"".entites_html($submit).'" /></div>')) |
|
| 2360 | 2359 | . "</div></form>\n"; |
| 2361 | 2360 | } |
| 2362 | 2361 | |
@@ -2381,14 +2380,14 @@ discard block |
||
| 2381 | 2380 | ? generer_url_ecrire(_request('exec')) |
| 2382 | 2381 | : generer_url_public(); |
| 2383 | 2382 | |
| 2384 | - return "\n<form action='" . |
|
| 2385 | - $h . |
|
| 2386 | - "'" . |
|
| 2387 | - $atts . |
|
| 2388 | - ">\n" . |
|
| 2389 | - '<div>' . |
|
| 2390 | - "\n<input type='hidden' name='action' value='$script' />" . |
|
| 2391 | - $corps . |
|
| 2383 | + return "\n<form action='". |
|
| 2384 | + $h. |
|
| 2385 | + "'". |
|
| 2386 | + $atts. |
|
| 2387 | + ">\n". |
|
| 2388 | + '<div>'. |
|
| 2389 | + "\n<input type='hidden' name='action' value='$script' />". |
|
| 2390 | + $corps. |
|
| 2392 | 2391 | '</div></form>'; |
| 2393 | 2392 | } |
| 2394 | 2393 | |
@@ -2416,7 +2415,7 @@ discard block |
||
| 2416 | 2415 | : generer_url_public('', '', false, false); |
| 2417 | 2416 | $url = parametre_url($url, 'action', $script); |
| 2418 | 2417 | if ($args) { |
| 2419 | - $url .= quote_amp('&' . $args); |
|
| 2418 | + $url .= quote_amp('&'.$args); |
|
| 2420 | 2419 | } |
| 2421 | 2420 | |
| 2422 | 2421 | if ($no_entities) { |
@@ -2450,9 +2449,9 @@ discard block |
||
| 2450 | 2449 | } |
| 2451 | 2450 | $url = |
| 2452 | 2451 | (($public ? _DIR_RACINE : _DIR_RESTREINT) ?: './') |
| 2453 | - . $script . '/' |
|
| 2452 | + . $script.'/' |
|
| 2454 | 2453 | . ($path ? trim($path, '/') : '') |
| 2455 | - . ($args ? '?' . quote_amp($args) : ''); |
|
| 2454 | + . ($args ? '?'.quote_amp($args) : ''); |
|
| 2456 | 2455 | |
| 2457 | 2456 | if ($no_entities) { |
| 2458 | 2457 | $url = str_replace('&', '&', $url); |
@@ -2501,22 +2500,22 @@ discard block |
||
| 2501 | 2500 | |
| 2502 | 2501 | // le nom du repertoire plugins/ activables/desactivables |
| 2503 | 2502 | if (!defined('_DIR_PLUGINS')) { |
| 2504 | - define('_DIR_PLUGINS', _DIR_RACINE . 'plugins/'); |
|
| 2503 | + define('_DIR_PLUGINS', _DIR_RACINE.'plugins/'); |
|
| 2505 | 2504 | } |
| 2506 | 2505 | |
| 2507 | 2506 | // le nom du repertoire des extensions/ permanentes du core, toujours actives |
| 2508 | 2507 | if (!defined('_DIR_PLUGINS_DIST')) { |
| 2509 | - define('_DIR_PLUGINS_DIST', _DIR_RACINE . 'plugins-dist/'); |
|
| 2508 | + define('_DIR_PLUGINS_DIST', _DIR_RACINE.'plugins-dist/'); |
|
| 2510 | 2509 | } |
| 2511 | 2510 | |
| 2512 | 2511 | // le nom du repertoire des librairies |
| 2513 | 2512 | if (!defined('_DIR_LIB')) { |
| 2514 | - define('_DIR_LIB', _DIR_RACINE . 'lib/'); |
|
| 2513 | + define('_DIR_LIB', _DIR_RACINE.'lib/'); |
|
| 2515 | 2514 | } |
| 2516 | 2515 | |
| 2517 | 2516 | // répertoire des libs via Composer |
| 2518 | 2517 | if (!defined('_DIR_VENDOR')) { |
| 2519 | - define('_DIR_VENDOR', _DIR_RACINE . 'vendor/'); |
|
| 2518 | + define('_DIR_VENDOR', _DIR_RACINE.'vendor/'); |
|
| 2520 | 2519 | } |
| 2521 | 2520 | |
| 2522 | 2521 | if (!defined('_DIR_IMG')) { |
@@ -2526,29 +2525,29 @@ discard block |
||
| 2526 | 2525 | define('_DIR_LOGOS', $pa); |
| 2527 | 2526 | } |
| 2528 | 2527 | if (!defined('_DIR_IMG_ICONES')) { |
| 2529 | - define('_DIR_IMG_ICONES', _DIR_LOGOS . 'icones/'); |
|
| 2528 | + define('_DIR_IMG_ICONES', _DIR_LOGOS.'icones/'); |
|
| 2530 | 2529 | } |
| 2531 | 2530 | |
| 2532 | 2531 | if (!defined('_DIR_DUMP')) { |
| 2533 | - define('_DIR_DUMP', $ti . 'dump/'); |
|
| 2532 | + define('_DIR_DUMP', $ti.'dump/'); |
|
| 2534 | 2533 | } |
| 2535 | 2534 | if (!defined('_DIR_SESSIONS')) { |
| 2536 | - define('_DIR_SESSIONS', $ti . 'sessions/'); |
|
| 2535 | + define('_DIR_SESSIONS', $ti.'sessions/'); |
|
| 2537 | 2536 | } |
| 2538 | 2537 | if (!defined('_DIR_TRANSFERT')) { |
| 2539 | - define('_DIR_TRANSFERT', $ti . 'upload/'); |
|
| 2538 | + define('_DIR_TRANSFERT', $ti.'upload/'); |
|
| 2540 | 2539 | } |
| 2541 | 2540 | if (!defined('_DIR_CACHE')) { |
| 2542 | - define('_DIR_CACHE', $ti . 'cache/'); |
|
| 2541 | + define('_DIR_CACHE', $ti.'cache/'); |
|
| 2543 | 2542 | } |
| 2544 | 2543 | if (!defined('_DIR_CACHE_XML')) { |
| 2545 | - define('_DIR_CACHE_XML', _DIR_CACHE . 'xml/'); |
|
| 2544 | + define('_DIR_CACHE_XML', _DIR_CACHE.'xml/'); |
|
| 2546 | 2545 | } |
| 2547 | 2546 | if (!defined('_DIR_SKELS')) { |
| 2548 | - define('_DIR_SKELS', _DIR_CACHE . 'skel/'); |
|
| 2547 | + define('_DIR_SKELS', _DIR_CACHE.'skel/'); |
|
| 2549 | 2548 | } |
| 2550 | 2549 | if (!defined('_DIR_AIDE')) { |
| 2551 | - define('_DIR_AIDE', _DIR_CACHE . 'aide/'); |
|
| 2550 | + define('_DIR_AIDE', _DIR_CACHE.'aide/'); |
|
| 2552 | 2551 | } |
| 2553 | 2552 | if (!defined('_DIR_TMP')) { |
| 2554 | 2553 | define('_DIR_TMP', $ti); |
@@ -2577,27 +2576,27 @@ discard block |
||
| 2577 | 2576 | // Declaration des fichiers |
| 2578 | 2577 | |
| 2579 | 2578 | if (!defined('_CACHE_PLUGINS_PATH')) { |
| 2580 | - define('_CACHE_PLUGINS_PATH', _DIR_CACHE . 'charger_plugins_chemins.php'); |
|
| 2579 | + define('_CACHE_PLUGINS_PATH', _DIR_CACHE.'charger_plugins_chemins.php'); |
|
| 2581 | 2580 | } |
| 2582 | 2581 | if (!defined('_CACHE_PLUGINS_OPT')) { |
| 2583 | - define('_CACHE_PLUGINS_OPT', _DIR_CACHE . 'charger_plugins_options.php'); |
|
| 2582 | + define('_CACHE_PLUGINS_OPT', _DIR_CACHE.'charger_plugins_options.php'); |
|
| 2584 | 2583 | } |
| 2585 | 2584 | if (!defined('_CACHE_PLUGINS_FCT')) { |
| 2586 | - define('_CACHE_PLUGINS_FCT', _DIR_CACHE . 'charger_plugins_fonctions.php'); |
|
| 2585 | + define('_CACHE_PLUGINS_FCT', _DIR_CACHE.'charger_plugins_fonctions.php'); |
|
| 2587 | 2586 | } |
| 2588 | 2587 | if (!defined('_CACHE_PIPELINES')) { |
| 2589 | - define('_CACHE_PIPELINES', _DIR_CACHE . 'charger_pipelines.php'); |
|
| 2588 | + define('_CACHE_PIPELINES', _DIR_CACHE.'charger_pipelines.php'); |
|
| 2590 | 2589 | } |
| 2591 | 2590 | if (!defined('_CACHE_CHEMIN')) { |
| 2592 | - define('_CACHE_CHEMIN', _DIR_CACHE . 'chemin.txt'); |
|
| 2591 | + define('_CACHE_CHEMIN', _DIR_CACHE.'chemin.txt'); |
|
| 2593 | 2592 | } |
| 2594 | 2593 | |
| 2595 | 2594 | # attention .php obligatoire pour ecrire_fichier_securise |
| 2596 | 2595 | if (!defined('_FILE_META')) { |
| 2597 | - define('_FILE_META', $ti . 'meta_cache.php'); |
|
| 2596 | + define('_FILE_META', $ti.'meta_cache.php'); |
|
| 2598 | 2597 | } |
| 2599 | 2598 | if (!defined('_DIR_LOG')) { |
| 2600 | - define('_DIR_LOG', _DIR_TMP . 'log/'); |
|
| 2599 | + define('_DIR_LOG', _DIR_TMP.'log/'); |
|
| 2601 | 2600 | } |
| 2602 | 2601 | if (!defined('_FILE_LOG')) { |
| 2603 | 2602 | define('_FILE_LOG', 'spip'); |
@@ -2614,8 +2613,8 @@ discard block |
||
| 2614 | 2613 | if (!defined('_FILE_CONNECT')) { |
| 2615 | 2614 | define( |
| 2616 | 2615 | '_FILE_CONNECT', |
| 2617 | - (@is_readable($f = _DIR_CONNECT . _FILE_CONNECT_INS . '.php') ? $f |
|
| 2618 | - : (@is_readable($f = _DIR_RESTREINT . 'inc_connect.php') ? $f |
|
| 2616 | + (@is_readable($f = _DIR_CONNECT._FILE_CONNECT_INS.'.php') ? $f |
|
| 2617 | + : (@is_readable($f = _DIR_RESTREINT.'inc_connect.php') ? $f |
|
| 2619 | 2618 | : false)) |
| 2620 | 2619 | ); |
| 2621 | 2620 | } |
@@ -2627,7 +2626,7 @@ discard block |
||
| 2627 | 2626 | if (!defined('_FILE_CHMOD')) { |
| 2628 | 2627 | define( |
| 2629 | 2628 | '_FILE_CHMOD', |
| 2630 | - (@is_readable($f = _DIR_CHMOD . _FILE_CHMOD_INS . '.php') ? $f |
|
| 2629 | + (@is_readable($f = _DIR_CHMOD._FILE_CHMOD_INS.'.php') ? $f |
|
| 2631 | 2630 | : false) |
| 2632 | 2631 | ); |
| 2633 | 2632 | } |
@@ -2640,10 +2639,10 @@ discard block |
||
| 2640 | 2639 | define('_FILE_TMP_SUFFIX', '.tmp.php'); |
| 2641 | 2640 | } |
| 2642 | 2641 | if (!defined('_FILE_CONNECT_TMP')) { |
| 2643 | - define('_FILE_CONNECT_TMP', _DIR_CONNECT . _FILE_CONNECT_INS . _FILE_TMP_SUFFIX); |
|
| 2642 | + define('_FILE_CONNECT_TMP', _DIR_CONNECT._FILE_CONNECT_INS._FILE_TMP_SUFFIX); |
|
| 2644 | 2643 | } |
| 2645 | 2644 | if (!defined('_FILE_CHMOD_TMP')) { |
| 2646 | - define('_FILE_CHMOD_TMP', _DIR_CHMOD . _FILE_CHMOD_INS . _FILE_TMP_SUFFIX); |
|
| 2645 | + define('_FILE_CHMOD_TMP', _DIR_CHMOD._FILE_CHMOD_INS._FILE_TMP_SUFFIX); |
|
| 2647 | 2646 | } |
| 2648 | 2647 | |
| 2649 | 2648 | // Definition des droits d'acces en ecriture |
@@ -2661,13 +2660,13 @@ discard block |
||
| 2661 | 2660 | define('_DEFAULT_CHARSET', 'utf-8'); |
| 2662 | 2661 | } |
| 2663 | 2662 | if (!defined('_ROOT_PLUGINS')) { |
| 2664 | - define('_ROOT_PLUGINS', _ROOT_RACINE . 'plugins/'); |
|
| 2663 | + define('_ROOT_PLUGINS', _ROOT_RACINE.'plugins/'); |
|
| 2665 | 2664 | } |
| 2666 | 2665 | if (!defined('_ROOT_PLUGINS_DIST')) { |
| 2667 | - define('_ROOT_PLUGINS_DIST', _ROOT_RACINE . 'plugins-dist/'); |
|
| 2666 | + define('_ROOT_PLUGINS_DIST', _ROOT_RACINE.'plugins-dist/'); |
|
| 2668 | 2667 | } |
| 2669 | 2668 | if (!defined('_ROOT_PLUGINS_SUPPL') && defined('_DIR_PLUGINS_SUPPL') && _DIR_PLUGINS_SUPPL) { |
| 2670 | - define('_ROOT_PLUGINS_SUPPL', _ROOT_RACINE . str_replace(_DIR_RACINE, '', _DIR_PLUGINS_SUPPL)); |
|
| 2669 | + define('_ROOT_PLUGINS_SUPPL', _ROOT_RACINE.str_replace(_DIR_RACINE, '', _DIR_PLUGINS_SUPPL)); |
|
| 2671 | 2670 | } |
| 2672 | 2671 | |
| 2673 | 2672 | // La taille des Log |
@@ -2704,7 +2703,7 @@ discard block |
||
| 2704 | 2703 | // (non surchargeable en l'etat ; attention si on utilise include_spip() |
| 2705 | 2704 | // pour le rendre surchargeable, on va provoquer un reecriture |
| 2706 | 2705 | // systematique du noyau ou une baisse de perfs => a etudier) |
| 2707 | - include_once _ROOT_RESTREINT . 'inc/flock.php'; |
|
| 2706 | + include_once _ROOT_RESTREINT.'inc/flock.php'; |
|
| 2708 | 2707 | |
| 2709 | 2708 | // charger tout de suite le path et son cache |
| 2710 | 2709 | load_path_cache(); |
@@ -2740,7 +2739,7 @@ discard block |
||
| 2740 | 2739 | !empty($_SERVER['QUERY_STRING']) |
| 2741 | 2740 | and !strpos($_SERVER['REQUEST_URI'], '?') |
| 2742 | 2741 | ) { |
| 2743 | - $GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; |
|
| 2742 | + $GLOBALS['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING']; |
|
| 2744 | 2743 | } |
| 2745 | 2744 | } |
| 2746 | 2745 | |
@@ -2776,7 +2775,7 @@ discard block |
||
| 2776 | 2775 | ) { |
| 2777 | 2776 | if (isset($GLOBALS['meta']['adresse_site'])) { |
| 2778 | 2777 | $uri_ref = parse_url($GLOBALS['meta']['adresse_site']); |
| 2779 | - $uri_ref = ($uri_ref['path'] ?? '') . '/'; |
|
| 2778 | + $uri_ref = ($uri_ref['path'] ?? '').'/'; |
|
| 2780 | 2779 | } else { |
| 2781 | 2780 | $uri_ref = ''; |
| 2782 | 2781 | } |
@@ -2870,7 +2869,7 @@ discard block |
||
| 2870 | 2869 | } |
| 2871 | 2870 | if (!defined('_CACHE_RUBRIQUES')) { |
| 2872 | 2871 | /** Fichier cache pour le navigateur de rubrique du bandeau */ |
| 2873 | - define('_CACHE_RUBRIQUES', _DIR_TMP . 'menu-rubriques-cache.txt'); |
|
| 2872 | + define('_CACHE_RUBRIQUES', _DIR_TMP.'menu-rubriques-cache.txt'); |
|
| 2874 | 2873 | } |
| 2875 | 2874 | if (!defined('_CACHE_RUBRIQUES_MAX')) { |
| 2876 | 2875 | /** Nombre maxi de rubriques enfants affichées pour chaque rubrique du navigateur de rubrique du bandeau */ |
@@ -3092,7 +3091,7 @@ discard block |
||
| 3092 | 3091 | } |
| 3093 | 3092 | if (isset($GLOBALS['visiteur_session']['nom'])) { |
| 3094 | 3093 | spip_log($GLOBALS['visiteur_session']['nom'] |
| 3095 | - . ' ' . _VAR_MODE); |
|
| 3094 | + . ' '._VAR_MODE); |
|
| 3096 | 3095 | } |
| 3097 | 3096 | } // pas autorise ? |
| 3098 | 3097 | else { |
@@ -3107,7 +3106,7 @@ discard block |
||
| 3107 | 3106 | if (strpos($self, 'page=login') === false) { |
| 3108 | 3107 | include_spip('inc/headers'); |
| 3109 | 3108 | $redirect = parametre_url(self('&', true), 'var_mode', $_GET['var_mode'], '&'); |
| 3110 | - redirige_par_entete(generer_url_public('login', 'url=' . rawurlencode($redirect), true)); |
|
| 3109 | + redirige_par_entete(generer_url_public('login', 'url='.rawurlencode($redirect), true)); |
|
| 3111 | 3110 | } |
| 3112 | 3111 | } |
| 3113 | 3112 | // sinon tant pis |
@@ -3157,10 +3156,10 @@ discard block |
||
| 3157 | 3156 | **/ |
| 3158 | 3157 | function verifier_visiteur() { |
| 3159 | 3158 | @spip_initialisation_core( |
| 3160 | - (_DIR_RACINE . _NOM_PERMANENTS_INACCESSIBLES), |
|
| 3161 | - (_DIR_RACINE . _NOM_PERMANENTS_ACCESSIBLES), |
|
| 3162 | - (_DIR_RACINE . _NOM_TEMPORAIRES_INACCESSIBLES), |
|
| 3163 | - (_DIR_RACINE . _NOM_TEMPORAIRES_ACCESSIBLES) |
|
| 3159 | + (_DIR_RACINE._NOM_PERMANENTS_INACCESSIBLES), |
|
| 3160 | + (_DIR_RACINE._NOM_PERMANENTS_ACCESSIBLES), |
|
| 3161 | + (_DIR_RACINE._NOM_TEMPORAIRES_INACCESSIBLES), |
|
| 3162 | + (_DIR_RACINE._NOM_TEMPORAIRES_ACCESSIBLES) |
|
| 3164 | 3163 | ); |
| 3165 | 3164 | |
| 3166 | 3165 | // Demarrer une session NON AUTHENTIFIEE si on donne son nom |
@@ -3193,7 +3192,7 @@ discard block |
||
| 3193 | 3192 | } |
| 3194 | 3193 | |
| 3195 | 3194 | $h = (isset($_SERVER['PHP_AUTH_USER']) and !$GLOBALS['ignore_auth_http']); |
| 3196 | - if ($h or isset($_COOKIE['spip_session']) or isset($_COOKIE[$GLOBALS['cookie_prefix'] . '_session'])) { |
|
| 3195 | + if ($h or isset($_COOKIE['spip_session']) or isset($_COOKIE[$GLOBALS['cookie_prefix'].'_session'])) { |
|
| 3197 | 3196 | $session = charger_fonction('session', 'inc'); |
| 3198 | 3197 | if ($session()) { |
| 3199 | 3198 | return $GLOBALS['visiteur_session']['statut']; |
@@ -3273,7 +3272,7 @@ discard block |
||
| 3273 | 3272 | 'definir_session', |
| 3274 | 3273 | $GLOBALS['visiteur_session'] |
| 3275 | 3274 | ? serialize($GLOBALS['visiteur_session']) |
| 3276 | - . '_' . @$_COOKIE['spip_session'] |
|
| 3275 | + . '_'.@$_COOKIE['spip_session'] |
|
| 3277 | 3276 | : '' |
| 3278 | 3277 | ); |
| 3279 | 3278 | $session = $s ? substr(md5($s), 0, 8) : ''; |
@@ -3321,8 +3320,8 @@ discard block |
||
| 3321 | 3320 | foreach ($cookies_masques as $k) { |
| 3322 | 3321 | if (!empty($_COOKIE[$k])) { |
| 3323 | 3322 | $cookies_backup[$k] = $_COOKIE[$k]; |
| 3324 | - $_SERVER['HTTP_COOKIE'] = str_replace("$k=" . $_COOKIE[$k], "$k=$mask", $_SERVER['HTTP_COOKIE'] ?? []); |
|
| 3325 | - $_ENV['HTTP_COOKIE'] = str_replace("$k=" . $_COOKIE[$k], "$k=$mask", $_ENV['HTTP_COOKIE'] ?? []); |
|
| 3323 | + $_SERVER['HTTP_COOKIE'] = str_replace("$k=".$_COOKIE[$k], "$k=$mask", $_SERVER['HTTP_COOKIE'] ?? []); |
|
| 3324 | + $_ENV['HTTP_COOKIE'] = str_replace("$k=".$_COOKIE[$k], "$k=$mask", $_ENV['HTTP_COOKIE'] ?? []); |
|
| 3326 | 3325 | $_COOKIE[$k] = $mask; |
| 3327 | 3326 | } |
| 3328 | 3327 | } |
@@ -3440,11 +3439,11 @@ discard block |
||
| 3440 | 3439 | $GLOBALS['_INC_PUBLIC']++; |
| 3441 | 3440 | |
| 3442 | 3441 | // fix #4235 |
| 3443 | - $cache_utilise_session_appelant = ($GLOBALS['cache_utilise_session'] ?? null); |
|
| 3442 | + $cache_utilise_session_appelant = ($GLOBALS['cache_utilise_session'] ?? null); |
|
| 3444 | 3443 | |
| 3445 | 3444 | |
| 3446 | 3445 | foreach (is_array($fond) ? $fond : [$fond] as $f) { |
| 3447 | - unset($GLOBALS['cache_utilise_session']); // fix #4235 |
|
| 3446 | + unset($GLOBALS['cache_utilise_session']); // fix #4235 |
|
| 3448 | 3447 | |
| 3449 | 3448 | $page = evaluer_fond($f, $contexte, $connect); |
| 3450 | 3449 | if ($page === '') { |
@@ -3529,7 +3528,7 @@ discard block |
||
| 3529 | 3528 | * @return array|string |
| 3530 | 3529 | */ |
| 3531 | 3530 | function trouver_fond($nom, $dir = '', $pathinfo = false) { |
| 3532 | - $f = find_in_path($nom . '.' . _EXTENSION_SQUELETTES, $dir ? rtrim($dir, '/') . '/' : ''); |
|
| 3531 | + $f = find_in_path($nom.'.'._EXTENSION_SQUELETTES, $dir ? rtrim($dir, '/').'/' : ''); |
|
| 3533 | 3532 | if (!$pathinfo) { |
| 3534 | 3533 | return $f; |
| 3535 | 3534 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $charset = 'cp1256'; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if (find_in_path($charset . '.php', 'charsets/', true)) { |
|
| 93 | + if (find_in_path($charset.'.php', 'charsets/', true)) { |
|
| 94 | 94 | return $charset; |
| 95 | 95 | } else { |
| 96 | 96 | spip_log("Erreur: pas de fichier de conversion 'charsets/$charset'"); |
@@ -195,38 +195,38 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | if (!isset($trans[$charset][$charset_cible])) { |
| 197 | 197 | $trans[$charset][$charset_cible] = [ |
| 198 | - $p . chr(128) => '€', |
|
| 199 | - $p . chr(129) => ' ', # pas affecte |
|
| 200 | - $p . chr(130) => '‚', |
|
| 201 | - $p . chr(131) => 'ƒ', |
|
| 202 | - $p . chr(132) => '„', |
|
| 203 | - $p . chr(133) => '…', |
|
| 204 | - $p . chr(134) => '†', |
|
| 205 | - $p . chr(135) => '‡', |
|
| 206 | - $p . chr(136) => 'ˆ', |
|
| 207 | - $p . chr(137) => '‰', |
|
| 208 | - $p . chr(138) => 'Š', |
|
| 209 | - $p . chr(139) => '‹', |
|
| 210 | - $p . chr(140) => 'Œ', |
|
| 211 | - $p . chr(141) => ' ', # pas affecte |
|
| 212 | - $p . chr(142) => 'Ž', |
|
| 213 | - $p . chr(143) => ' ', # pas affecte |
|
| 214 | - $p . chr(144) => ' ', # pas affecte |
|
| 215 | - $p . chr(145) => '‘', |
|
| 216 | - $p . chr(146) => '’', |
|
| 217 | - $p . chr(147) => '“', |
|
| 218 | - $p . chr(148) => '”', |
|
| 219 | - $p . chr(149) => '•', |
|
| 220 | - $p . chr(150) => '–', |
|
| 221 | - $p . chr(151) => '—', |
|
| 222 | - $p . chr(152) => '˜', |
|
| 223 | - $p . chr(153) => '™', |
|
| 224 | - $p . chr(154) => 'š', |
|
| 225 | - $p . chr(155) => '›', |
|
| 226 | - $p . chr(156) => 'œ', |
|
| 227 | - $p . chr(157) => ' ', # pas affecte |
|
| 228 | - $p . chr(158) => 'ž', |
|
| 229 | - $p . chr(159) => 'Ÿ', |
|
| 198 | + $p.chr(128) => '€', |
|
| 199 | + $p.chr(129) => ' ', # pas affecte |
|
| 200 | + $p.chr(130) => '‚', |
|
| 201 | + $p.chr(131) => 'ƒ', |
|
| 202 | + $p.chr(132) => '„', |
|
| 203 | + $p.chr(133) => '…', |
|
| 204 | + $p.chr(134) => '†', |
|
| 205 | + $p.chr(135) => '‡', |
|
| 206 | + $p.chr(136) => 'ˆ', |
|
| 207 | + $p.chr(137) => '‰', |
|
| 208 | + $p.chr(138) => 'Š', |
|
| 209 | + $p.chr(139) => '‹', |
|
| 210 | + $p.chr(140) => 'Œ', |
|
| 211 | + $p.chr(141) => ' ', # pas affecte |
|
| 212 | + $p.chr(142) => 'Ž', |
|
| 213 | + $p.chr(143) => ' ', # pas affecte |
|
| 214 | + $p.chr(144) => ' ', # pas affecte |
|
| 215 | + $p.chr(145) => '‘', |
|
| 216 | + $p.chr(146) => '’', |
|
| 217 | + $p.chr(147) => '“', |
|
| 218 | + $p.chr(148) => '”', |
|
| 219 | + $p.chr(149) => '•', |
|
| 220 | + $p.chr(150) => '–', |
|
| 221 | + $p.chr(151) => '—', |
|
| 222 | + $p.chr(152) => '˜', |
|
| 223 | + $p.chr(153) => '™', |
|
| 224 | + $p.chr(154) => 'š', |
|
| 225 | + $p.chr(155) => '›', |
|
| 226 | + $p.chr(156) => 'œ', |
|
| 227 | + $p.chr(157) => ' ', # pas affecte |
|
| 228 | + $p.chr(158) => 'ž', |
|
| 229 | + $p.chr(159) => 'Ÿ', |
|
| 230 | 230 | ]; |
| 231 | 231 | if ($charset_cible != 'unicode') { |
| 232 | 232 | foreach ($trans[$charset][$charset_cible] as $k => $c) { |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | and is_array($GLOBALS['CHARSET'][$cset]) |
| 368 | 368 | ) { |
| 369 | 369 | foreach ($GLOBALS['CHARSET'][$cset] as $key => $val) { |
| 370 | - $trans[$charset][chr($key)] = '&#' . $val . ';'; |
|
| 370 | + $trans[$charset][chr($key)] = '&#'.$val.';'; |
|
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | } |
@@ -433,11 +433,11 @@ discard block |
||
| 433 | 433 | $h = dechex($e); |
| 434 | 434 | if ($s = isset($CHARSET_REVERSE[$charset][$e])) { |
| 435 | 435 | $s = $CHARSET_REVERSE[$charset][$e]; |
| 436 | - $t['&#' . $e . ';'] = $t['�' . $e . ';'] = $t['�' . $e . ';'] = chr($s); |
|
| 437 | - $t['&#x' . $h . ';'] = $t['�' . $h . ';'] = $t['�' . $h . ';'] = chr($s); |
|
| 436 | + $t['&#'.$e.';'] = $t['�'.$e.';'] = $t['�'.$e.';'] = chr($s); |
|
| 437 | + $t['&#x'.$h.';'] = $t['�'.$h.';'] = $t['�'.$h.';'] = chr($s); |
|
| 438 | 438 | } else { |
| 439 | - $t['&#' . $e . ';'] = $t['�' . $e . ';'] = $t['�' . $e . ';'] = chr($e); |
|
| 440 | - $t['&#x' . $h . ';'] = $t['�' . $h . ';'] = $t['�' . $h . ';'] = chr($e); |
|
| 439 | + $t['&#'.$e.';'] = $t['�'.$e.';'] = $t['�'.$e.';'] = chr($e); |
|
| 440 | + $t['&#x'.$h.';'] = $t['�'.$h.';'] = $t['�'.$h.';'] = chr($e); |
|
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | } |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | and is_array($GLOBALS['CHARSET'][$cset]) |
| 485 | 485 | ) { |
| 486 | 486 | foreach ($GLOBALS['CHARSET'][$cset] as $key => $val) { |
| 487 | - $trans[$charset][chr($key)] = unicode2charset('&#' . $val . ';'); |
|
| 487 | + $trans[$charset][chr($key)] = unicode2charset('&#'.$val.';'); |
|
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | 490 | } |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | } |
| 592 | 592 | $thisPos++; |
| 593 | 593 | } |
| 594 | - $encodedLetter = '&#' . preg_replace('/^0+/', '', $decimalCode) . ';'; |
|
| 594 | + $encodedLetter = '&#'.preg_replace('/^0+/', '', $decimalCode).';'; |
|
| 595 | 595 | $encodedString .= $encodedLetter; |
| 596 | 596 | } |
| 597 | 597 | } |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | } // ignorer le BOM - http://www.unicode.org/faq/utf_bom.html |
| 635 | 635 | else { |
| 636 | 636 | if ($word != 65279) { |
| 637 | - $texte .= '&#' . $word . ';'; |
|
| 637 | + $texte .= '&#'.$word.';'; |
|
| 638 | 638 | } |
| 639 | 639 | } |
| 640 | 640 | } |
@@ -662,13 +662,13 @@ discard block |
||
| 662 | 662 | return chr($num); |
| 663 | 663 | } |
| 664 | 664 | if ($num < 2048) { |
| 665 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
| 665 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
| 666 | 666 | } |
| 667 | 667 | if ($num < 65536) { |
| 668 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 668 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 669 | 669 | } |
| 670 | 670 | if ($num < 1_114_112) { |
| 671 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 671 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | return ''; |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | while (preg_match(',�*([0-9]+);,S', $texte, $regs) and !isset($vu[$regs[1]])) { |
| 736 | 736 | $num = $regs[1]; |
| 737 | 737 | $vu[$num] = true; |
| 738 | - $s = '\u' . sprintf('%04x', $num); |
|
| 738 | + $s = '\u'.sprintf('%04x', $num); |
|
| 739 | 739 | $texte = str_replace($regs[0], $s, $texte); |
| 740 | 740 | } |
| 741 | 741 | |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | **/ |
| 753 | 753 | function javascript_to_unicode($texte) { |
| 754 | 754 | while (preg_match(',%u([0-9A-F][0-9A-F][0-9A-F][0-9A-F]),', $texte, $regs)) { |
| 755 | - $texte = str_replace($regs[0], '&#' . hexdec($regs[1]) . ';', $texte); |
|
| 755 | + $texte = str_replace($regs[0], '&#'.hexdec($regs[1]).';', $texte); |
|
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | return $texte; |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | return $texte; |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | - $table_translit = 'translit' . $complexe; |
|
| 800 | + $table_translit = 'translit'.$complexe; |
|
| 801 | 801 | |
| 802 | 802 | // 2. Translitterer grace a la table predefinie |
| 803 | 803 | if (!isset($trans[$complexe])) { |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | * true s'il a un BOM |
| 889 | 889 | **/ |
| 890 | 890 | function bom_utf8($texte): bool { |
| 891 | - return (substr($texte, 0, 3) === chr(0xEF) . chr(0xBB) . chr(0xBF)); |
|
| 891 | + return (substr($texte, 0, 3) === chr(0xEF).chr(0xBB).chr(0xBF)); |
|
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | /** |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | |
| 1059 | 1059 | $lettre1 = mb_strtoupper(spip_substr($c, 0, 1)); |
| 1060 | 1060 | |
| 1061 | - return $lettre1 . spip_substr($c, 1); |
|
| 1061 | + return $lettre1.spip_substr($c, 1); |
|
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | 1064 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $res = admin_repair_tables(); |
| 40 | 40 | if (!$res) { |
| 41 | - $res = "<div class='error'>" . _T('avis_erreur_mysql') . ' ' . sql_errno() . ': ' . sql_error() . "</div>\n"; |
|
| 41 | + $res = "<div class='error'>"._T('avis_erreur_mysql').' '.sql_errno().': '.sql_error()."</div>\n"; |
|
| 42 | 42 | } else { |
| 43 | 43 | include_spip('inc/rubriques'); |
| 44 | 44 | calculer_rubriques(); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $res .= pipeline('base_admin_repair', $res); |
| 49 | 49 | echo minipres( |
| 50 | 50 | _T('texte_tentative_recuperation'), |
| 51 | - $res . generer_form_ecrire('accueil', '', '', _T('public:accueil_site')) |
|
| 51 | + $res.generer_form_ecrire('accueil', '', '', _T('public:accueil_site')) |
|
| 52 | 52 | ); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -91,12 +91,12 @@ discard block |
||
| 91 | 91 | $count = sql_countsel($tab); |
| 92 | 92 | |
| 93 | 93 | if ($count > 1) { |
| 94 | - $m .= '(' . _T('texte_compte_elements', ['count' => $count]) . ")\n"; |
|
| 94 | + $m .= '('._T('texte_compte_elements', ['count' => $count]).")\n"; |
|
| 95 | 95 | } else { |
| 96 | 96 | if ($count == 1) { |
| 97 | - $m .= '(' . _T('texte_compte_element', ['count' => $count]) . ")\n"; |
|
| 97 | + $m .= '('._T('texte_compte_element', ['count' => $count]).")\n"; |
|
| 98 | 98 | } else { |
| 99 | - $m .= '(' . _T('texte_vide') . ")\n"; |
|
| 99 | + $m .= '('._T('texte_vide').")\n"; |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | and $msg = join( |
| 106 | 106 | ' ', |
| 107 | 107 | (is_resource($result_repair) or is_object($result_repair)) ? sql_fetch($result_repair) : $result_repair |
| 108 | - ) . ' ' |
|
| 108 | + ).' ' |
|
| 109 | 109 | and !str_contains($msg, ' OK ') |
| 110 | 110 | ) { |
| 111 | 111 | $class = " class='notice'"; |
| 112 | - $m .= '<br /><tt>' . spip_htmlentities($msg) . "</tt>\n"; |
|
| 112 | + $m .= '<br /><tt>'.spip_htmlentities($msg)."</tt>\n"; |
|
| 113 | 113 | } else { |
| 114 | - $m .= ' ' . _T('texte_table_ok'); |
|
| 114 | + $m .= ' '._T('texte_table_ok'); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $res .= "<div$class>$m</div>"; |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | $t = $phraseur->ouvrant[$depth] ?? ' '; |
| 46 | 46 | // espace initial signifie: deja integree au resultat |
| 47 | 47 | if ($t[0] != ' ') { |
| 48 | - $phraseur->res .= '<' . $t . '>'; |
|
| 49 | - $phraseur->ouvrant[$depth] = ' ' . $t; |
|
| 48 | + $phraseur->res .= '<'.$t.'>'; |
|
| 49 | + $phraseur->ouvrant[$depth] = ' '.$t; |
|
| 50 | 50 | } |
| 51 | 51 | $t = $phraseur->contenu[$depth]; |
| 52 | 52 | // n'indenter que s'il y a un separateur avant |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | foreach ($attrs as $k => $v) { |
| 58 | 58 | $delim = !str_contains($v, "'") ? "'" : '"'; |
| 59 | 59 | $val = xml_entites_html($v); |
| 60 | - $att .= $sep . $k . '=' . $delim |
|
| 60 | + $att .= $sep.$k.'='.$delim |
|
| 61 | 61 | . ($delim !== '"' ? str_replace('"', '"', $val) : $val) |
| 62 | 62 | . $delim; |
| 63 | 63 | $sep = "\n $depth"; |
| 64 | 64 | } |
| 65 | 65 | $phraseur->depth .= ' '; |
| 66 | 66 | $phraseur->contenu[$phraseur->depth] = ''; |
| 67 | - $phraseur->ouvrant[$phraseur->depth] = $name . $att; |
|
| 67 | + $phraseur->ouvrant[$phraseur->depth] = $name.$att; |
|
| 68 | 68 | $phraseur->reperes[$phraseur->depth] = xml_get_current_line_number($phraseur->sax); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -72,13 +72,13 @@ discard block |
||
| 72 | 72 | $ouv = $phraseur->ouvrant[$phraseur->depth]; |
| 73 | 73 | |
| 74 | 74 | if ($ouv[0] != ' ') { |
| 75 | - $phraseur->ouvrant[$phraseur->depth] = ' ' . $ouv; |
|
| 75 | + $phraseur->ouvrant[$phraseur->depth] = ' '.$ouv; |
|
| 76 | 76 | } else { |
| 77 | 77 | $ouv = ''; |
| 78 | 78 | } |
| 79 | 79 | $t = $phraseur->contenu[$phraseur->depth]; |
| 80 | 80 | $phraseur->depth = substr($phraseur->depth, 2); |
| 81 | - $t = preg_replace("/[\n\t ]+$/", "\n" . $phraseur->depth, $t); |
|
| 81 | + $t = preg_replace("/[\n\t ]+$/", "\n".$phraseur->depth, $t); |
|
| 82 | 82 | |
| 83 | 83 | // fusion <balise></balise> en <balise />. |
| 84 | 84 | // ATTENTION, certains clients http croient que fusion ==> pas d'atttributs |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | // (param fusion_bal) |
| 88 | 88 | |
| 89 | 89 | if ($t || (($ouv != $name) and !$fusion_bal)) { |
| 90 | - $phraseur->res .= ($ouv ? ('<' . $ouv . '>') : '') . $t . '</' . $name . '>'; |
|
| 90 | + $phraseur->res .= ($ouv ? ('<'.$ouv.'>') : '').$t.'</'.$name.'>'; |
|
| 91 | 91 | } else { |
| 92 | - $phraseur->res .= ($ouv ? ('<' . $ouv . ' />') : ('</' . $name . '>')); |
|
| 92 | + $phraseur->res .= ($ouv ? ('<'.$ouv.' />') : ('</'.$name.'>')); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -131,16 +131,15 @@ discard block |
||
| 131 | 131 | coordonnees_erreur( |
| 132 | 132 | $phraseur, |
| 133 | 133 | xml_error_string(xml_get_error_code($phraseur->sax)) |
| 134 | - . "<br />\n" . |
|
| 135 | - (!$phraseur->depth ? '' : |
|
| 136 | - ('(' . |
|
| 137 | - _T('erreur_balise_non_fermee') . |
|
| 138 | - ' <tt>' . |
|
| 139 | - $phraseur->ouvrant[$phraseur->depth] . |
|
| 140 | - '</tt> ' . |
|
| 141 | - _T('ligne') . |
|
| 142 | - ' ' . |
|
| 143 | - $phraseur->reperes[$phraseur->depth] . |
|
| 134 | + . "<br />\n". |
|
| 135 | + (!$phraseur->depth ? '' : ('('. |
|
| 136 | + _T('erreur_balise_non_fermee'). |
|
| 137 | + ' <tt>'. |
|
| 138 | + $phraseur->ouvrant[$phraseur->depth]. |
|
| 139 | + '</tt> '. |
|
| 140 | + _T('ligne'). |
|
| 141 | + ' '. |
|
| 142 | + $phraseur->reperes[$phraseur->depth]. |
|
| 144 | 143 | ") <br />\n")) |
| 145 | 144 | ); |
| 146 | 145 | } |
@@ -181,7 +180,7 @@ discard block |
||
| 181 | 180 | // et escamoter le doctype que sax mange en php5 mais pas en php4 |
| 182 | 181 | if (!$doctype) { |
| 183 | 182 | if (!$r = analyser_doctype($page)) { |
| 184 | - $page = _MESSAGE_DOCTYPE . _DOCTYPE_ECRIRE |
|
| 183 | + $page = _MESSAGE_DOCTYPE._DOCTYPE_ECRIRE |
|
| 185 | 184 | . preg_replace(_REGEXP_DOCTYPE, '', $page); |
| 186 | 185 | $r = analyser_doctype($page); |
| 187 | 186 | } |
@@ -288,18 +287,18 @@ discard block |
||
| 288 | 287 | 'rss-0.91.dtd' |
| 289 | 288 | ]; |
| 290 | 289 | } else { |
| 291 | - $dtd = $topelement . '.dtd'; |
|
| 290 | + $dtd = $topelement.'.dtd'; |
|
| 292 | 291 | $f = find_in_path($dtd); |
| 293 | 292 | if (file_exists($f)) { |
| 294 | 293 | return [$entete, 'SYSTEM', $f, $dtd]; |
| 295 | 294 | } |
| 296 | 295 | } |
| 297 | 296 | } |
| 298 | - spip_log('Dtd pas vu pour ' . substr($data, 0, 100)); |
|
| 297 | + spip_log('Dtd pas vu pour '.substr($data, 0, 100)); |
|
| 299 | 298 | |
| 300 | 299 | return []; |
| 301 | 300 | } |
| 302 | - [$entete, , $topelement, $avail, $suite] = $page; |
|
| 301 | + [$entete,, $topelement, $avail, $suite] = $page; |
|
| 303 | 302 | |
| 304 | 303 | if (!preg_match('/^"([^"]*)"\s*(.*)$/', $suite, $r)) { |
| 305 | 304 | if (!preg_match("/^'([^']*)'\s*(.*)$/", $suite, $r)) { |
@@ -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 💩 |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $ok = false; |
| 617 | 617 | } |
| 618 | 618 | if (!$ok) { |
| 619 | - spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE); |
|
| 619 | + spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE); |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | return $ok; |
@@ -706,10 +706,10 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | $character_set = ''; |
| 708 | 708 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 709 | - $character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base']; |
|
| 709 | + $character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base']; |
|
| 710 | 710 | } |
| 711 | 711 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 712 | - $character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 712 | + $character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | foreach ($champs as $k => $v) { |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | preg_match(',(char|text),i', $defs[1]) |
| 720 | 720 | and !preg_match(',(binary|CHARACTER|COLLATE),i', $v) |
| 721 | 721 | ) { |
| 722 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 722 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 723 | 723 | } |
| 724 | 724 | } |
| 725 | 725 | |
@@ -731,8 +731,8 @@ discard block |
||
| 731 | 731 | $s = ','; |
| 732 | 732 | } |
| 733 | 733 | $temporary = $temporary ? 'TEMPORARY' : ''; |
| 734 | - $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ')' |
|
| 735 | - . (defined('_MYSQL_ENGINE') ? ' ENGINE=' . _MYSQL_ENGINE : '') |
|
| 734 | + $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').')' |
|
| 735 | + . (defined('_MYSQL_ENGINE') ? ' ENGINE='._MYSQL_ENGINE : '') |
|
| 736 | 736 | . ($character_set ? " DEFAULT $character_set" : '') |
| 737 | 737 | . "\n"; |
| 738 | 738 | |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | return false; |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 814 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 815 | 815 | |
| 816 | 816 | return spip_mysql_query($query, $serveur, $requeter); |
| 817 | 817 | } |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | * Ressource à utiliser avec sql_fetch() |
| 870 | 870 | **/ |
| 871 | 871 | function spip_mysql_showbase($match, $serveur = '', $requeter = true) { |
| 872 | - return spip_mysql_query('SHOW TABLES LIKE ' . _q($match), $serveur, $requeter); |
|
| 872 | + return spip_mysql_query('SHOW TABLES LIKE '._q($match), $serveur, $requeter); |
|
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | /** |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | * - true si la requête a réussie, false sinon |
| 886 | 886 | */ |
| 887 | 887 | function spip_mysql_repair($table, $serveur = '', $requeter = true) { |
| 888 | - $table_status = spip_mysql_fetch(spip_mysql_query('SHOW TABLE STATUS WHERE Name = ' . _q($table), $serveur, true)); |
|
| 888 | + $table_status = spip_mysql_fetch(spip_mysql_query('SHOW TABLE STATUS WHERE Name = '._q($table), $serveur, true)); |
|
| 889 | 889 | $engine = $table_status['Engine']; |
| 890 | 890 | if ($engine == 'InnoDB') { |
| 891 | 891 | if (spip_mysql_alter("TABLE $table ENGINE = InnoDB", $serveur, $requeter)) { |
@@ -894,7 +894,7 @@ discard block |
||
| 894 | 894 | } elseif ($engine == 'MyISAM') { |
| 895 | 895 | return spip_mysql_query("REPAIR TABLE `$table`", $serveur, $requeter); |
| 896 | 896 | } else { |
| 897 | - spip_log("spip_mysql_repair impossible pour la table $table engine $engine", 'mysql.' . _LOG_DEBUG); |
|
| 897 | + spip_log("spip_mysql_repair impossible pour la table $table engine $engine", 'mysql.'._LOG_DEBUG); |
|
| 898 | 898 | } |
| 899 | 899 | } |
| 900 | 900 | |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | * - string : requete sql, si $requeter = true |
| 914 | 914 | **/ |
| 915 | 915 | function spip_mysql_table_exists(string $table, $serveur = '', $requeter = true) { |
| 916 | - $r = spip_mysql_query('SHOW TABLES LIKE ' . _q($table), $serveur, $requeter); |
|
| 916 | + $r = spip_mysql_query('SHOW TABLES LIKE '._q($table), $serveur, $requeter); |
|
| 917 | 917 | if (!$requeter) { |
| 918 | 918 | return $r; |
| 919 | 919 | } |
@@ -995,22 +995,22 @@ discard block |
||
| 995 | 995 | } |
| 996 | 996 | if ($val['Default'] === '0' || $val['Default']) { |
| 997 | 997 | if (preg_match('/[A-Z_]/', $val['Default'])) { |
| 998 | - $nfields[$val['Field']] .= ' DEFAULT ' . $val['Default']; |
|
| 998 | + $nfields[$val['Field']] .= ' DEFAULT '.$val['Default']; |
|
| 999 | 999 | } else { |
| 1000 | - $nfields[$val['Field']] .= " DEFAULT '" . $val['Default'] . "'"; |
|
| 1000 | + $nfields[$val['Field']] .= " DEFAULT '".$val['Default']."'"; |
|
| 1001 | 1001 | } |
| 1002 | 1002 | } |
| 1003 | 1003 | if ($val['Extra']) { |
| 1004 | - $nfields[$val['Field']] .= ' ' . $val['Extra']; |
|
| 1004 | + $nfields[$val['Field']] .= ' '.$val['Extra']; |
|
| 1005 | 1005 | } |
| 1006 | 1006 | if ($val['Key'] == 'PRI') { |
| 1007 | 1007 | $nkeys['PRIMARY KEY'] = $val['Field']; |
| 1008 | 1008 | } else { |
| 1009 | 1009 | if ($val['Key'] == 'MUL') { |
| 1010 | - $nkeys['KEY ' . $val['Field']] = $val['Field']; |
|
| 1010 | + $nkeys['KEY '.$val['Field']] = $val['Field']; |
|
| 1011 | 1011 | } else { |
| 1012 | 1012 | if ($val['Key'] == 'UNI') { |
| 1013 | - $nkeys['UNIQUE KEY ' . $val['Field']] = $val['Field']; |
|
| 1013 | + $nkeys['UNIQUE KEY '.$val['Field']] = $val['Field']; |
|
| 1014 | 1014 | } |
| 1015 | 1015 | } |
| 1016 | 1016 | } |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | $serveur = '', |
| 1086 | 1086 | $requeter = true |
| 1087 | 1087 | ) { |
| 1088 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1088 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1089 | 1089 | |
| 1090 | 1090 | $r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 1091 | 1091 | if (!$requeter) { |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | if ($s) { |
| 1126 | 1126 | $trace = debug_backtrace(); |
| 1127 | 1127 | if ($trace[0]['function'] != 'spip_mysql_error') { |
| 1128 | - spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR); |
|
| 1128 | + spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR); |
|
| 1129 | 1129 | } |
| 1130 | 1130 | } |
| 1131 | 1131 | |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | try { |
| 1252 | 1252 | $insert = mysqli_query($link, $query); |
| 1253 | 1253 | } catch (\mysqli_sql_exception $e) { |
| 1254 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 1254 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 1255 | 1255 | // TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno() |
| 1256 | 1256 | // mais il faut pour php < 8.1 forcer les exeptions via mysqli_report(). |
| 1257 | 1257 | } |
@@ -1306,8 +1306,8 @@ discard block |
||
| 1306 | 1306 | |
| 1307 | 1307 | return spip_mysql_insert( |
| 1308 | 1308 | $table, |
| 1309 | - '(' . join(',', array_keys($couples)) . ')', |
|
| 1310 | - '(' . join(',', $couples) . ')', |
|
| 1309 | + '('.join(',', array_keys($couples)).')', |
|
| 1310 | + '('.join(',', $couples).')', |
|
| 1311 | 1311 | $desc, |
| 1312 | 1312 | $serveur, |
| 1313 | 1313 | $requeter |
@@ -1344,7 +1344,7 @@ discard block |
||
| 1344 | 1344 | } |
| 1345 | 1345 | $fields = $desc['field'] ?? []; |
| 1346 | 1346 | |
| 1347 | - $cles = '(' . join(',', array_keys(reset($tab_couples))) . ')'; |
|
| 1347 | + $cles = '('.join(',', array_keys(reset($tab_couples))).')'; |
|
| 1348 | 1348 | $valeurs = []; |
| 1349 | 1349 | $r = false; |
| 1350 | 1350 | |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | foreach ($couples as $champ => $val) { |
| 1354 | 1354 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1355 | 1355 | } |
| 1356 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1356 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1357 | 1357 | if (count($valeurs) >= 100) { |
| 1358 | 1358 | $r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter); |
| 1359 | 1359 | $valeurs = []; |
@@ -1390,7 +1390,7 @@ discard block |
||
| 1390 | 1390 | function spip_mysql_update($table, $champs, $where = '', $desc = [], $serveur = '', $requeter = true) { |
| 1391 | 1391 | $set = []; |
| 1392 | 1392 | foreach ($champs as $champ => $val) { |
| 1393 | - $set[] = $champ . "=$val"; |
|
| 1393 | + $set[] = $champ."=$val"; |
|
| 1394 | 1394 | } |
| 1395 | 1395 | if (!empty($set)) { |
| 1396 | 1396 | return spip_mysql_query( |
@@ -1446,7 +1446,7 @@ discard block |
||
| 1446 | 1446 | } |
| 1447 | 1447 | $set = []; |
| 1448 | 1448 | foreach ($champs as $champ => $val) { |
| 1449 | - $set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]); |
|
| 1449 | + $set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]); |
|
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | 1452 | return spip_mysql_query( |
@@ -1515,10 +1515,10 @@ discard block |
||
| 1515 | 1515 | * - false en cas d'erreur. |
| 1516 | 1516 | **/ |
| 1517 | 1517 | function spip_mysql_replace($table, $couples, $desc = [], $serveur = '', $requeter = true) { |
| 1518 | - return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join( |
|
| 1518 | + return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join( |
|
| 1519 | 1519 | ',', |
| 1520 | 1520 | array_map('_q', $couples) |
| 1521 | - ) . ')', $serveur, $requeter); |
|
| 1521 | + ).')', $serveur, $requeter); |
|
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | |
@@ -1547,10 +1547,10 @@ discard block |
||
| 1547 | 1547 | * - false en cas d'erreur. |
| 1548 | 1548 | **/ |
| 1549 | 1549 | function spip_mysql_replace_multi($table, $tab_couples, $desc = [], $serveur = '', $requeter = true) { |
| 1550 | - $cles = '(' . join(',', array_keys($tab_couples[0])) . ')'; |
|
| 1550 | + $cles = '('.join(',', array_keys($tab_couples[0])).')'; |
|
| 1551 | 1551 | $valeurs = []; |
| 1552 | 1552 | foreach ($tab_couples as $couples) { |
| 1553 | - $valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')'; |
|
| 1553 | + $valeurs[] = '('.join(',', array_map('_q', $couples)).')'; |
|
| 1554 | 1554 | } |
| 1555 | 1555 | $valeurs = implode(', ', $valeurs); |
| 1556 | 1556 | |
@@ -1570,28 +1570,28 @@ discard block |
||
| 1570 | 1570 | */ |
| 1571 | 1571 | function spip_mysql_multi($objet, $lang) { |
| 1572 | 1572 | $lengthlang = strlen("[$lang]"); |
| 1573 | - $posmulti = 'INSTR(' . $objet . ", '<multi>')"; |
|
| 1574 | - $posfinmulti = 'INSTR(' . $objet . ", '</multi>')"; |
|
| 1575 | - $debutchaine = 'LEFT(' . $objet . ", $posmulti-1)"; |
|
| 1576 | - $finchaine = 'RIGHT(' . $objet . ', CHAR_LENGTH(' . $objet . ") -(7+$posfinmulti))"; |
|
| 1577 | - $chainemulti = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1578 | - $poslang = "INSTR($chainemulti,'[" . $lang . "]')"; |
|
| 1573 | + $posmulti = 'INSTR('.$objet.", '<multi>')"; |
|
| 1574 | + $posfinmulti = 'INSTR('.$objet.", '</multi>')"; |
|
| 1575 | + $debutchaine = 'LEFT('.$objet.", $posmulti-1)"; |
|
| 1576 | + $finchaine = 'RIGHT('.$objet.', CHAR_LENGTH('.$objet.") -(7+$posfinmulti))"; |
|
| 1577 | + $chainemulti = 'TRIM(SUBSTRING('.$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1578 | + $poslang = "INSTR($chainemulti,'[".$lang."]')"; |
|
| 1579 | 1579 | $poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)"; |
| 1580 | - $chainelang = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1581 | - $posfinlang = 'INSTR(' . $chainelang . ", '[')"; |
|
| 1580 | + $chainelang = 'TRIM(SUBSTRING('.$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1581 | + $posfinlang = 'INSTR('.$chainelang.", '[')"; |
|
| 1582 | 1582 | $chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)"; |
| 1583 | 1583 | //$chainelang = "LEFT($chainelang,$posfinlang-1)"; |
| 1584 | - $retour = "(TRIM(IF($posmulti = 0 , " . |
|
| 1585 | - ' TRIM(' . $objet . '), ' . |
|
| 1586 | - ' CONCAT( ' . |
|
| 1587 | - " $debutchaine, " . |
|
| 1588 | - ' IF( ' . |
|
| 1589 | - " $poslang = 0, " . |
|
| 1590 | - " $chainemulti, " . |
|
| 1591 | - " $chainelang" . |
|
| 1592 | - ' ), ' . |
|
| 1593 | - " $finchaine" . |
|
| 1594 | - ' ) ' . |
|
| 1584 | + $retour = "(TRIM(IF($posmulti = 0 , ". |
|
| 1585 | + ' TRIM('.$objet.'), '. |
|
| 1586 | + ' CONCAT( '. |
|
| 1587 | + " $debutchaine, ". |
|
| 1588 | + ' IF( '. |
|
| 1589 | + " $poslang = 0, ". |
|
| 1590 | + " $chainemulti, ". |
|
| 1591 | + " $chainelang". |
|
| 1592 | + ' ), '. |
|
| 1593 | + " $finchaine". |
|
| 1594 | + ' ) '. |
|
| 1595 | 1595 | '))) AS multi'; |
| 1596 | 1596 | |
| 1597 | 1597 | return $retour; |
@@ -1608,7 +1608,7 @@ discard block |
||
| 1608 | 1608 | * Valeur hexadécimale pour MySQL |
| 1609 | 1609 | **/ |
| 1610 | 1610 | function spip_mysql_hex($v) { |
| 1611 | - return '0x' . $v; |
|
| 1611 | + return '0x'.$v; |
|
| 1612 | 1612 | } |
| 1613 | 1613 | |
| 1614 | 1614 | /** |
@@ -1648,7 +1648,7 @@ discard block |
||
| 1648 | 1648 | * Expression SQL |
| 1649 | 1649 | **/ |
| 1650 | 1650 | function spip_mysql_date_proche($champ, $interval, $unite) { |
| 1651 | - $use_now = ( ($champ === 'maj' or strpos($champ, '.maj')) ? true : false ); |
|
| 1651 | + $use_now = (($champ === 'maj' or strpos($champ, '.maj')) ? true : false); |
|
| 1652 | 1652 | return '(' |
| 1653 | 1653 | . $champ |
| 1654 | 1654 | . (($interval <= 0) ? '>' : '<') |
@@ -1703,7 +1703,7 @@ discard block |
||
| 1703 | 1703 | } elseif ($v === null) { |
| 1704 | 1704 | return "''"; |
| 1705 | 1705 | } |
| 1706 | - return "'" . addslashes($v) . "'"; |
|
| 1706 | + return "'".addslashes($v)."'"; |
|
| 1707 | 1707 | } |
| 1708 | 1708 | |
| 1709 | 1709 | if ($v === null) { |
@@ -1727,7 +1727,7 @@ discard block |
||
| 1727 | 1727 | } |
| 1728 | 1728 | } |
| 1729 | 1729 | |
| 1730 | - return ("'" . addslashes($v) . "'"); |
|
| 1730 | + return ("'".addslashes($v)."'"); |
|
| 1731 | 1731 | } |
| 1732 | 1732 | |
| 1733 | 1733 | /** |
@@ -1761,7 +1761,7 @@ discard block |
||
| 1761 | 1761 | } else { |
| 1762 | 1762 | $GLOBALS['mysql_rappel_nom_base'] = false; |
| 1763 | 1763 | |
| 1764 | - return "\$GLOBALS['mysql_rappel_nom_base'] = false; " . |
|
| 1764 | + return "\$GLOBALS['mysql_rappel_nom_base'] = false; ". |
|
| 1765 | 1765 | "/* echec de test_rappel_nom_base_mysql a l'installation. */\n"; |
| 1766 | 1766 | } |
| 1767 | 1767 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | if (!$link) { |
| 65 | 65 | $erreurs[] = pg_last_error(); |
| 66 | 66 | foreach ($erreurs as $e) { |
| 67 | - spip_log('Echec pg_connect. Erreur : ' . $e, 'pg.' . _LOG_HS); |
|
| 67 | + spip_log('Echec pg_connect. Erreur : '.$e, 'pg.'._LOG_HS); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | return false; |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | spip_log( |
| 85 | - "Connexion vers $host, base $db, prefixe $prefixe " . ($link ? 'operationnelle' : 'impossible'), |
|
| 86 | - 'pg.' . _LOG_DEBUG |
|
| 85 | + "Connexion vers $host, base $db, prefixe $prefixe ".($link ? 'operationnelle' : 'impossible'), |
|
| 86 | + 'pg.'._LOG_DEBUG |
|
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | 89 | return !$link ? false : [ |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } else { |
| 172 | 172 | $suite = ''; |
| 173 | 173 | } |
| 174 | - $query = preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite; |
|
| 174 | + $query = preg_replace('/([,\s])spip_/', '\1'.$prefixe.'_', $query).$suite; |
|
| 175 | 175 | |
| 176 | 176 | // renvoyer la requete inerte si demandee |
| 177 | 177 | if (!$requeter) { |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | // ou revoir l'api de sql_alter en creant un |
| 240 | 240 | // sql_alter_table($table,array($actions)); |
| 241 | 241 | if (!preg_match('/\s*((\s*IGNORE)?\s*TABLE\s*([^\s]*))\s*(.*)?/is', $query, $regs)) { |
| 242 | - spip_log("$query mal comprise", 'pg.' . _LOG_ERREUR); |
|
| 242 | + spip_log("$query mal comprise", 'pg.'._LOG_ERREUR); |
|
| 243 | 243 | |
| 244 | 244 | return false; |
| 245 | 245 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $i = 0; |
| 253 | 253 | $ouverte = false; |
| 254 | 254 | while ($do = array_shift($todo)) { |
| 255 | - $todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . ',' . $do : $do; |
|
| 255 | + $todo2[$i] = isset($todo2[$i]) ? $todo2[$i].','.$do : $do; |
|
| 256 | 256 | $o = (str_contains($do, '(')); |
| 257 | 257 | $f = (str_contains($do, ')')); |
| 258 | 258 | if ($o and !$f) { |
@@ -265,33 +265,33 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | $todo = $todo2; |
| 268 | - $query = $debut . ' ' . array_shift($todo); |
|
| 268 | + $query = $debut.' '.array_shift($todo); |
|
| 269 | 269 | |
| 270 | 270 | if (!preg_match('/^\s*(IGNORE\s*)?TABLE\s+(\w+)\s+(ADD|DROP|CHANGE|MODIFY|RENAME)\s*(.*)$/is', $query, $r)) { |
| 271 | - spip_log("$query incompris", 'pg.' . _LOG_ERREUR); |
|
| 271 | + spip_log("$query incompris", 'pg.'._LOG_ERREUR); |
|
| 272 | 272 | } else { |
| 273 | 273 | if ($r[1]) { |
| 274 | - spip_log("j'ignore IGNORE dans $query", 'pg.' . _LOG_AVERTISSEMENT); |
|
| 274 | + spip_log("j'ignore IGNORE dans $query", 'pg.'._LOG_AVERTISSEMENT); |
|
| 275 | 275 | } |
| 276 | - $f = 'spip_pg_alter_' . strtolower($r[3]); |
|
| 276 | + $f = 'spip_pg_alter_'.strtolower($r[3]); |
|
| 277 | 277 | if (function_exists($f)) { |
| 278 | 278 | $f($r[2], $r[4], $serveur, $requeter); |
| 279 | 279 | } else { |
| 280 | - spip_log("$query non prevu", 'pg.' . _LOG_ERREUR); |
|
| 280 | + spip_log("$query non prevu", 'pg.'._LOG_ERREUR); |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | // Alter a plusieurs args. Faudrait optimiser. |
| 284 | 284 | if ($todo) { |
| 285 | - spip_pg_alter("TABLE $table " . join(',', $todo)); |
|
| 285 | + spip_pg_alter("TABLE $table ".join(',', $todo)); |
|
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | function spip_pg_alter_change($table, $arg, $serveur = '', $requeter = true) { |
| 290 | 290 | if (!preg_match('/^`?(\w+)`?\s+`?(\w+)`?\s+(.*?)\s*(DEFAULT .*?)?(NOT\s+NULL)?\s*(DEFAULT .*?)?$/i', $arg, $r)) { |
| 291 | - spip_log("alter change: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 291 | + spip_log("alter change: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 292 | 292 | } else { |
| 293 | 293 | [, $old, $new, $type, $default, $null, $def2] = $r; |
| 294 | - $actions = ["ALTER $old TYPE " . mysql2pg_type($type)]; |
|
| 294 | + $actions = ["ALTER $old TYPE ".mysql2pg_type($type)]; |
|
| 295 | 295 | if ($null) { |
| 296 | 296 | $actions[] = "ALTER $old SET NOT NULL"; |
| 297 | 297 | } else { |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $actions[] = "ALTER $old DROP DEFAULT"; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - spip_pg_query("ALTER TABLE $table " . join(', ', $actions)); |
|
| 307 | + spip_pg_query("ALTER TABLE $table ".join(', ', $actions)); |
|
| 308 | 308 | |
| 309 | 309 | if ($old != $new) { |
| 310 | 310 | spip_pg_query("ALTER TABLE $table RENAME $old TO $new", $serveur); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | function spip_pg_alter_add($table, $arg, $serveur = '', $requeter = true) { |
| 316 | 316 | $nom_index = null; |
| 317 | 317 | if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*(.*)$/', $arg, $r)) { |
| 318 | - spip_log("alter add $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 318 | + spip_log("alter add $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 319 | 319 | |
| 320 | 320 | return null; |
| 321 | 321 | } |
@@ -325,14 +325,14 @@ discard block |
||
| 325 | 325 | $m[2] = $n[1]; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - return spip_pg_query("ALTER TABLE $table ADD " . $m[1] . ' ' . mysql2pg_type($m[2]), $serveur, $requeter); |
|
| 328 | + return spip_pg_query("ALTER TABLE $table ADD ".$m[1].' '.mysql2pg_type($m[2]), $serveur, $requeter); |
|
| 329 | 329 | } elseif ($r[1][0] == 'P') { |
| 330 | 330 | // la primary peut etre sur plusieurs champs |
| 331 | 331 | $r[2] = trim(str_replace('`', '', $r[2])); |
| 332 | 332 | $m = ($r[2][0] == '(') ? substr($r[2], 1, -1) : $r[2]; |
| 333 | 333 | |
| 334 | 334 | return spip_pg_query( |
| 335 | - "ALTER TABLE $table ADD CONSTRAINT $table" . '_pkey PRIMARY KEY (' . $m . ')', |
|
| 335 | + "ALTER TABLE $table ADD CONSTRAINT $table".'_pkey PRIMARY KEY ('.$m.')', |
|
| 336 | 336 | $serveur, |
| 337 | 337 | $requeter |
| 338 | 338 | ); |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $colonnes = substr($m[1], 1, -1); |
| 352 | 352 | if (str_contains(',', $colonnes)) { |
| 353 | 353 | spip_log('PG : Erreur, impossible de creer un index sur plusieurs colonnes' |
| 354 | - . " sans qu'il ait de nom ($table, ($colonnes))", 'pg.' . _LOG_ERREUR); |
|
| 354 | + . " sans qu'il ait de nom ($table, ($colonnes))", 'pg.'._LOG_ERREUR); |
|
| 355 | 355 | } else { |
| 356 | 356 | $nom_index = $colonnes; |
| 357 | 357 | } |
@@ -367,23 +367,23 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | function spip_pg_alter_drop($table, $arg, $serveur = '', $requeter = true) { |
| 369 | 369 | if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*`?(\w*)`?/', $arg, $r)) { |
| 370 | - spip_log("alter drop: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 370 | + spip_log("alter drop: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 371 | 371 | } else { |
| 372 | 372 | if (!$r[1] or $r[1] == 'COLUMN') { |
| 373 | - return spip_pg_query("ALTER TABLE $table DROP " . $r[2], $serveur); |
|
| 373 | + return spip_pg_query("ALTER TABLE $table DROP ".$r[2], $serveur); |
|
| 374 | 374 | } elseif ($r[1][0] == 'P') { |
| 375 | - return spip_pg_query("ALTER TABLE $table DROP CONSTRAINT $table" . '_pkey', $serveur); |
|
| 375 | + return spip_pg_query("ALTER TABLE $table DROP CONSTRAINT $table".'_pkey', $serveur); |
|
| 376 | 376 | } else { |
| 377 | - return spip_pg_query('DROP INDEX ' . $table . '_' . $r[2], $serveur); |
|
| 377 | + return spip_pg_query('DROP INDEX '.$table.'_'.$r[2], $serveur); |
|
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | function spip_pg_alter_modify($table, $arg, $serveur = '', $requeter = true) { |
| 383 | 383 | if (!preg_match('/^`?(\w+)`?\s+(.*)$/', $arg, $r)) { |
| 384 | - spip_log("alter modify: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 384 | + spip_log("alter modify: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 385 | 385 | } else { |
| 386 | - return spip_pg_alter_change($table, $r[1] . ' ' . $arg, $serveur = '', $requeter = true); |
|
| 386 | + return spip_pg_alter_change($table, $r[1].' '.$arg, $serveur = '', $requeter = true); |
|
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | } elseif (preg_match('/^(TO)\s*`?(\w*)`?/', $arg, $r)) { |
| 400 | 400 | $rename = $r[2]; |
| 401 | 401 | } else { |
| 402 | - spip_log("alter rename: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 402 | + spip_log("alter rename: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | return $rename ? spip_pg_query("ALTER TABLE $table RENAME TO $rename") : false; |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | function spip_pg_create_index($nom, $table, $champs, $serveur = '', $requeter = true) { |
| 421 | 421 | if (!($nom or $table or $champs)) { |
| 422 | 422 | spip_log( |
| 423 | - "Champ manquant pour creer un index pg ($nom, $table, (" . @join(',', $champs) . '))', |
|
| 424 | - 'pg.' . _LOG_ERREUR |
|
| 423 | + "Champ manquant pour creer un index pg ($nom, $table, (".@join(',', $champs).'))', |
|
| 424 | + 'pg.'._LOG_ERREUR |
|
| 425 | 425 | ); |
| 426 | 426 | |
| 427 | 427 | return false; |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | // PG ne differentie pas noms des index en fonction des tables |
| 434 | 434 | // il faut donc creer des noms uniques d'index pour une base pg |
| 435 | - $nom = $table . '_' . $nom; |
|
| 435 | + $nom = $table.'_'.$nom; |
|
| 436 | 436 | // enlever d'eventuelles parentheses deja presentes sur champs |
| 437 | 437 | if (!is_array($champs)) { |
| 438 | 438 | if ($champs[0] == '(') { |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | $champs = [$champs]; |
| 442 | 442 | } |
| 443 | - $query = "CREATE INDEX $nom ON $table (" . join(',', $champs) . ')'; |
|
| 443 | + $query = "CREATE INDEX $nom ON $table (".join(',', $champs).')'; |
|
| 444 | 444 | if (!$requeter) { |
| 445 | 445 | return $query; |
| 446 | 446 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | } else { |
| 464 | 464 | $suite = ''; |
| 465 | 465 | } |
| 466 | - $query = 'EXPLAIN ' . preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite; |
|
| 466 | + $query = 'EXPLAIN '.preg_replace('/([,\s])spip_/', '\1'.$prefixe.'_', $query).$suite; |
|
| 467 | 467 | |
| 468 | 468 | if (!$requeter) { |
| 469 | 469 | return $query; |
@@ -556,16 +556,16 @@ discard block |
||
| 556 | 556 | } |
| 557 | 557 | } |
| 558 | 558 | $from = spip_pg_from($from, $prefixe); |
| 559 | - $query = 'SELECT ' . $select |
|
| 559 | + $query = 'SELECT '.$select |
|
| 560 | 560 | . (!$from ? '' : "\nFROM $from") |
| 561 | - . (!$where ? '' : ("\nWHERE " . (!is_array($where) ? calculer_pg_where($where) : (join( |
|
| 561 | + . (!$where ? '' : ("\nWHERE ".(!is_array($where) ? calculer_pg_where($where) : (join( |
|
| 562 | 562 | "\n\tAND ", |
| 563 | 563 | array_map('calculer_pg_where', $where) |
| 564 | 564 | ))))) |
| 565 | 565 | . spip_pg_groupby($groupby, $from, $select) |
| 566 | 566 | . (!$having ? '' : "\nHAVING $having") |
| 567 | 567 | . ($orderby ? ("\nORDER BY $orderby") : '') |
| 568 | - . (!$limit ? '' : (" LIMIT $count" . (!$offset ? '' : " OFFSET $offset"))); |
|
| 568 | + . (!$limit ? '' : (" LIMIT $count".(!$offset ? '' : " OFFSET $offset"))); |
|
| 569 | 569 | |
| 570 | 570 | // renvoyer la requete inerte si demandee |
| 571 | 571 | if ($requeter === false) { |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | $from = spip_pg_select_as($from); |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - return !$prefixe ? $from : preg_replace('/(\b)spip_/', '\1' . $prefixe . '_', $from); |
|
| 589 | + return !$prefixe ? $from : preg_replace('/(\b)spip_/', '\1'.$prefixe.'_', $from); |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | function spip_pg_orderby($order, $select) { |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | $arg = (is_array($order) ? $order : preg_split('/\s*,\s*/', $order)); |
| 595 | 595 | |
| 596 | 596 | foreach ($arg as $v) { |
| 597 | - if (preg_match('/(case\s+.*?else\s+0\s+end)\s*AS\s+' . $v . '/', $select, $m)) { |
|
| 597 | + if (preg_match('/(case\s+.*?else\s+0\s+end)\s*AS\s+'.$v.'/', $select, $m)) { |
|
| 598 | 598 | $res[] = $m[1]; |
| 599 | 599 | } else { |
| 600 | 600 | $res[] = $v; |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | $n++; |
| 773 | 773 | $res .= "\nwhen $index=$v then $n"; |
| 774 | 774 | } |
| 775 | - $arg = $m[1] . "case $res else 0 end " |
|
| 775 | + $arg = $m[1]."case $res else 0 end " |
|
| 776 | 776 | . substr($arg, strlen($m[0])); |
| 777 | 777 | } |
| 778 | 778 | |
@@ -815,9 +815,9 @@ discard block |
||
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | if (strtoupper($join) === 'AND') { |
| 818 | - return $exp . join("\n\t$join ", array_map('calculer_pg_where', $v)); |
|
| 818 | + return $exp.join("\n\t$join ", array_map('calculer_pg_where', $v)); |
|
| 819 | 819 | } else { |
| 820 | - return $exp . join($join, $v); |
|
| 820 | + return $exp.join($join, $v); |
|
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | if (substr($k, -1) == '@') { |
| 828 | 828 | // c'est une jointure qui se refere au from precedent |
| 829 | 829 | // pas de virgule |
| 830 | - $argsas .= ' ' . $v; |
|
| 830 | + $argsas .= ' '.$v; |
|
| 831 | 831 | } else { |
| 832 | 832 | $as = ''; |
| 833 | 833 | // spip_log("$k : $v", _LOG_DEBUG); |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | } elseif ($v != $k) { |
| 838 | 838 | $p = strpos($v, ' '); |
| 839 | 839 | if ($p) { |
| 840 | - $v = substr($v, 0, $p) . " AS $k" . substr($v, $p); |
|
| 840 | + $v = substr($v, 0, $p)." AS $k".substr($v, $p); |
|
| 841 | 841 | } else { |
| 842 | 842 | $as = " AS $k"; |
| 843 | 843 | } |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | } |
| 846 | 846 | // spip_log("subs $k : $v avec $as", _LOG_DEBUG); |
| 847 | 847 | // if (strpos($v, 'JOIN') === false) $argsas .= ', '; |
| 848 | - $argsas .= ', ' . $v . $as; |
|
| 848 | + $argsas .= ', '.$v.$as; |
|
| 849 | 849 | } |
| 850 | 850 | } |
| 851 | 851 | |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | $serveur = '', |
| 877 | 877 | $requeter = true |
| 878 | 878 | ) { |
| 879 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 879 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 880 | 880 | $r = spip_pg_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 881 | 881 | if (!$requeter) { |
| 882 | 882 | return $r; |
@@ -977,8 +977,8 @@ discard block |
||
| 977 | 977 | |
| 978 | 978 | return spip_pg_insert( |
| 979 | 979 | $table, |
| 980 | - '(' . join(',', array_keys($couples)) . ')', |
|
| 981 | - '(' . join(',', $couples) . ')', |
|
| 980 | + '('.join(',', array_keys($couples)).')', |
|
| 981 | + '('.join(',', $couples).')', |
|
| 982 | 982 | $desc, |
| 983 | 983 | $serveur, |
| 984 | 984 | $requeter |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | $c = $tab_couples[0] ?? []; |
| 1002 | 1002 | $les_cles = spip_pg_ajouter_champs_timestamp($table, $c, $desc, $serveur); |
| 1003 | 1003 | |
| 1004 | - $cles = '(' . join(',', array_keys($les_cles)) . ')'; |
|
| 1004 | + $cles = '('.join(',', array_keys($les_cles)).')'; |
|
| 1005 | 1005 | $valeurs = []; |
| 1006 | 1006 | foreach ($tab_couples as $couples) { |
| 1007 | 1007 | foreach ($couples as $champ => $val) { |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
| 1011 | 1011 | $couples = spip_pg_ajouter_champs_timestamp($table, $couples, $desc, $serveur); |
| 1012 | 1012 | |
| 1013 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1013 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1014 | 1014 | } |
| 1015 | 1015 | $valeurs = implode(', ', $valeurs); |
| 1016 | 1016 | |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | |
| 1032 | 1032 | $set = []; |
| 1033 | 1033 | foreach ($couples as $champ => $val) { |
| 1034 | - $set[] = $champ . '=' . $val; |
|
| 1034 | + $set[] = $champ.'='.$val; |
|
| 1035 | 1035 | } |
| 1036 | 1036 | |
| 1037 | 1037 | $query = calculer_pg_expression('UPDATE', $table, ',') |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | |
| 1067 | 1067 | function spip_pg_replace($table, $values, $desc, $serveur = '', $requeter = true) { |
| 1068 | 1068 | if (!$values) { |
| 1069 | - spip_log("replace vide $table", 'pg.' . _LOG_AVERTISSEMENT); |
|
| 1069 | + spip_log("replace vide $table", 'pg.'._LOG_AVERTISSEMENT); |
|
| 1070 | 1070 | |
| 1071 | 1071 | return 0; |
| 1072 | 1072 | } |
@@ -1100,8 +1100,8 @@ discard block |
||
| 1100 | 1100 | if (!$where) { |
| 1101 | 1101 | return spip_pg_insert( |
| 1102 | 1102 | $table, |
| 1103 | - '(' . join(',', array_keys($values)) . ')', |
|
| 1104 | - '(' . join(',', $values) . ')', |
|
| 1103 | + '('.join(',', array_keys($values)).')', |
|
| 1104 | + '('.join(',', $values).')', |
|
| 1105 | 1105 | $desc, |
| 1106 | 1106 | $serveur |
| 1107 | 1107 | ); |
@@ -1122,12 +1122,11 @@ discard block |
||
| 1122 | 1122 | $couples = pg_affected_rows($couples); |
| 1123 | 1123 | } |
| 1124 | 1124 | if (!$couples) { |
| 1125 | - $ret = !$seq ? '' : |
|
| 1126 | - (" RETURNING nextval('$seq') < $prim"); |
|
| 1127 | - $connexion['last'] = $q = "INSERT INTO $table (" . join(',', array_keys($values)) . ') VALUES (' . join( |
|
| 1125 | + $ret = !$seq ? '' : (" RETURNING nextval('$seq') < $prim"); |
|
| 1126 | + $connexion['last'] = $q = "INSERT INTO $table (".join(',', array_keys($values)).') VALUES ('.join( |
|
| 1128 | 1127 | ',', |
| 1129 | 1128 | $values |
| 1130 | - ) . ")$ret"; |
|
| 1129 | + ).")$ret"; |
|
| 1131 | 1130 | $couples = spip_pg_query_simple($link, $q); |
| 1132 | 1131 | if (!$couples) { |
| 1133 | 1132 | return false; |
@@ -1175,7 +1174,7 @@ discard block |
||
| 1175 | 1174 | ) { |
| 1176 | 1175 | return ''; |
| 1177 | 1176 | } else { |
| 1178 | - return $raw ? $prim : $table . '_' . $prim . '_seq'; |
|
| 1177 | + return $raw ? $prim : $table.'_'.$prim.'_seq'; |
|
| 1179 | 1178 | } |
| 1180 | 1179 | } |
| 1181 | 1180 | |
@@ -1192,29 +1191,29 @@ discard block |
||
| 1192 | 1191 | return spip_pg_frommysql($v); |
| 1193 | 1192 | } else { |
| 1194 | 1193 | if (strncmp($v, '0000', 4) == 0) { |
| 1195 | - $v = '0001' . substr($v, 4); |
|
| 1194 | + $v = '0001'.substr($v, 4); |
|
| 1196 | 1195 | } |
| 1197 | 1196 | if (strpos($v, '-00-00') === 4) { |
| 1198 | - $v = substr($v, 0, 4) . '-01-01' . substr($v, 10); |
|
| 1197 | + $v = substr($v, 0, 4).'-01-01'.substr($v, 10); |
|
| 1199 | 1198 | } |
| 1200 | 1199 | |
| 1201 | 1200 | return "timestamp '$v'"; |
| 1202 | 1201 | } |
| 1203 | 1202 | } elseif (!sql_test_int($t)) { |
| 1204 | - return ("'" . pg_escape_string($v) . "'"); |
|
| 1203 | + return ("'".pg_escape_string($v)."'"); |
|
| 1205 | 1204 | } elseif (is_numeric($v) or (strpos($v, 'CAST(') === 0)) { |
| 1206 | 1205 | return $v; |
| 1207 | 1206 | } elseif ($v[0] == '0' and $v[1] !== 'x' and ctype_xdigit(substr($v, 1))) { |
| 1208 | 1207 | return substr($v, 1); |
| 1209 | 1208 | } else { |
| 1210 | - spip_log("Warning: '$v' n'est pas de type $t", 'pg.' . _LOG_AVERTISSEMENT); |
|
| 1209 | + spip_log("Warning: '$v' n'est pas de type $t", 'pg.'._LOG_AVERTISSEMENT); |
|
| 1211 | 1210 | |
| 1212 | 1211 | return intval($v); |
| 1213 | 1212 | } |
| 1214 | 1213 | } |
| 1215 | 1214 | |
| 1216 | 1215 | function spip_pg_hex($v) { |
| 1217 | - return "CAST(x'" . $v . "' as bigint)"; |
|
| 1216 | + return "CAST(x'".$v."' as bigint)"; |
|
| 1218 | 1217 | } |
| 1219 | 1218 | |
| 1220 | 1219 | function spip_pg_quote($v, $type = '') { |
@@ -1252,15 +1251,15 @@ discard block |
||
| 1252 | 1251 | return $not ? '0=0' : '0=1'; |
| 1253 | 1252 | } |
| 1254 | 1253 | if (strpos($valeurs, "CAST(x'") !== false) { |
| 1255 | - return "($val=" . join("OR $val=", explode(',', $valeurs)) . ')'; |
|
| 1254 | + return "($val=".join("OR $val=", explode(',', $valeurs)).')'; |
|
| 1256 | 1255 | } |
| 1257 | 1256 | $n = $i = 0; |
| 1258 | 1257 | $in_sql = ''; |
| 1259 | 1258 | while ($n = strpos($valeurs, ',', $n + 1)) { |
| 1260 | 1259 | if ((++$i) >= 255) { |
| 1261 | - $in_sql .= "($val $not IN (" . |
|
| 1262 | - substr($valeurs, 0, $n) . |
|
| 1263 | - "))\n" . |
|
| 1260 | + $in_sql .= "($val $not IN (". |
|
| 1261 | + substr($valeurs, 0, $n). |
|
| 1262 | + "))\n". |
|
| 1264 | 1263 | ($not ? "AND\t" : "OR\t"); |
| 1265 | 1264 | $valeurs = substr($valeurs, $n + 1); |
| 1266 | 1265 | $i = $n = 0; |
@@ -1276,7 +1275,7 @@ discard block |
||
| 1276 | 1275 | $s = $link ? pg_last_error($link) : pg_last_error(); |
| 1277 | 1276 | if ($s) { |
| 1278 | 1277 | $s = str_replace('ERROR', 'errcode: 1000 ', $s); |
| 1279 | - spip_log("$s - $query", 'pg.' . _LOG_ERREUR); |
|
| 1278 | + spip_log("$s - $query", 'pg.'._LOG_ERREUR); |
|
| 1280 | 1279 | } |
| 1281 | 1280 | |
| 1282 | 1281 | return $s; |
@@ -1324,7 +1323,7 @@ discard block |
||
| 1324 | 1323 | function spip_pg_showbase($match, $serveur = '', $requeter = true) { |
| 1325 | 1324 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 1326 | 1325 | $link = $connexion['link']; |
| 1327 | - $connexion['last'] = $q = 'SELECT tablename FROM pg_tables WHERE tablename ILIKE ' . _q($match); |
|
| 1326 | + $connexion['last'] = $q = 'SELECT tablename FROM pg_tables WHERE tablename ILIKE '._q($match); |
|
| 1328 | 1327 | |
| 1329 | 1328 | return spip_pg_query_simple($link, $q); |
| 1330 | 1329 | } |
@@ -1332,7 +1331,7 @@ discard block |
||
| 1332 | 1331 | function spip_pg_showtable($nom_table, $serveur = '', $requeter = true) { |
| 1333 | 1332 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 1334 | 1333 | $link = $connexion['link']; |
| 1335 | - $connexion['last'] = $q = 'SELECT column_name, column_default, data_type FROM information_schema.columns WHERE table_name ILIKE ' . _q($nom_table); |
|
| 1334 | + $connexion['last'] = $q = 'SELECT column_name, column_default, data_type FROM information_schema.columns WHERE table_name ILIKE '._q($nom_table); |
|
| 1336 | 1335 | |
| 1337 | 1336 | $res = spip_pg_query_simple($link, $q); |
| 1338 | 1337 | if (!$res) { |
@@ -1343,15 +1342,15 @@ discard block |
||
| 1343 | 1342 | // il faut en tenir compte dans le return |
| 1344 | 1343 | $fields = []; |
| 1345 | 1344 | while ($field = pg_fetch_array($res, null, PGSQL_NUM)) { |
| 1346 | - $fields[$field[0]] = $field[2] . (!$field[1] ? '' : (' DEFAULT ' . $field[1])); |
|
| 1345 | + $fields[$field[0]] = $field[2].(!$field[1] ? '' : (' DEFAULT '.$field[1])); |
|
| 1347 | 1346 | } |
| 1348 | - $connexion['last'] = $q = 'SELECT indexdef FROM pg_indexes WHERE tablename ILIKE ' . _q($nom_table); |
|
| 1347 | + $connexion['last'] = $q = 'SELECT indexdef FROM pg_indexes WHERE tablename ILIKE '._q($nom_table); |
|
| 1349 | 1348 | $res = spip_pg_query_simple($link, $q); |
| 1350 | 1349 | $keys = []; |
| 1351 | 1350 | while ($index = pg_fetch_array($res, null, PGSQL_NUM)) { |
| 1352 | 1351 | if (preg_match('/CREATE\s+(UNIQUE\s+)?INDEX\s([^\s]+).*\((.*)\)$/', $index[0], $r)) { |
| 1353 | - $nom = str_replace($nom_table . '_', '', $r[2]); |
|
| 1354 | - $keys[($r[1] ? 'PRIMARY KEY' : ('KEY ' . $nom))] = $r[3]; |
|
| 1352 | + $nom = str_replace($nom_table.'_', '', $r[2]); |
|
| 1353 | + $keys[($r[1] ? 'PRIMARY KEY' : ('KEY '.$nom))] = $r[3]; |
|
| 1355 | 1354 | } |
| 1356 | 1355 | } |
| 1357 | 1356 | |
@@ -1383,16 +1382,16 @@ discard block |
||
| 1383 | 1382 | if (strpos($k, 'KEY ') === 0) { |
| 1384 | 1383 | $n = str_replace('`', '', $k); |
| 1385 | 1384 | $v = str_replace('`', '"', $v); |
| 1386 | - $i = $nom . preg_replace('/KEY +/', '_', $n); |
|
| 1385 | + $i = $nom.preg_replace('/KEY +/', '_', $n); |
|
| 1387 | 1386 | if ($k != $n) { |
| 1388 | 1387 | $i = "\"$i\""; |
| 1389 | 1388 | } |
| 1390 | 1389 | $keys[] = "CREATE INDEX $i ON $nom ($v);"; |
| 1391 | 1390 | } elseif (strpos($k, 'UNIQUE ') === 0) { |
| 1392 | 1391 | $k = preg_replace('/^UNIQUE +/', '', $k); |
| 1393 | - $prim .= "$s\n\t\tCONSTRAINT " . str_replace('`', '"', $k) . " UNIQUE ($v)"; |
|
| 1392 | + $prim .= "$s\n\t\tCONSTRAINT ".str_replace('`', '"', $k)." UNIQUE ($v)"; |
|
| 1394 | 1393 | } else { |
| 1395 | - $prim .= "$s\n\t\t" . str_replace('`', '"', $k) . " ($v)"; |
|
| 1394 | + $prim .= "$s\n\t\t".str_replace('`', '"', $k)." ($v)"; |
|
| 1396 | 1395 | } |
| 1397 | 1396 | if ($k == 'PRIMARY KEY') { |
| 1398 | 1397 | $prim_name = $v; |
@@ -1403,17 +1402,17 @@ discard block |
||
| 1403 | 1402 | |
| 1404 | 1403 | $character_set = ''; |
| 1405 | 1404 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 1406 | - $character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base']; |
|
| 1405 | + $character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base']; |
|
| 1407 | 1406 | } |
| 1408 | 1407 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 1409 | - $character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 1408 | + $character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 1410 | 1409 | } |
| 1411 | 1410 | |
| 1412 | 1411 | foreach ($champs as $k => $v) { |
| 1413 | 1412 | $k = str_replace('`', '"', $k); |
| 1414 | 1413 | if (preg_match(',([a-z]*\s*(\(\s*[0-9]*\s*\))?(\s*binary)?),i', $v, $defs)) { |
| 1415 | 1414 | if (preg_match(',(char|text),i', $defs[1]) and !preg_match(',binary,i', $defs[1])) { |
| 1416 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 1415 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 1417 | 1416 | } |
| 1418 | 1417 | } |
| 1419 | 1418 | |
@@ -1428,7 +1427,7 @@ discard block |
||
| 1428 | 1427 | |
| 1429 | 1428 | // En l'absence de "if not exists" en PG, on neutralise les erreurs |
| 1430 | 1429 | |
| 1431 | - $q = "CREATE $temporary TABLE $nom ($query" . ($prim ? ",$prim" : '') . ')' . |
|
| 1430 | + $q = "CREATE $temporary TABLE $nom ($query".($prim ? ",$prim" : '').')'. |
|
| 1432 | 1431 | ($character_set ? " DEFAULT $character_set" : '') |
| 1433 | 1432 | . "\n"; |
| 1434 | 1433 | |
@@ -1439,7 +1438,7 @@ discard block |
||
| 1439 | 1438 | $r = @pg_query($link, $q); |
| 1440 | 1439 | |
| 1441 | 1440 | if (!$r) { |
| 1442 | - spip_log("Impossible de creer cette table: $q", 'pg.' . _LOG_ERREUR); |
|
| 1441 | + spip_log("Impossible de creer cette table: $q", 'pg.'._LOG_ERREUR); |
|
| 1443 | 1442 | } else { |
| 1444 | 1443 | foreach ($keys as $index) { |
| 1445 | 1444 | pg_query($link, $index); |
@@ -1462,20 +1461,20 @@ discard block |
||
| 1462 | 1461 | // vue deja presente |
| 1463 | 1462 | if (sql_showtable($nom, false, $serveur)) { |
| 1464 | 1463 | if ($requeter) { |
| 1465 | - spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", 'pg.' . _LOG_ERREUR); |
|
| 1464 | + spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", 'pg.'._LOG_ERREUR); |
|
| 1466 | 1465 | } |
| 1467 | 1466 | |
| 1468 | 1467 | return false; |
| 1469 | 1468 | } |
| 1470 | 1469 | |
| 1471 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 1470 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 1472 | 1471 | |
| 1473 | 1472 | return spip_pg_query($query, $serveur, $requeter); |
| 1474 | 1473 | } |
| 1475 | 1474 | |
| 1476 | 1475 | |
| 1477 | 1476 | function spip_pg_set_connect_charset($charset, $serveur = '', $requeter = true) { |
| 1478 | - spip_log('changement de charset sql a ecrire en PG', 'pg.' . _LOG_ERREUR); |
|
| 1477 | + spip_log('changement de charset sql a ecrire en PG', 'pg.'._LOG_ERREUR); |
|
| 1479 | 1478 | } |
| 1480 | 1479 | |
| 1481 | 1480 | |
@@ -1488,7 +1487,7 @@ discard block |
||
| 1488 | 1487 | * @return bool|string true / false / requete |
| 1489 | 1488 | **/ |
| 1490 | 1489 | function spip_pg_optimize($table, $serveur = '', $requeter = true) { |
| 1491 | - return spip_pg_query('VACUUM ' . $table, $serveur, $requeter); |
|
| 1490 | + return spip_pg_query('VACUUM '.$table, $serveur, $requeter); |
|
| 1492 | 1491 | } |
| 1493 | 1492 | |
| 1494 | 1493 | // Selectionner la sous-chaine dans $objet |
@@ -66,27 +66,27 @@ discard block |
||
| 66 | 66 | // determiner le dossier de la base : $addr ou _DIR_DB |
| 67 | 67 | $f = _DIR_DB; |
| 68 | 68 | if ($addr and str_contains($addr, '/')) { |
| 69 | - $f = rtrim($addr, '/') . '/'; |
|
| 69 | + $f = rtrim($addr, '/').'/'; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // un nom de base demande et impossible d'obtenir la base, on s'en va : |
| 73 | 73 | // il faut que la base existe ou que le repertoire parent soit writable |
| 74 | - if ($db and !is_file($f .= $db . '.sqlite') and !is_writable(dirname($f))) { |
|
| 75 | - spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.' . _LOG_HS); |
|
| 74 | + if ($db and !is_file($f .= $db.'.sqlite') and !is_writable(dirname($f))) { |
|
| 75 | + spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.'._LOG_HS); |
|
| 76 | 76 | |
| 77 | 77 | return false; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // charger les modules sqlite au besoin |
| 81 | 81 | if (!_sqlite_charger_version($sqlite_version)) { |
| 82 | - spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.' . _LOG_HS); |
|
| 82 | + spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.'._LOG_HS); |
|
| 83 | 83 | |
| 84 | 84 | return false; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // chargement des constantes |
| 88 | 88 | // il ne faut pas definir les constantes avant d'avoir charge les modules sqlite |
| 89 | - $define = 'spip_sqlite' . $sqlite_version . '_constantes'; |
|
| 89 | + $define = 'spip_sqlite'.$sqlite_version.'_constantes'; |
|
| 90 | 90 | $define(); |
| 91 | 91 | |
| 92 | 92 | $ok = false; |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | // si pas de db -> |
| 95 | 95 | // base temporaire tant qu'on ne connait pas son vrai nom |
| 96 | 96 | // pour tester la connexion |
| 97 | - $db = '_sqlite' . $sqlite_version . '_install'; |
|
| 98 | - $tmp = _DIR_DB . $db . '.sqlite'; |
|
| 97 | + $db = '_sqlite'.$sqlite_version.'_install'; |
|
| 98 | + $tmp = _DIR_DB.$db.'.sqlite'; |
|
| 99 | 99 | $ok = $link = new \PDO("sqlite:$tmp"); |
| 100 | 100 | } else { |
| 101 | 101 | // Ouvrir (eventuellement creer la base) |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | if (!$ok) { |
| 106 | 106 | $e = _sqlite_last_error_from_link($link); |
| 107 | - spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.' . _LOG_HS); |
|
| 107 | + spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.'._LOG_HS); |
|
| 108 | 108 | |
| 109 | 109 | return false; |
| 110 | 110 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $table = $regs[3]; |
| 193 | 193 | $suite = $regs[4]; |
| 194 | 194 | } else { |
| 195 | - spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.' . _LOG_ERREUR); |
|
| 195 | + spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.'._LOG_ERREUR); |
|
| 196 | 196 | |
| 197 | 197 | return false; |
| 198 | 198 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $i = 0; |
| 210 | 210 | $ouverte = false; |
| 211 | 211 | while ($do = array_shift($todo)) { |
| 212 | - $todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . ',' . $do : $do; |
|
| 212 | + $todo2[$i] = isset($todo2[$i]) ? $todo2[$i].','.$do : $do; |
|
| 213 | 213 | $o = (str_contains($do, '(')); |
| 214 | 214 | $f = (str_contains($do, ')')); |
| 215 | 215 | if ($o and !$f) { |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | ) { |
| 236 | 236 | spip_log( |
| 237 | 237 | "SQLite : Probleme de ALTER TABLE, utilisation non reconnue dans : $do \n(requete d'origine : $query)", |
| 238 | - 'sqlite.' . _LOG_ERREUR |
|
| 238 | + 'sqlite.'._LOG_ERREUR |
|
| 239 | 239 | ); |
| 240 | 240 | |
| 241 | 241 | return false; |
@@ -331,10 +331,10 @@ discard block |
||
| 331 | 331 | |
| 332 | 332 | // pas geres en sqlite2 |
| 333 | 333 | case 'RENAME': |
| 334 | - $do = 'RENAME TO' . substr($do, 6); |
|
| 334 | + $do = 'RENAME TO'.substr($do, 6); |
|
| 335 | 335 | case 'RENAME TO': |
| 336 | 336 | if (!Sqlite::executer_requete("$debut $do", $serveur)) { |
| 337 | - spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 337 | + spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.'._LOG_ERREUR); |
|
| 338 | 338 | |
| 339 | 339 | return false; |
| 340 | 340 | } |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | $colonnes = substr($colonne_origine, 1, -1); |
| 378 | 378 | if (str_contains(',', $colonnes)) { |
| 379 | 379 | spip_log('SQLite : Erreur, impossible de creer un index sur plusieurs colonnes' |
| 380 | - . " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.' . _LOG_ERREUR); |
|
| 380 | + . " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.'._LOG_ERREUR); |
|
| 381 | 381 | break; |
| 382 | 382 | } else { |
| 383 | 383 | $nom_index = $colonnes; |
@@ -392,12 +392,12 @@ discard block |
||
| 392 | 392 | |
| 393 | 393 | // pas geres en sqlite2 |
| 394 | 394 | case 'ADD COLUMN': |
| 395 | - $do = 'ADD' . substr($do, 10); |
|
| 395 | + $do = 'ADD'.substr($do, 10); |
|
| 396 | 396 | case 'ADD': |
| 397 | 397 | default: |
| 398 | 398 | if (!preg_match(',primary\s+key,i', $do)) { |
| 399 | 399 | if (!Sqlite::executer_requete("$debut $do", $serveur)) { |
| 400 | - spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 400 | + spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR); |
|
| 401 | 401 | |
| 402 | 402 | return false; |
| 403 | 403 | } |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | } |
| 418 | 418 | $opts['field'] = [$colonne_ajoutee => $def]; |
| 419 | 419 | if (!_sqlite_modifier_table($table, [$colonne_ajoutee], $opts, $serveur)) { |
| 420 | - spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 420 | + spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR); |
|
| 421 | 421 | |
| 422 | 422 | return false; |
| 423 | 423 | } |
@@ -425,10 +425,10 @@ discard block |
||
| 425 | 425 | break; |
| 426 | 426 | } |
| 427 | 427 | // tout est bon, ouf ! |
| 428 | - spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.' . _LOG_INFO); |
|
| 428 | + spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.'._LOG_INFO); |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.' . _LOG_INFO); |
|
| 431 | + spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.'._LOG_INFO); |
|
| 432 | 432 | |
| 433 | 433 | return true; |
| 434 | 434 | } |
@@ -497,9 +497,9 @@ discard block |
||
| 497 | 497 | **/ |
| 498 | 498 | function spip_sqlite_create_base($nom, $serveur = '', $option = true) |
| 499 | 499 | { |
| 500 | - $f = $nom . '.sqlite'; |
|
| 500 | + $f = $nom.'.sqlite'; |
|
| 501 | 501 | if (strpos($nom, '/') === false) { |
| 502 | - $f = _DIR_DB . $f; |
|
| 502 | + $f = _DIR_DB.$f; |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | $ok = new \PDO("sqlite:$f"); |
@@ -540,13 +540,13 @@ discard block |
||
| 540 | 540 | if (sql_showtable($nom, false, $serveur)) { |
| 541 | 541 | spip_log( |
| 542 | 542 | "Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", |
| 543 | - 'sqlite.' . _LOG_ERREUR |
|
| 543 | + 'sqlite.'._LOG_ERREUR |
|
| 544 | 544 | ); |
| 545 | 545 | |
| 546 | 546 | return false; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 549 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 550 | 550 | |
| 551 | 551 | return spip_sqlite_query($query, $serveur, $requeter); |
| 552 | 552 | } |
@@ -573,8 +573,8 @@ discard block |
||
| 573 | 573 | { |
| 574 | 574 | if (!($nom or $table or $champs)) { |
| 575 | 575 | spip_log( |
| 576 | - "Champ manquant pour creer un index sqlite ($nom, $table, (" . join(',', $champs) . '))', |
|
| 577 | - 'sqlite.' . _LOG_ERREUR |
|
| 576 | + "Champ manquant pour creer un index sqlite ($nom, $table, (".join(',', $champs).'))', |
|
| 577 | + 'sqlite.'._LOG_ERREUR |
|
| 578 | 578 | ); |
| 579 | 579 | |
| 580 | 580 | return false; |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | |
| 583 | 583 | // SQLite ne differentie pas noms des index en fonction des tables |
| 584 | 584 | // il faut donc creer des noms uniques d'index pour une base sqlite |
| 585 | - $nom = $table . '_' . $nom; |
|
| 585 | + $nom = $table.'_'.$nom; |
|
| 586 | 586 | // enlever d'eventuelles parentheses deja presentes sur champs |
| 587 | 587 | if (!is_array($champs)) { |
| 588 | 588 | if ($champs[0] == '(') { |
@@ -604,12 +604,12 @@ discard block |
||
| 604 | 604 | } else { |
| 605 | 605 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 606 | 606 | $a = spip_sqlite_showtable($table, $serveur); |
| 607 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 607 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 608 | 608 | return true; |
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | - $query = 'CREATE ' . ($unique ? 'UNIQUE ' : '') . "INDEX$ifnotexists $nom ON $table (" . join(',', $champs) . ')'; |
|
| 612 | + $query = 'CREATE '.($unique ? 'UNIQUE ' : '')."INDEX$ifnotexists $nom ON $table (".join(',', $champs).')'; |
|
| 613 | 613 | $res = spip_sqlite_query($query, $serveur, $requeter); |
| 614 | 614 | if (!$requeter) { |
| 615 | 615 | return $res; |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | $serveur = '', |
| 687 | 687 | $requeter = true |
| 688 | 688 | ) { |
| 689 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 689 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 690 | 690 | $r = spip_sqlite_select( |
| 691 | 691 | "COUNT($c)", |
| 692 | 692 | $from, |
@@ -799,14 +799,14 @@ discard block |
||
| 799 | 799 | function spip_sqlite_drop_index($nom, $table, $serveur = '', $requeter = true) |
| 800 | 800 | { |
| 801 | 801 | if (!($nom or $table)) { |
| 802 | - spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.' . _LOG_ERREUR); |
|
| 802 | + spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.'._LOG_ERREUR); |
|
| 803 | 803 | |
| 804 | 804 | return false; |
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | // SQLite ne differentie pas noms des index en fonction des tables |
| 808 | 808 | // il faut donc creer des noms uniques d'index pour une base sqlite |
| 809 | - $index = $table . '_' . $nom; |
|
| 809 | + $index = $table.'_'.$nom; |
|
| 810 | 810 | $exist = ' IF EXISTS'; |
| 811 | 811 | |
| 812 | 812 | $query = "DROP INDEX$exist $index"; |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | if ($s) { |
| 840 | 840 | $trace = debug_backtrace(); |
| 841 | 841 | if ($trace[0]['function'] != 'spip_sqlite_error') { |
| 842 | - spip_log("$s - $query - " . sql_error_backtrace(), 'sqlite.' . _LOG_ERREUR); |
|
| 842 | + spip_log("$s - $query - ".sql_error_backtrace(), 'sqlite.'._LOG_ERREUR); |
|
| 843 | 843 | } |
| 844 | 844 | } |
| 845 | 845 | |
@@ -888,14 +888,14 @@ discard block |
||
| 888 | 888 | $t = $link->errorInfo(); |
| 889 | 889 | $s = ltrim($t[0], '0'); // 00000 si pas d'erreur |
| 890 | 890 | if ($s) { |
| 891 | - $s .= ' / ' . $t[1]; |
|
| 891 | + $s .= ' / '.$t[1]; |
|
| 892 | 892 | } // ajoute l'erreur du moteur SQLite |
| 893 | 893 | } else { |
| 894 | 894 | $s = ': aucune ressource sqlite (link)'; |
| 895 | 895 | } |
| 896 | 896 | |
| 897 | 897 | if ($s) { |
| 898 | - spip_log("Erreur sqlite $s", 'sqlite.' . _LOG_ERREUR); |
|
| 898 | + spip_log("Erreur sqlite $s", 'sqlite.'._LOG_ERREUR); |
|
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | return $s ? $s : 0; |
@@ -920,7 +920,7 @@ discard block |
||
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | $query = Sqlite::traduire_requete($query, $serveur); |
| 923 | - $query = 'EXPLAIN ' . $query; |
|
| 923 | + $query = 'EXPLAIN '.$query; |
|
| 924 | 924 | if (!$requeter) { |
| 925 | 925 | return $query; |
| 926 | 926 | } |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | function spip_sqlite_insert($table, $champs, $valeurs, $desc = [], $serveur = '', $requeter = true) |
| 1097 | 1097 | { |
| 1098 | 1098 | |
| 1099 | - $query = "INSERT INTO $table " . ($champs ? "$champs VALUES $valeurs" : 'DEFAULT VALUES'); |
|
| 1099 | + $query = "INSERT INTO $table ".($champs ? "$champs VALUES $valeurs" : 'DEFAULT VALUES'); |
|
| 1100 | 1100 | if ($r = spip_sqlite_query($query, $serveur, $requeter)) { |
| 1101 | 1101 | if (!$requeter) { |
| 1102 | 1102 | return $r; |
@@ -1152,8 +1152,8 @@ discard block |
||
| 1152 | 1152 | |
| 1153 | 1153 | $cles = $valeurs = ''; |
| 1154 | 1154 | if (count($couples)) { |
| 1155 | - $cles = '(' . join(',', array_keys($couples)) . ')'; |
|
| 1156 | - $valeurs = '(' . join(',', $couples) . ')'; |
|
| 1155 | + $cles = '('.join(',', array_keys($couples)).')'; |
|
| 1156 | + $valeurs = '('.join(',', $couples).')'; |
|
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | 1159 | return spip_sqlite_insert($table, $cles, $valeurs, $desc, $serveur, $requeter); |
@@ -1214,11 +1214,11 @@ discard block |
||
| 1214 | 1214 | |
| 1215 | 1215 | $champs = $valeurs = ''; |
| 1216 | 1216 | if (count($couples)) { |
| 1217 | - $champs = '(' . join(',', array_keys($couples)) . ')'; |
|
| 1218 | - $valeurs = '(' . join(',', $couples) . ')'; |
|
| 1219 | - $query = $query_start . "$champs VALUES $valeurs"; |
|
| 1217 | + $champs = '('.join(',', array_keys($couples)).')'; |
|
| 1218 | + $valeurs = '('.join(',', $couples).')'; |
|
| 1219 | + $query = $query_start."$champs VALUES $valeurs"; |
|
| 1220 | 1220 | } else { |
| 1221 | - $query = $query_start . 'DEFAULT VALUES'; |
|
| 1221 | + $query = $query_start.'DEFAULT VALUES'; |
|
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | 1224 | if ($requeter) { |
@@ -1355,7 +1355,7 @@ discard block |
||
| 1355 | 1355 | */ |
| 1356 | 1356 | function spip_sqlite_multi($objet, $lang) |
| 1357 | 1357 | { |
| 1358 | - $r = 'EXTRAIRE_MULTI(' . $objet . ", '" . $lang . "') AS multi"; |
|
| 1358 | + $r = 'EXTRAIRE_MULTI('.$objet.", '".$lang."') AS multi"; |
|
| 1359 | 1359 | |
| 1360 | 1360 | return $r; |
| 1361 | 1361 | } |
@@ -1429,7 +1429,7 @@ discard block |
||
| 1429 | 1429 | { |
| 1430 | 1430 | $op = (($interval <= 0) ? '>' : '<'); |
| 1431 | 1431 | |
| 1432 | - return "($champ $op datetime('" . date('Y-m-d H:i:s') . "', '$interval $unite'))"; |
|
| 1432 | + return "($champ $op datetime('".date('Y-m-d H:i:s')."', '$interval $unite'))"; |
|
| 1433 | 1433 | } |
| 1434 | 1434 | |
| 1435 | 1435 | |
@@ -1462,7 +1462,7 @@ discard block |
||
| 1462 | 1462 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1463 | 1463 | ) { |
| 1464 | 1464 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur); |
| 1465 | - spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE); |
|
| 1465 | + spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE); |
|
| 1466 | 1466 | } |
| 1467 | 1467 | if ( |
| 1468 | 1468 | preg_match(',^(INTEGER),i', $d) |
@@ -1472,7 +1472,7 @@ discard block |
||
| 1472 | 1472 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1473 | 1473 | ) { |
| 1474 | 1474 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur); |
| 1475 | - spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE); |
|
| 1475 | + spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE); |
|
| 1476 | 1476 | } |
| 1477 | 1477 | if ( |
| 1478 | 1478 | preg_match(',^(datetime),i', $d) |
@@ -1482,7 +1482,7 @@ discard block |
||
| 1482 | 1482 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1483 | 1483 | ) { |
| 1484 | 1484 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0000-00-00 00:00:00'", $serveur); |
| 1485 | - spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE); |
|
| 1485 | + spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE); |
|
| 1486 | 1486 | } |
| 1487 | 1487 | } |
| 1488 | 1488 | |
@@ -1534,10 +1534,10 @@ discard block |
||
| 1534 | 1534 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
| 1535 | 1535 | $couples = _sqlite_ajouter_champs_timestamp($table, $couples, $desc, $serveur); |
| 1536 | 1536 | |
| 1537 | - return spip_sqlite_query("REPLACE INTO $table (" . join(',', array_keys($couples)) . ') VALUES (' . join( |
|
| 1537 | + return spip_sqlite_query("REPLACE INTO $table (".join(',', array_keys($couples)).') VALUES ('.join( |
|
| 1538 | 1538 | ',', |
| 1539 | 1539 | $couples |
| 1540 | - ) . ')', $serveur); |
|
| 1540 | + ).')', $serveur); |
|
| 1541 | 1541 | } |
| 1542 | 1542 | |
| 1543 | 1543 | |
@@ -1624,7 +1624,7 @@ discard block |
||
| 1624 | 1624 | . _sqlite_calculer_expression('WHERE', $where) |
| 1625 | 1625 | . _sqlite_calculer_expression('GROUP BY', $groupby, ',') |
| 1626 | 1626 | . _sqlite_calculer_expression('HAVING', $having) |
| 1627 | - . ($orderby ? ("\nORDER BY " . _sqlite_calculer_order($orderby)) : '') |
|
| 1627 | + . ($orderby ? ("\nORDER BY "._sqlite_calculer_order($orderby)) : '') |
|
| 1628 | 1628 | . ($limit ? "\nLIMIT $limit" : ''); |
| 1629 | 1629 | |
| 1630 | 1630 | // dans un select, on doit renvoyer la requête en cas d'erreur |
@@ -1663,10 +1663,10 @@ discard block |
||
| 1663 | 1663 | // interdire la creation d'une nouvelle base, |
| 1664 | 1664 | // sauf si on est dans l'installation |
| 1665 | 1665 | if ( |
| 1666 | - !is_file($f = _DIR_DB . $db . '.sqlite') |
|
| 1666 | + !is_file($f = _DIR_DB.$db.'.sqlite') |
|
| 1667 | 1667 | && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL) |
| 1668 | 1668 | ) { |
| 1669 | - spip_log("Il est interdit de creer la base $db", 'sqlite.' . _LOG_HS); |
|
| 1669 | + spip_log("Il est interdit de creer la base $db", 'sqlite.'._LOG_HS); |
|
| 1670 | 1670 | |
| 1671 | 1671 | return false; |
| 1672 | 1672 | } |
@@ -1675,12 +1675,12 @@ discard block |
||
| 1675 | 1675 | // avec les identifiants connus |
| 1676 | 1676 | $index = $serveur ? $serveur : 0; |
| 1677 | 1677 | |
| 1678 | - if ($link = spip_connect_db('', '', '', '', '@selectdb@' . $db, $serveur, '', '')) { |
|
| 1678 | + if ($link = spip_connect_db('', '', '', '', '@selectdb@'.$db, $serveur, '', '')) { |
|
| 1679 | 1679 | if (($db == $link['db']) && $GLOBALS['connexions'][$index] = $link) { |
| 1680 | 1680 | return $db; |
| 1681 | 1681 | } |
| 1682 | 1682 | } else { |
| 1683 | - spip_log("Impossible de selectionner la base $db", 'sqlite.' . _LOG_HS); |
|
| 1683 | + spip_log("Impossible de selectionner la base $db", 'sqlite.'._LOG_HS); |
|
| 1684 | 1684 | |
| 1685 | 1685 | return false; |
| 1686 | 1686 | } |
@@ -1733,7 +1733,7 @@ discard block |
||
| 1733 | 1733 | $match = "^$match$"; |
| 1734 | 1734 | |
| 1735 | 1735 | return spip_sqlite_query( |
| 1736 | - "SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP " . _q($match), |
|
| 1736 | + "SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP "._q($match), |
|
| 1737 | 1737 | $serveur, |
| 1738 | 1738 | $requeter |
| 1739 | 1739 | ); |
@@ -1758,7 +1758,7 @@ discard block |
||
| 1758 | 1758 | $r = spip_sqlite_query( |
| 1759 | 1759 | 'SELECT name FROM sqlite_master WHERE' |
| 1760 | 1760 | . ' type=\'table\'' |
| 1761 | - . ' AND name=' . spip_sqlite_quote($table, 'string') |
|
| 1761 | + . ' AND name='.spip_sqlite_quote($table, 'string') |
|
| 1762 | 1762 | . ' AND name NOT LIKE \'sqlite_%\'', |
| 1763 | 1763 | $serveur, |
| 1764 | 1764 | $requeter |
@@ -1856,7 +1856,7 @@ discard block |
||
| 1856 | 1856 | // s'il y a une parenthèse fermante dans la clé |
| 1857 | 1857 | // ou dans la définition sans qu'il n'y ait une ouverture avant |
| 1858 | 1858 | if (str_contains($k, ')') or preg_match('/^[^\(]*\)/', $def)) { |
| 1859 | - $fields[$k_precedent] .= ',' . $k . ' ' . $def; |
|
| 1859 | + $fields[$k_precedent] .= ','.$k.' '.$def; |
|
| 1860 | 1860 | continue; |
| 1861 | 1861 | } |
| 1862 | 1862 | |
@@ -1891,13 +1891,13 @@ discard block |
||
| 1891 | 1891 | . 'ORDER BY substr(type,2,1), name'; |
| 1892 | 1892 | $a = spip_sqlite_query($query, $serveur, $requeter); |
| 1893 | 1893 | while ($r = spip_sqlite_fetch($a, null, $serveur)) { |
| 1894 | - $key = str_replace($nom_table . '_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1894 | + $key = str_replace($nom_table.'_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1895 | 1895 | $keytype = 'KEY'; |
| 1896 | 1896 | if (strpos($r['sql'], 'UNIQUE INDEX') !== false) { |
| 1897 | 1897 | $keytype = 'UNIQUE KEY'; |
| 1898 | 1898 | } |
| 1899 | 1899 | $colonnes = preg_replace(',.*\((.*)\).*,', '$1', $r['sql']); |
| 1900 | - $keys[$keytype . ' ' . $key] = $colonnes; |
|
| 1900 | + $keys[$keytype.' '.$key] = $colonnes; |
|
| 1901 | 1901 | } |
| 1902 | 1902 | } |
| 1903 | 1903 | } // c'est une vue, on liste les champs disponibles simplement |
@@ -1945,7 +1945,7 @@ discard block |
||
| 1945 | 1945 | |
| 1946 | 1946 | $set = []; |
| 1947 | 1947 | foreach ($champs as $champ => $val) { |
| 1948 | - $set[] = $champ . "=$val"; |
|
| 1948 | + $set[] = $champ."=$val"; |
|
| 1949 | 1949 | } |
| 1950 | 1950 | if (!empty($set)) { |
| 1951 | 1951 | return spip_sqlite_query( |
@@ -1999,7 +1999,7 @@ discard block |
||
| 1999 | 1999 | |
| 2000 | 2000 | $set = []; |
| 2001 | 2001 | foreach ($champs as $champ => $val) { |
| 2002 | - $set[$champ] = $champ . '=' . _sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 2002 | + $set[$champ] = $champ.'='._sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 2003 | 2003 | } |
| 2004 | 2004 | |
| 2005 | 2005 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
@@ -2007,7 +2007,7 @@ discard block |
||
| 2007 | 2007 | $maj = _sqlite_ajouter_champs_timestamp($table, [], $desc, $serveur); |
| 2008 | 2008 | foreach ($maj as $champ => $val) { |
| 2009 | 2009 | if (!isset($set[$champ])) { |
| 2010 | - $set[$champ] = $champ . '=' . $val; |
|
| 2010 | + $set[$champ] = $champ.'='.$val; |
|
| 2011 | 2011 | } |
| 2012 | 2012 | } |
| 2013 | 2013 | |
@@ -2037,7 +2037,7 @@ discard block |
||
| 2037 | 2037 | function _sqlite_init() |
| 2038 | 2038 | { |
| 2039 | 2039 | if (!defined('_DIR_DB')) { |
| 2040 | - define('_DIR_DB', _DIR_ETC . 'bases/'); |
|
| 2040 | + define('_DIR_DB', _DIR_ETC.'bases/'); |
|
| 2041 | 2041 | } |
| 2042 | 2042 | if (!defined('_SQLITE_CHMOD')) { |
| 2043 | 2043 | define('_SQLITE_CHMOD', _SPIP_CHMOD); |
@@ -2149,9 +2149,9 @@ discard block |
||
| 2149 | 2149 | } |
| 2150 | 2150 | |
| 2151 | 2151 | // echapper les ' en '' |
| 2152 | - spip_log('Pas de methode ->quote pour echapper', 'sqlite.' . _LOG_INFO_IMPORTANTE); |
|
| 2152 | + spip_log('Pas de methode ->quote pour echapper', 'sqlite.'._LOG_INFO_IMPORTANTE); |
|
| 2153 | 2153 | |
| 2154 | - return ("'" . str_replace("'", "''", $v) . "'"); |
|
| 2154 | + return ("'".str_replace("'", "''", $v)."'"); |
|
| 2155 | 2155 | } |
| 2156 | 2156 | |
| 2157 | 2157 | |
@@ -2175,12 +2175,12 @@ discard block |
||
| 2175 | 2175 | $exp = "\n$expression "; |
| 2176 | 2176 | |
| 2177 | 2177 | if (!is_array($v)) { |
| 2178 | - return $exp . $v; |
|
| 2178 | + return $exp.$v; |
|
| 2179 | 2179 | } else { |
| 2180 | 2180 | if (strtoupper($join) === 'AND') { |
| 2181 | - return $exp . join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2181 | + return $exp.join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2182 | 2182 | } else { |
| 2183 | - return $exp . join($join, $v); |
|
| 2183 | + return $exp.join($join, $v); |
|
| 2184 | 2184 | } |
| 2185 | 2185 | } |
| 2186 | 2186 | } |
@@ -2216,17 +2216,17 @@ discard block |
||
| 2216 | 2216 | if (substr($k, -1) == '@') { |
| 2217 | 2217 | // c'est une jointure qui se refere au from precedent |
| 2218 | 2218 | // pas de virgule |
| 2219 | - $res .= ' ' . $v; |
|
| 2219 | + $res .= ' '.$v; |
|
| 2220 | 2220 | } else { |
| 2221 | 2221 | if (!is_numeric($k)) { |
| 2222 | 2222 | $p = strpos($v, ' '); |
| 2223 | 2223 | if ($p) { |
| 2224 | - $v = substr($v, 0, $p) . " AS '$k'" . substr($v, $p); |
|
| 2224 | + $v = substr($v, 0, $p)." AS '$k'".substr($v, $p); |
|
| 2225 | 2225 | } else { |
| 2226 | 2226 | $v .= " AS '$k'"; |
| 2227 | 2227 | } |
| 2228 | 2228 | } |
| 2229 | - $res .= ', ' . $v; |
|
| 2229 | + $res .= ', '.$v; |
|
| 2230 | 2230 | } |
| 2231 | 2231 | } |
| 2232 | 2232 | |
@@ -2367,13 +2367,13 @@ discard block |
||
| 2367 | 2367 | |
| 2368 | 2368 | $def_origine = sql_showtable($table_origine, false, $serveur); |
| 2369 | 2369 | if (!$def_origine or !isset($def_origine['field'])) { |
| 2370 | - spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite' . _LOG_ERREUR); |
|
| 2370 | + spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite'._LOG_ERREUR); |
|
| 2371 | 2371 | |
| 2372 | 2372 | return false; |
| 2373 | 2373 | } |
| 2374 | 2374 | |
| 2375 | 2375 | |
| 2376 | - $table_tmp = $table_origine . '_tmp'; |
|
| 2376 | + $table_tmp = $table_origine.'_tmp'; |
|
| 2377 | 2377 | |
| 2378 | 2378 | // 1) creer une table temporaire avec les modifications |
| 2379 | 2379 | // - DROP : suppression de la colonne |
@@ -2460,7 +2460,7 @@ discard block |
||
| 2460 | 2460 | } else { |
| 2461 | 2461 | // enlever KEY |
| 2462 | 2462 | $k = substr($k, 4); |
| 2463 | - $queries[] = "CREATE INDEX $table_destination" . "_$k ON $table_destination ($v)"; |
|
| 2463 | + $queries[] = "CREATE INDEX $table_destination"."_$k ON $table_destination ($v)"; |
|
| 2464 | 2464 | } |
| 2465 | 2465 | } |
| 2466 | 2466 | |
@@ -2471,7 +2471,7 @@ discard block |
||
| 2471 | 2471 | foreach ($queries as $q) { |
| 2472 | 2472 | if (!Sqlite::executer_requete($q, $serveur)) { |
| 2473 | 2473 | spip_log('SQLite : ALTER TABLE table :' |
| 2474 | - . " Erreur a l'execution de la requete : $q", 'sqlite.' . _LOG_ERREUR); |
|
| 2474 | + . " Erreur a l'execution de la requete : $q", 'sqlite.'._LOG_ERREUR); |
|
| 2475 | 2475 | Sqlite::annuler_transaction($serveur); |
| 2476 | 2476 | |
| 2477 | 2477 | return false; |
@@ -2563,27 +2563,27 @@ discard block |
||
| 2563 | 2563 | $enum = '(\s*\([^\)]*\))?'; |
| 2564 | 2564 | |
| 2565 | 2565 | $remplace = [ |
| 2566 | - '/enum' . $enum . '/is' => 'VARCHAR(255)', |
|
| 2566 | + '/enum'.$enum.'/is' => 'VARCHAR(255)', |
|
| 2567 | 2567 | '/COLLATE \w+_bin/is' => 'COLLATE BINARY', |
| 2568 | 2568 | '/COLLATE \w+_ci/is' => 'COLLATE NOCASE', |
| 2569 | 2569 | '/auto_increment/is' => '', |
| 2570 | 2570 | '/current_timestamp\(\)/is' => 'CURRENT_TIMESTAMP', // Fix export depuis mariaDB #4374 |
| 2571 | 2571 | '/(timestamp .* )ON .*$/is' => '\\1', |
| 2572 | 2572 | '/character set \w+/is' => '', |
| 2573 | - '/((big|small|medium|tiny)?int(eger)?)' . $num . '\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2573 | + '/((big|small|medium|tiny)?int(eger)?)'.$num.'\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2574 | 2574 | '/(text\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
| 2575 | - '/((char|varchar)' . $num . '\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2575 | + '/((char|varchar)'.$num.'\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2576 | 2576 | '/(datetime\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00 00:00:00'", |
| 2577 | 2577 | '/(date\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00'", |
| 2578 | 2578 | ]; |
| 2579 | 2579 | |
| 2580 | 2580 | // pour l'autoincrement, il faut des INTEGER NOT NULL PRIMARY KEY |
| 2581 | 2581 | $remplace_autocinc = [ |
| 2582 | - '/(big|small|medium|tiny)?int(eger)?' . $num . '/is' => 'INTEGER' |
|
| 2582 | + '/(big|small|medium|tiny)?int(eger)?'.$num.'/is' => 'INTEGER' |
|
| 2583 | 2583 | ]; |
| 2584 | 2584 | // pour les int non autoincrement, il faut un DEFAULT |
| 2585 | 2585 | $remplace_nonautocinc = [ |
| 2586 | - '/((big|small|medium|tiny)?int(eger)?' . $num . '\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2586 | + '/((big|small|medium|tiny)?int(eger)?'.$num.'\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2587 | 2587 | ]; |
| 2588 | 2588 | |
| 2589 | 2589 | if (is_string($query)) { |
@@ -2626,7 +2626,7 @@ discard block |
||
| 2626 | 2626 | return str_ireplace('BINARY', 'COLLATE BINARY', $champ); |
| 2627 | 2627 | } |
| 2628 | 2628 | if (preg_match(',^(char|varchar|(long|small|medium|tiny)?text),i', $champ)) { |
| 2629 | - return $champ . ' COLLATE NOCASE'; |
|
| 2629 | + return $champ.' COLLATE NOCASE'; |
|
| 2630 | 2630 | } |
| 2631 | 2631 | |
| 2632 | 2632 | return $champ; |
@@ -2716,14 +2716,14 @@ discard block |
||
| 2716 | 2716 | } else { |
| 2717 | 2717 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 2718 | 2718 | $a = spip_sqlite_showtable($nom, $serveur); |
| 2719 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 2719 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 2720 | 2720 | return true; |
| 2721 | 2721 | } |
| 2722 | 2722 | } |
| 2723 | 2723 | } |
| 2724 | 2724 | |
| 2725 | 2725 | $temporary = $temporary ? ' TEMPORARY' : ''; |
| 2726 | - $q = "CREATE$temporary TABLE$ifnotexists $nom ($query" . ($keys ? ",$keys" : '') . ")\n"; |
|
| 2726 | + $q = "CREATE$temporary TABLE$ifnotexists $nom ($query".($keys ? ",$keys" : '').")\n"; |
|
| 2727 | 2727 | |
| 2728 | 2728 | return $q; |
| 2729 | 2729 | } |