@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | static $dirs = []; |
| 42 | 42 | $liste = []; |
| 43 | 43 | foreach (creer_chemin() as $dir) { |
| 44 | - if (!isset($dirs[$a = $dir . $dirname])) { |
|
| 44 | + if (!isset($dirs[$a = $dir.$dirname])) { |
|
| 45 | 45 | $dirs[$a] = (is_dir($a) || !$a); |
| 46 | 46 | } |
| 47 | 47 | if ($dirs[$a]) { |
@@ -67,21 +67,21 @@ discard block |
||
| 67 | 67 | **/ |
| 68 | 68 | function chercher_module_lang($module, $lang = '') { |
| 69 | 69 | if ($lang) { |
| 70 | - $lang = '_' . $lang; |
|
| 70 | + $lang = '_'.$lang; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // 1) dans un repertoire nomme lang/ se trouvant sur le chemin |
| 74 | 74 | if ( |
| 75 | 75 | $f = ($module == 'local' |
| 76 | - ? find_in_path($module . $lang . '.php', 'lang/') |
|
| 77 | - : find_langs_in_path($module . $lang . '.php', 'lang/')) |
|
| 76 | + ? find_in_path($module.$lang.'.php', 'lang/') |
|
| 77 | + : find_langs_in_path($module.$lang.'.php', 'lang/')) |
|
| 78 | 78 | ) { |
| 79 | 79 | return is_array($f) ? $f : [$f]; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // 2) directement dans le chemin (old style, uniquement pour local) |
| 83 | 83 | return (($module == 'local') or strpos($module, '/')) |
| 84 | - ? (($f = find_in_path($module . $lang . '.php')) ? [$f] : false) |
|
| 84 | + ? (($f = find_in_path($module.$lang.'.php')) ? [$f] : false) |
|
| 85 | 85 | : false; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | **/ |
| 106 | 106 | function charger_langue($lang, $module = 'spip') { |
| 107 | 107 | static $langs = []; |
| 108 | - $var = 'i18n_' . $module . '_' . $lang; |
|
| 108 | + $var = 'i18n_'.$module.'_'.$lang; |
|
| 109 | 109 | if (!isset($langs[$lang])) { |
| 110 | 110 | $langs[$lang] = []; |
| 111 | 111 | if ($lang) { |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | foreach ($langs[$lang] as $l) { |
| 122 | 122 | if ($fichiers_lang = chercher_module_lang($module, $l)) { |
| 123 | - $GLOBALS['idx_lang'] = 'i18n_' . $module . '_' . $l; |
|
| 123 | + $GLOBALS['idx_lang'] = 'i18n_'.$module.'_'.$l; |
|
| 124 | 124 | $GLOBALS[$GLOBALS['idx_lang']] = lire_fichier_langue(array_shift($fichiers_lang)); |
| 125 | 125 | surcharger_langue($fichiers_lang); |
| 126 | 126 | if ($l !== $lang) { |
| 127 | - $GLOBALS[$var] = &$GLOBALS['i18n_' . $module . '_' . $l]; |
|
| 127 | + $GLOBALS[$var] = &$GLOBALS['i18n_'.$module.'_'.$l]; |
|
| 128 | 128 | } |
| 129 | - $GLOBALS['lang_' . $var] = $l; |
|
| 129 | + $GLOBALS['lang_'.$var] = $l; |
|
| 130 | 130 | #spip_log("module de langue : {$module}_$l.php", 'traduire'); |
| 131 | 131 | break; |
| 132 | 132 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | function lire_fichier_langue(string $fichier): array { |
| 146 | 146 | $idx_lang_before = $GLOBALS['idx_lang'] ?? null; |
| 147 | - $idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang') . '@temporaire'; |
|
| 147 | + $idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang').'@temporaire'; |
|
| 148 | 148 | $GLOBALS['idx_lang'] = $idx_lang_tmp; |
| 149 | 149 | $idx_lang = include $fichier; |
| 150 | 150 | $GLOBALS['idx_lang'] = $idx_lang_before; |
@@ -273,27 +273,27 @@ discard block |
||
| 273 | 273 | } else { |
| 274 | 274 | $modules = ['spip', 'ecrire']; |
| 275 | 275 | $code = $ori; |
| 276 | - $ori_complet = implode('|', $modules) . ':' . $ori; |
|
| 276 | + $ori_complet = implode('|', $modules).':'.$ori; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | $desc = new SPIP_Traductions_Description(); |
| 280 | 280 | |
| 281 | 281 | // parcourir tous les modules jusqu'a ce qu'on trouve |
| 282 | 282 | foreach ($modules as $module) { |
| 283 | - $var = 'i18n_' . $module . '_' . $lang; |
|
| 283 | + $var = 'i18n_'.$module.'_'.$lang; |
|
| 284 | 284 | |
| 285 | 285 | if (empty($GLOBALS[$var])) { |
| 286 | 286 | charger_langue($lang, $module); |
| 287 | 287 | // surcharges persos -- on cherche |
| 288 | 288 | // (lang/)local_xx.php et/ou (lang/)local.php ... |
| 289 | - if (!isset($local['local_' . $lang])) { |
|
| 289 | + if (!isset($local['local_'.$lang])) { |
|
| 290 | 290 | // redéfinir la langue en cours pour les surcharges (chercher_langue a pu le changer) |
| 291 | 291 | $GLOBALS['idx_lang'] = $var; |
| 292 | 292 | // ... (lang/)local_xx.php |
| 293 | - $local['local_' . $lang] = chercher_module_lang('local', $lang); |
|
| 293 | + $local['local_'.$lang] = chercher_module_lang('local', $lang); |
|
| 294 | 294 | } |
| 295 | - if ($local['local_' . $lang]) { |
|
| 296 | - surcharger_langue($local['local_' . $lang]); |
|
| 295 | + if ($local['local_'.$lang]) { |
|
| 296 | + surcharger_langue($local['local_'.$lang]); |
|
| 297 | 297 | } |
| 298 | 298 | // ... puis (lang/)local.php |
| 299 | 299 | if (!isset($local['local'])) { |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | if (isset($GLOBALS[$var][$code])) { |
| 308 | 308 | $desc->code = $code; |
| 309 | 309 | $desc->module = $module; |
| 310 | - $desc->langue = $GLOBALS['lang_' . $var] ?? $lang; |
|
| 310 | + $desc->langue = $GLOBALS['lang_'.$var] ?? $lang; |
|
| 311 | 311 | $desc->texte = $GLOBALS[$var][$code]; |
| 312 | 312 | break; |
| 313 | 313 | } |
@@ -365,13 +365,13 @@ discard block |
||
| 365 | 365 | if (!$desc->mode and $desc->texte) { |
| 366 | 366 | // ne pas modifier 2 fois l'affichage |
| 367 | 367 | $desc->mode = 'traduction'; |
| 368 | - $classe = 'debug-traduction' . ($desc->module == 'ecrire' ? '-prive' : ''); |
|
| 368 | + $classe = 'debug-traduction'.($desc->module == 'ecrire' ? '-prive' : ''); |
|
| 369 | 369 | $desc->texte = '<span ' |
| 370 | - . 'lang=' . $desc->langue |
|
| 371 | - . ' class=' . $classe |
|
| 372 | - . ' data-module=' . $desc->module |
|
| 373 | - . ' data-code=' . $desc->code |
|
| 374 | - . ' title=' . $modules . '(' . $desc->langue . ')>' |
|
| 370 | + . 'lang='.$desc->langue |
|
| 371 | + . ' class='.$classe |
|
| 372 | + . ' data-module='.$desc->module |
|
| 373 | + . ' data-code='.$desc->code |
|
| 374 | + . ' title='.$modules.'('.$desc->langue.')>' |
|
| 375 | 375 | . $desc->texte |
| 376 | 376 | . '</span>'; |
| 377 | 377 | $desc->texte = str_replace( |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | : calculer_liste($val, $p->descr, $boucles, $id_boucle); |
| 121 | 121 | if ($var !== 1) { |
| 122 | 122 | $val = ($echap ? "\'$var\' => ' . argumenter_squelette(" : "'$var' => ") |
| 123 | - . $val . ($echap ? ") . '" : ' '); |
|
| 123 | + . $val.($echap ? ") . '" : ' '); |
|
| 124 | 124 | } else { |
| 125 | 125 | $val = $echap ? "'.$val.'" : $val; |
| 126 | 126 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | if (!$lang) { |
| 142 | 142 | $lang = '$GLOBALS["spip_lang"]'; |
| 143 | 143 | } |
| 144 | - $l['lang'] = ($echap ? "\'lang\' => ' . argumenter_squelette(" : "'lang' => ") . $lang . ($echap ? ") . '" : ' '); |
|
| 144 | + $l['lang'] = ($echap ? "\'lang\' => ' . argumenter_squelette(" : "'lang' => ").$lang.($echap ? ") . '" : ' '); |
|
| 145 | 145 | |
| 146 | 146 | return $l; |
| 147 | 147 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $_contexte = argumenter_inclure($p->param, false, $p, $boucles, $id_boucle, true, '', true); |
| 172 | 172 | if (is_string($p->texte)) { |
| 173 | 173 | $fichier = $p->texte; |
| 174 | - $code = '"' . str_replace('"', '\"', $fichier) . '"'; |
|
| 174 | + $code = '"'.str_replace('"', '\"', $fichier).'"'; |
|
| 175 | 175 | } else { |
| 176 | 176 | $code = calculer_liste($p->texte, $p->descr, $boucles, $id_boucle); |
| 177 | 177 | if ($code and preg_match("/^'([^']*)'/s", $code, $r)) { |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | return false; |
| 221 | 221 | } // j'aurais voulu toucher le fond ... |
| 222 | 222 | |
| 223 | - $contexte = 'array(' . $_contexte . ')'; |
|
| 223 | + $contexte = 'array('.$_contexte.')'; |
|
| 224 | 224 | |
| 225 | 225 | if ($env) { |
| 226 | 226 | $contexte = "array_merge('.var_export(\$Pile[0],1).',$contexte)"; |
@@ -235,16 +235,16 @@ discard block |
||
| 235 | 235 | $_options[] = $ajax; |
| 236 | 236 | } |
| 237 | 237 | $code = " ' . argumenter_squelette($code) . '"; |
| 238 | - $code = 'echo ' . sprintf( |
|
| 238 | + $code = 'echo '.sprintf( |
|
| 239 | 239 | CODE_RECUPERER_FOND, |
| 240 | 240 | $code, |
| 241 | 241 | $contexte, |
| 242 | 242 | implode(',', $_options), |
| 243 | 243 | "_request(\\'connect\\') ?? \\'\\'" |
| 244 | - ) . ';'; |
|
| 244 | + ).';'; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - return "\n'<'.'" . '?php ' . $code . "\n?'." . "'>'"; |
|
| 247 | + return "\n'<'.'".'?php '.$code."\n?'."."'>'"; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $id = $id_table; |
| 325 | 325 | $statut = preg_replace(',\W,', '', $s['champ']); // securite |
| 326 | 326 | } |
| 327 | - $mstatut = $id . '.' . $statut; |
|
| 327 | + $mstatut = $id.'.'.$statut; |
|
| 328 | 328 | |
| 329 | 329 | $arg_ignore_previsu = ($ignore_previsu ? ',true' : ''); |
| 330 | 330 | include_spip('public/quete'); |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | isset($s['post_date']) and $s['post_date'] |
| 333 | 333 | and $GLOBALS['meta']['post_dates'] == 'non' |
| 334 | 334 | ) { |
| 335 | - $date = $id . '.' . preg_replace(',\W,', '', $s['post_date']); // securite |
|
| 335 | + $date = $id.'.'.preg_replace(',\W,', '', $s['post_date']); // securite |
|
| 336 | 336 | array_unshift( |
| 337 | 337 | $boucle->where, |
| 338 | 338 | $echapper ? |
| 339 | - "\nquete_condition_postdates('$date'," . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 339 | + "\nquete_condition_postdates('$date',"._q($boucle->sql_serveur)."$arg_ignore_previsu)" |
|
| 340 | 340 | : |
| 341 | 341 | quete_condition_postdates($date, $boucle->sql_serveur, $ignore_previsu) |
| 342 | 342 | ); |
@@ -345,9 +345,9 @@ discard block |
||
| 345 | 345 | $boucle->where, |
| 346 | 346 | $echapper ? |
| 347 | 347 | "\nquete_condition_statut('$mstatut'," |
| 348 | - . _q($s['previsu']) . ',' |
|
| 349 | - . _q($s['publie']) . ',' |
|
| 350 | - . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 348 | + . _q($s['previsu']).',' |
|
| 349 | + . _q($s['publie']).',' |
|
| 350 | + . _q($boucle->sql_serveur)."$arg_ignore_previsu)" |
|
| 351 | 351 | : |
| 352 | 352 | quete_condition_statut($mstatut, $s['previsu'], $s['publie'], $boucle->sql_serveur, $ignore_previsu) |
| 353 | 353 | ); |
@@ -381,14 +381,14 @@ discard block |
||
| 381 | 381 | if (_request('var_mode_affiche') != 'resultat') { |
| 382 | 382 | $trace = ''; |
| 383 | 383 | } else { |
| 384 | - $_trace = $boucles[$id_boucle]->descr['nom'] . $id_boucle; |
|
| 384 | + $_trace = $boucles[$id_boucle]->descr['nom'].$id_boucle; |
|
| 385 | 385 | $_trace = "\$GLOBALS['debug_objets']['resultat']['$_trace']"; |
| 386 | 386 | $trace = " |
| 387 | 387 | if (empty($_trace)) { |
| 388 | 388 | $_trace = []; |
| 389 | 389 | } |
| 390 | 390 | if (count($_trace) < 3) { |
| 391 | - $_trace" . '[] = $t0; |
|
| 391 | + $_trace".'[] = $t0; |
|
| 392 | 392 | }'; |
| 393 | 393 | } |
| 394 | 394 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | return |
| 423 | 423 | // Numrows[$nom] peut ne pas être encore defini |
| 424 | 424 | "\n\t\$save_numrows = (isset(\$Numrows['$nom']) ? \$Numrows['$nom'] : array());" |
| 425 | - . "\n\t\$t0 = " . $boucles[$id_boucle]->return . ';' |
|
| 425 | + . "\n\t\$t0 = ".$boucles[$id_boucle]->return.';' |
|
| 426 | 426 | . "\n\t\$Numrows['$nom'] = (\$save_numrows);" |
| 427 | 427 | . $trace |
| 428 | 428 | . "\n\treturn \$t0;"; |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | // faudrait expanser le foreach a la compil, car y en a souvent qu'un |
| 491 | 491 | // et puis faire un [] plutot qu'un "','." |
| 492 | 492 | if ($boucle->doublons) { |
| 493 | - $corps .= "\n\t\t\tforeach(" . $boucle->doublons . ' as $k) $doublons[$k] .= "," . ' . |
|
| 493 | + $corps .= "\n\t\t\tforeach(".$boucle->doublons.' as $k) $doublons[$k] .= "," . '. |
|
| 494 | 494 | index_pile($id_boucle, $primary, $boucles) |
| 495 | 495 | . "; // doublons\n"; |
| 496 | 496 | } |
@@ -518,13 +518,13 @@ discard block |
||
| 518 | 518 | $corps .= |
| 519 | 519 | "\n\t\tlang_select_public(" |
| 520 | 520 | . index_pile($id_boucle, 'lang', $boucles) |
| 521 | - . ", '" . $boucle->lang_select . "'" |
|
| 521 | + . ", '".$boucle->lang_select."'" |
|
| 522 | 522 | . (in_array($type_boucle, [ |
| 523 | 523 | 'articles', |
| 524 | 524 | 'rubriques', |
| 525 | 525 | 'hierarchie', |
| 526 | 526 | 'breves' |
| 527 | - ]) ? ', ' . index_pile($id_boucle, 'titre', $boucles) : '') |
|
| 527 | + ]) ? ', '.index_pile($id_boucle, 'titre', $boucles) : '') |
|
| 528 | 528 | . ');'; |
| 529 | 529 | } else { |
| 530 | 530 | $init_lang = ''; |
@@ -546,20 +546,16 @@ discard block |
||
| 546 | 546 | |
| 547 | 547 | // gestion optimale des separateurs et des boucles constantes |
| 548 | 548 | if (is_countable($boucle->separateur) ? count($boucle->separateur) : 0) { |
| 549 | - $code_sep = ("'" . str_replace("'", "\'", join('', $boucle->separateur)) . "'"); |
|
| 549 | + $code_sep = ("'".str_replace("'", "\'", join('', $boucle->separateur))."'"); |
|
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | $corps .= |
| 553 | 553 | ((!$boucle->separateur) ? |
| 554 | - (($constant && !$corps && !$flag_cpt) ? $return : |
|
| 555 | - (($return === "''") ? '' : |
|
| 556 | - ("\n\t\t" . '$t0 .= ' . $return . ';'))) : |
|
| 557 | - ("\n\t\t\$t1 " . |
|
| 554 | + (($constant && !$corps && !$flag_cpt) ? $return : (($return === "''") ? '' : ("\n\t\t".'$t0 .= '.$return.';'))) : ("\n\t\t\$t1 ". |
|
| 558 | 555 | ((strpos($return, '$t1.') === 0) ? |
| 559 | - ('.=' . substr($return, 4)) : |
|
| 560 | - ('= ' . $return)) . |
|
| 561 | - ";\n\t\t" . |
|
| 562 | - '$t0 .= ((strlen($t1) && strlen($t0)) ? ' . $code_sep . " : '') . \$t1;")); |
|
| 556 | + ('.='.substr($return, 4)) : ('= '.$return)). |
|
| 557 | + ";\n\t\t". |
|
| 558 | + '$t0 .= ((strlen($t1) && strlen($t0)) ? '.$code_sep." : '') . \$t1;")); |
|
| 563 | 559 | |
| 564 | 560 | // Calculer les invalideurs si c'est une boucle non constante et si on |
| 565 | 561 | // souhaite invalider ces elements |
@@ -641,7 +637,7 @@ discard block |
||
| 641 | 637 | $corps, |
| 642 | 638 | $fin_lang, |
| 643 | 639 | $trace, |
| 644 | - 'BOUCLE' . $id_boucle . ' @ ' . ($boucle->descr['sourcefile']) |
|
| 640 | + 'BOUCLE'.$id_boucle.' @ '.($boucle->descr['sourcefile']) |
|
| 645 | 641 | ); |
| 646 | 642 | |
| 647 | 643 | # var_dump($a);exit; |
@@ -662,25 +658,24 @@ discard block |
||
| 662 | 658 | **/ |
| 663 | 659 | function calculer_requete_sql($boucle) { |
| 664 | 660 | $init = []; |
| 665 | - $init[] = calculer_dec('table', "'" . $boucle->id_table . "'"); |
|
| 666 | - $init[] = calculer_dec('id', "'" . $boucle->id_boucle . "'"); |
|
| 661 | + $init[] = calculer_dec('table', "'".$boucle->id_table."'"); |
|
| 662 | + $init[] = calculer_dec('id', "'".$boucle->id_boucle."'"); |
|
| 667 | 663 | # En absence de champ c'est un decompte : |
| 668 | 664 | $init[] = calculer_dec('from', calculer_from($boucle)); |
| 669 | 665 | $init[] = calculer_dec('type', calculer_from_type($boucle)); |
| 670 | 666 | $init[] = calculer_dec( |
| 671 | 667 | 'groupby', |
| 672 | - 'array(' . (($g = join("\",\n\t\t\"", $boucle->group)) ? '"' . $g . '"' : '') . ')' |
|
| 668 | + 'array('.(($g = join("\",\n\t\t\"", $boucle->group)) ? '"'.$g.'"' : '').')' |
|
| 673 | 669 | ); |
| 674 | - $init[] = calculer_dec('select', 'array("' . join("\",\n\t\t\"", $boucle->select) . '")'); |
|
| 675 | - $init[] = calculer_dec('orderby', 'array(' . calculer_order($boucle) . ')'); |
|
| 670 | + $init[] = calculer_dec('select', 'array("'.join("\",\n\t\t\"", $boucle->select).'")'); |
|
| 671 | + $init[] = calculer_dec('orderby', 'array('.calculer_order($boucle).')'); |
|
| 676 | 672 | $init[] = calculer_dec('where', calculer_dump_array($boucle->where)); |
| 677 | 673 | $init[] = calculer_dec('join', calculer_dump_join($boucle->join)); |
| 678 | 674 | $init[] = calculer_dec( |
| 679 | 675 | 'limit', |
| 680 | 676 | ( |
| 681 | 677 | strpos($boucle->limit, 'intval') === false ? |
| 682 | - "'" . ($boucle->limit) . "'" : |
|
| 683 | - $boucle->limit |
|
| 678 | + "'".($boucle->limit)."'" : $boucle->limit |
|
| 684 | 679 | ) |
| 685 | 680 | ); |
| 686 | 681 | $init[] = calculer_dec('having', calculer_dump_array($boucle->having)); |
@@ -689,17 +684,17 @@ discard block |
||
| 689 | 684 | // ou recalculée à chaque passage (vide) |
| 690 | 685 | foreach ($init as $i) { |
| 691 | 686 | if (reset($i)) { |
| 692 | - $s .= "\n\t\t" . end($i); |
|
| 687 | + $s .= "\n\t\t".end($i); |
|
| 693 | 688 | } # statique |
| 694 | 689 | else { |
| 695 | - $d .= "\n\t" . end($i); |
|
| 690 | + $d .= "\n\t".end($i); |
|
| 696 | 691 | } # dynamique |
| 697 | 692 | } |
| 698 | 693 | |
| 699 | 694 | return ($boucle->hierarchie ? "\n\t$boucle->hierarchie" : '') |
| 700 | 695 | . $boucle->in |
| 701 | 696 | . $boucle->hash |
| 702 | - . "\n\t" . 'if (!isset($command[\'table\'])) {' |
|
| 697 | + . "\n\t".'if (!isset($command[\'table\'])) {' |
|
| 703 | 698 | . $s |
| 704 | 699 | . "\n\t}" |
| 705 | 700 | . $d; |
@@ -754,7 +749,7 @@ discard block |
||
| 754 | 749 | ]; |
| 755 | 750 | |
| 756 | 751 | $p->id_boucle = $context_compil[2] ?? ''; |
| 757 | - $p->ligne = (int)($context_compil[3] ?? 0); |
|
| 752 | + $p->ligne = (int) ($context_compil[3] ?? 0); |
|
| 758 | 753 | $p->lang = $context_compil[4] ?? ''; |
| 759 | 754 | |
| 760 | 755 | return $p; |
@@ -783,7 +778,7 @@ discard block |
||
| 783 | 778 | * - index 1 : Code de l'affectation |
| 784 | 779 | **/ |
| 785 | 780 | function calculer_dec($nom, $val) { |
| 786 | - $static = 'if (!isset($command[\'' . $nom . '\'])) '; |
|
| 781 | + $static = 'if (!isset($command[\''.$nom.'\'])) '; |
|
| 787 | 782 | // si une variable apparait dans le calcul de la clause |
| 788 | 783 | // il faut la re-evaluer a chaque passage |
| 789 | 784 | if ( |
@@ -800,7 +795,7 @@ discard block |
||
| 800 | 795 | $static = ''; |
| 801 | 796 | } |
| 802 | 797 | |
| 803 | - return [$static, '$command[\'' . $nom . '\'] = ' . $val . ';']; |
|
| 798 | + return [$static, '$command[\''.$nom.'\'] = '.$val.';']; |
|
| 804 | 799 | } |
| 805 | 800 | |
| 806 | 801 | /** |
@@ -825,27 +820,27 @@ discard block |
||
| 825 | 820 | } |
| 826 | 821 | $res = ''; |
| 827 | 822 | if ($a and $a[0] == "'?'") { |
| 828 | - return ('(' . calculer_dump_array($a[1]) . |
|
| 829 | - ' ? ' . calculer_dump_array($a[2]) . |
|
| 830 | - ' : ' . calculer_dump_array($a[3]) . |
|
| 823 | + return ('('.calculer_dump_array($a[1]). |
|
| 824 | + ' ? '.calculer_dump_array($a[2]). |
|
| 825 | + ' : '.calculer_dump_array($a[3]). |
|
| 831 | 826 | ')'); |
| 832 | 827 | } else { |
| 833 | 828 | foreach ($a as $k => $v) { |
| 834 | - $showk = (is_numeric($k) ? '' : sql_quote($k) . ' => '); |
|
| 835 | - $res .= ', ' . $showk . calculer_dump_array($v); |
|
| 829 | + $showk = (is_numeric($k) ? '' : sql_quote($k).' => '); |
|
| 830 | + $res .= ', '.$showk.calculer_dump_array($v); |
|
| 836 | 831 | } |
| 837 | 832 | |
| 838 | - return "\n\t\t\tarray(" . substr($res, 2) . ')'; |
|
| 833 | + return "\n\t\t\tarray(".substr($res, 2).')'; |
|
| 839 | 834 | } |
| 840 | 835 | } |
| 841 | 836 | |
| 842 | 837 | function calculer_dump_join($a) { |
| 843 | 838 | $res = ''; |
| 844 | 839 | foreach ($a as $k => $v) { |
| 845 | - $res .= ", '$k' => array(" . implode(',', $v) . ')'; |
|
| 840 | + $res .= ", '$k' => array(".implode(',', $v).')'; |
|
| 846 | 841 | } |
| 847 | 842 | |
| 848 | - return 'array(' . substr($res, 2) . ')'; |
|
| 843 | + return 'array('.substr($res, 2).')'; |
|
| 849 | 844 | } |
| 850 | 845 | |
| 851 | 846 | /** |
@@ -862,7 +857,7 @@ discard block |
||
| 862 | 857 | $res .= ",'$k' => '$v'"; |
| 863 | 858 | } |
| 864 | 859 | |
| 865 | - return 'array(' . substr($res, 1) . ')'; |
|
| 860 | + return 'array('.substr($res, 1).')'; |
|
| 866 | 861 | } |
| 867 | 862 | |
| 868 | 863 | /** |
@@ -880,7 +875,7 @@ discard block |
||
| 880 | 875 | $res .= ",'$k' => '$v'"; |
| 881 | 876 | } |
| 882 | 877 | |
| 883 | - return 'array(' . substr($res, 1) . ')'; |
|
| 878 | + return 'array('.substr($res, 1).')'; |
|
| 884 | 879 | } |
| 885 | 880 | |
| 886 | 881 | function calculer_order(&$boucle) { |
@@ -949,19 +944,19 @@ discard block |
||
| 949 | 944 | ) { |
| 950 | 945 | $res .= " .\n$tab$code"; |
| 951 | 946 | } else { |
| 952 | - $res = substr($res, 0, -1) . substr($code, 1); |
|
| 947 | + $res = substr($res, 0, -1).substr($code, 1); |
|
| 953 | 948 | } |
| 954 | 949 | } |
| 955 | 950 | |
| 956 | - return '(' . substr($res, 2 + $descr['niv']) . ')'; |
|
| 951 | + return '('.substr($res, 2 + $descr['niv']).')'; |
|
| 957 | 952 | } |
| 958 | 953 | } else { |
| 959 | - $nom = $descr['nom'] . $id_boucle . ($descr['niv'] ?: ''); |
|
| 954 | + $nom = $descr['nom'].$id_boucle.($descr['niv'] ?: ''); |
|
| 960 | 955 | |
| 961 | - return "join('', array_map('array_shift', \$GLOBALS['debug_objets']['sequence']['$nom'] = array(" . join( |
|
| 956 | + return "join('', array_map('array_shift', \$GLOBALS['debug_objets']['sequence']['$nom'] = array(".join( |
|
| 962 | 957 | " ,\n$tab", |
| 963 | 958 | $codes |
| 964 | - ) . ')))'; |
|
| 959 | + ).')))'; |
|
| 965 | 960 | } |
| 966 | 961 | } |
| 967 | 962 | |
@@ -988,7 +983,7 @@ discard block |
||
| 988 | 983 | // texte seul |
| 989 | 984 | case 'texte': |
| 990 | 985 | $code = sandbox_composer_texte($p->texte, $p); |
| 991 | - $commentaire = strlen($p->texte) . ' signes'; |
|
| 986 | + $commentaire = strlen($p->texte).' signes'; |
|
| 992 | 987 | $avant = ''; |
| 993 | 988 | $apres = ''; |
| 994 | 989 | $altern = "''"; |
@@ -997,14 +992,14 @@ discard block |
||
| 997 | 992 | case 'polyglotte': |
| 998 | 993 | $code = ''; |
| 999 | 994 | foreach ($p->traductions as $k => $v) { |
| 1000 | - $code .= ",'" . |
|
| 1001 | - str_replace(['\\', "'"], ['\\\\', "\\'"], $k) . |
|
| 1002 | - "' => '" . |
|
| 1003 | - str_replace(['\\', "'"], ['\\\\', "\\'"], $v) . |
|
| 995 | + $code .= ",'". |
|
| 996 | + str_replace(['\\', "'"], ['\\\\', "\\'"], $k). |
|
| 997 | + "' => '". |
|
| 998 | + str_replace(['\\', "'"], ['\\\\', "\\'"], $v). |
|
| 1004 | 999 | "'"; |
| 1005 | 1000 | } |
| 1006 | - $code = 'choisir_traduction(array(' . |
|
| 1007 | - substr($code, 1) . |
|
| 1001 | + $code = 'choisir_traduction(array('. |
|
| 1002 | + substr($code, 1). |
|
| 1008 | 1003 | '))'; |
| 1009 | 1004 | $commentaire = '&'; |
| 1010 | 1005 | $avant = ''; |
@@ -1020,7 +1015,7 @@ discard block |
||
| 1020 | 1015 | $err_e_c = true; |
| 1021 | 1016 | $code = "''"; |
| 1022 | 1017 | } else { |
| 1023 | - $commentaire = '<INCLURE ' . addslashes(str_replace("\n", ' ', $code)) . '>'; |
|
| 1018 | + $commentaire = '<INCLURE '.addslashes(str_replace("\n", ' ', $code)).'>'; |
|
| 1024 | 1019 | $avant = ''; |
| 1025 | 1020 | $apres = ''; |
| 1026 | 1021 | $altern = "''"; |
@@ -1049,8 +1044,8 @@ discard block |
||
| 1049 | 1044 | $err_e_c = true; |
| 1050 | 1045 | $code = "''"; |
| 1051 | 1046 | } else { |
| 1052 | - $code = 'BOUCLE' . |
|
| 1053 | - str_replace('-', '_', $nom) . $descr['nom'] . |
|
| 1047 | + $code = 'BOUCLE'. |
|
| 1048 | + str_replace('-', '_', $nom).$descr['nom']. |
|
| 1054 | 1049 | '($Cache, $Pile, $doublons, $Numrows, $SP)'; |
| 1055 | 1050 | $commentaire = "?$nom"; |
| 1056 | 1051 | if ( |
@@ -1092,24 +1087,22 @@ discard block |
||
| 1092 | 1087 | foreach ($p->arg as $k => $v) { |
| 1093 | 1088 | $_v = calculer_liste($v, $descr, $boucles, $id_boucle); |
| 1094 | 1089 | if ($k) { |
| 1095 | - $l[] = _q($k) . ' => ' . $_v; |
|
| 1090 | + $l[] = _q($k).' => '.$_v; |
|
| 1096 | 1091 | } else { |
| 1097 | 1092 | $code = $_v; |
| 1098 | 1093 | } |
| 1099 | 1094 | } |
| 1100 | 1095 | // Si le module n'est pas fourni, l'expliciter sauf si calculé |
| 1101 | 1096 | if ($p->module) { |
| 1102 | - $m = $p->module . ':' . $p->nom_champ; |
|
| 1097 | + $m = $p->module.':'.$p->nom_champ; |
|
| 1103 | 1098 | } elseif ($p->nom_champ) { |
| 1104 | - $m = MODULES_IDIOMES . ':' . $p->nom_champ; |
|
| 1099 | + $m = MODULES_IDIOMES.':'.$p->nom_champ; |
|
| 1105 | 1100 | } else { |
| 1106 | 1101 | $m = ''; |
| 1107 | 1102 | } |
| 1108 | 1103 | |
| 1109 | - $code = (!$code ? "'$m'" : |
|
| 1110 | - ($m ? "'$m' . $code" : |
|
| 1111 | - ("(strpos(\$x=$code, ':') ? \$x : ('" . MODULES_IDIOMES . ":' . \$x))"))) |
|
| 1112 | - . (!$l ? '' : (', array(' . implode(",\n", $l) . ')')); |
|
| 1104 | + $code = (!$code ? "'$m'" : ($m ? "'$m' . $code" : ("(strpos(\$x=$code, ':') ? \$x : ('".MODULES_IDIOMES.":' . \$x))"))) |
|
| 1105 | + . (!$l ? '' : (', array('.implode(",\n", $l).')')); |
|
| 1113 | 1106 | $code = "_T($code)"; |
| 1114 | 1107 | if ($p->param) { |
| 1115 | 1108 | $p->id_boucle = $id_boucle; |
@@ -1131,7 +1124,7 @@ discard block |
||
| 1131 | 1124 | $p->type_requete = $type; |
| 1132 | 1125 | |
| 1133 | 1126 | $code = calculer_champ($p); |
| 1134 | - $commentaire = '#' . $p->nom_champ . $p->etoile; |
|
| 1127 | + $commentaire = '#'.$p->nom_champ.$p->etoile; |
|
| 1135 | 1128 | $avant = calculer_liste( |
| 1136 | 1129 | $p->avant, |
| 1137 | 1130 | $descr, |
@@ -1171,10 +1164,9 @@ discard block |
||
| 1171 | 1164 | if ($code != "''") { |
| 1172 | 1165 | $code = compile_retour($code, $avant, $apres, $altern, $tab, $descr['niv']); |
| 1173 | 1166 | $codes[] = (($mode == 'validation') ? |
| 1174 | - "array($code, '$commentaire', " . $p->ligne . ')' |
|
| 1167 | + "array($code, '$commentaire', ".$p->ligne.')' |
|
| 1175 | 1168 | : (($mode == 'code') ? |
| 1176 | - "\n// $commentaire\n$code" : |
|
| 1177 | - $code)); |
|
| 1169 | + "\n// $commentaire\n$code" : $code)); |
|
| 1178 | 1170 | } |
| 1179 | 1171 | } // foreach |
| 1180 | 1172 | |
@@ -1230,19 +1222,19 @@ discard block |
||
| 1230 | 1222 | $cond = ''; |
| 1231 | 1223 | } elseif (preg_match(_REGEXP_COND_VIDE_NONVIDE, $code, $r)) { |
| 1232 | 1224 | $t = $r[2]; |
| 1233 | - $cond = '!' . $r[1]; |
|
| 1225 | + $cond = '!'.$r[1]; |
|
| 1234 | 1226 | } else { |
| 1235 | 1227 | if (preg_match(_REGEXP_COND_NONVIDE_VIDE, $code, $r)) { |
| 1236 | 1228 | $t = $r[2]; |
| 1237 | 1229 | $cond = $r[1]; |
| 1238 | 1230 | } else { |
| 1239 | - $t = '$t' . $n; |
|
| 1231 | + $t = '$t'.$n; |
|
| 1240 | 1232 | $cond = "($t = $code)!==''"; |
| 1241 | 1233 | } |
| 1242 | 1234 | } |
| 1243 | 1235 | |
| 1244 | - $res = (!$avant ? '' : "$avant . ") . |
|
| 1245 | - $t . |
|
| 1236 | + $res = (!$avant ? '' : "$avant . "). |
|
| 1237 | + $t. |
|
| 1246 | 1238 | (!$apres ? '' : " . $apres"); |
| 1247 | 1239 | |
| 1248 | 1240 | if ($res !== $t) { |
@@ -1293,12 +1285,12 @@ discard block |
||
| 1293 | 1285 | |
| 1294 | 1286 | // rendre inertes les echappements de #[](){}<> |
| 1295 | 1287 | $i = 0; |
| 1296 | - while (false !== strpos($squelette, $inerte = '-INERTE' . $i)) { |
|
| 1288 | + while (false !== strpos($squelette, $inerte = '-INERTE'.$i)) { |
|
| 1297 | 1289 | $i++; |
| 1298 | 1290 | } |
| 1299 | 1291 | $squelette = preg_replace_callback( |
| 1300 | 1292 | ',\\\\([#[()\]{}<>]),', |
| 1301 | - fn($a) => "$inerte-" . ord($a[1]) . '-', |
|
| 1293 | + fn($a) => "$inerte-".ord($a[1]).'-', |
|
| 1302 | 1294 | $squelette, |
| 1303 | 1295 | -1, |
| 1304 | 1296 | $esc |
@@ -1314,7 +1306,7 @@ discard block |
||
| 1314 | 1306 | // Phraser le squelette, selon sa grammaire |
| 1315 | 1307 | |
| 1316 | 1308 | $boucles = []; |
| 1317 | - $f = charger_fonction('phraser_' . $gram, 'public'); |
|
| 1309 | + $f = charger_fonction('phraser_'.$gram, 'public'); |
|
| 1318 | 1310 | |
| 1319 | 1311 | $squelette = $f($squelette, '', $boucles, $descr); |
| 1320 | 1312 | |
@@ -1330,7 +1322,7 @@ discard block |
||
| 1330 | 1322 | ); |
| 1331 | 1323 | $boucles[$i]->descr['squelette'] = preg_replace_callback( |
| 1332 | 1324 | ",$inerte-(\d+)-,", |
| 1333 | - fn($a) => '\\\\' . chr($a[1]), |
|
| 1325 | + fn($a) => '\\\\'.chr($a[1]), |
|
| 1334 | 1326 | $boucle->descr['squelette'] |
| 1335 | 1327 | ); |
| 1336 | 1328 | } |
@@ -1341,19 +1333,19 @@ discard block |
||
| 1341 | 1333 | include_spip('public/decompiler'); |
| 1342 | 1334 | foreach ($boucles as $id => $boucle) { |
| 1343 | 1335 | if ($id) { |
| 1344 | - $decomp = "\n/* BOUCLE " . |
|
| 1345 | - $boucle->type_requete . |
|
| 1346 | - ' ' . |
|
| 1347 | - str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')) . |
|
| 1348 | - ($boucle->debug ? "\n *\n * " . implode("\n * ", $boucle->debug) . "\n" : '') . |
|
| 1336 | + $decomp = "\n/* BOUCLE ". |
|
| 1337 | + $boucle->type_requete. |
|
| 1338 | + ' '. |
|
| 1339 | + str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')). |
|
| 1340 | + ($boucle->debug ? "\n *\n * ".implode("\n * ", $boucle->debug)."\n" : ''). |
|
| 1349 | 1341 | " */\n"; |
| 1350 | 1342 | } else { |
| 1351 | - $decomp = ("\n/*\n" . |
|
| 1343 | + $decomp = ("\n/*\n". |
|
| 1352 | 1344 | str_replace('*/', '* /', public_decompiler($squelette, $gram)) |
| 1353 | 1345 | . "\n*/"); |
| 1354 | 1346 | } |
| 1355 | - $boucles[$id]->return = $decomp . $boucle->return; |
|
| 1356 | - $GLOBALS['debug_objets']['code'][$nom . $id] = $boucle->return; |
|
| 1347 | + $boucles[$id]->return = $decomp.$boucle->return; |
|
| 1348 | + $GLOBALS['debug_objets']['code'][$nom.$id] = $boucle->return; |
|
| 1357 | 1349 | } |
| 1358 | 1350 | } |
| 1359 | 1351 | |
@@ -1376,7 +1368,7 @@ discard block |
||
| 1376 | 1368 | } |
| 1377 | 1369 | } |
| 1378 | 1370 | foreach ($boucles as $id => $boucle) { |
| 1379 | - $GLOBALS['debug_objets']['boucle'][$nom . $id] = $boucle; |
|
| 1371 | + $GLOBALS['debug_objets']['boucle'][$nom.$id] = $boucle; |
|
| 1380 | 1372 | } |
| 1381 | 1373 | $descr['documents'] = compile_inclure_doublons($squelette); |
| 1382 | 1374 | |
@@ -1467,8 +1459,7 @@ discard block |
||
| 1467 | 1459 | } else { |
| 1468 | 1460 | $boucles[$id]->type_requete = false; |
| 1469 | 1461 | $boucle = $boucles[$id]; |
| 1470 | - $x = (!$boucle->sql_serveur ? '' : |
|
| 1471 | - ($boucle->sql_serveur . ':')) . |
|
| 1462 | + $x = (!$boucle->sql_serveur ? '' : ($boucle->sql_serveur.':')). |
|
| 1472 | 1463 | $type; |
| 1473 | 1464 | $msg = [ |
| 1474 | 1465 | 'zbug_table_inconnue', |
@@ -1558,13 +1549,13 @@ discard block |
||
| 1558 | 1549 | if ( |
| 1559 | 1550 | // fonction de boucle avec serveur & table |
| 1560 | 1551 | (!$serveur or |
| 1561 | - ((!function_exists($f = 'boucle_' . $serveur . '_' . $table)) |
|
| 1562 | - and (!function_exists($f = $f . '_dist')) |
|
| 1552 | + ((!function_exists($f = 'boucle_'.$serveur.'_'.$table)) |
|
| 1553 | + and (!function_exists($f = $f.'_dist')) |
|
| 1563 | 1554 | ) |
| 1564 | 1555 | ) |
| 1565 | 1556 | // fonction de boucle avec table |
| 1566 | - and (!function_exists($f = 'boucle_' . $table)) |
|
| 1567 | - and (!function_exists($f = $f . '_dist')) |
|
| 1557 | + and (!function_exists($f = 'boucle_'.$table)) |
|
| 1558 | + and (!function_exists($f = $f.'_dist')) |
|
| 1568 | 1559 | ) { |
| 1569 | 1560 | // fonction de boucle standard |
| 1570 | 1561 | if (!function_exists($f = 'boucle_DEFAUT')) { |
@@ -1572,20 +1563,20 @@ discard block |
||
| 1572 | 1563 | } |
| 1573 | 1564 | } |
| 1574 | 1565 | |
| 1575 | - $req = "\n\n\tstatic \$command = array();\n\t" . |
|
| 1576 | - "static \$connect;\n\t" . |
|
| 1577 | - "\$command['connect'] = \$connect = " . |
|
| 1578 | - _q($boucle->sql_serveur) . |
|
| 1579 | - ';' . |
|
| 1566 | + $req = "\n\n\tstatic \$command = array();\n\t". |
|
| 1567 | + "static \$connect;\n\t". |
|
| 1568 | + "\$command['connect'] = \$connect = ". |
|
| 1569 | + _q($boucle->sql_serveur). |
|
| 1570 | + ';'. |
|
| 1580 | 1571 | $f($id, $boucles); |
| 1581 | 1572 | } else { |
| 1582 | 1573 | $req = ("\n\treturn '';"); |
| 1583 | 1574 | } |
| 1584 | 1575 | |
| 1585 | 1576 | $boucles[$id]->return = |
| 1586 | - "\n\nfunction BOUCLE" . strtr($id, '-', '_') . $nom . |
|
| 1587 | - '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {' . |
|
| 1588 | - $req . |
|
| 1577 | + "\n\nfunction BOUCLE".strtr($id, '-', '_').$nom. |
|
| 1578 | + '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {'. |
|
| 1579 | + $req. |
|
| 1589 | 1580 | "\n}\n"; |
| 1590 | 1581 | } |
| 1591 | 1582 | |
@@ -1595,7 +1586,7 @@ discard block |
||
| 1595 | 1586 | return false; |
| 1596 | 1587 | } |
| 1597 | 1588 | |
| 1598 | - $principal = "\nfunction " . $nom . '($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1589 | + $principal = "\nfunction ".$nom.'($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1599 | 1590 | ' |
| 1600 | 1591 | // reporter de maniere securisee les doublons inclus |
| 1601 | 1592 | . ' |
@@ -1603,15 +1594,15 @@ discard block |
||
| 1603 | 1594 | $doublons = nettoyer_env_doublons($Pile[0]["doublons"]); |
| 1604 | 1595 | |
| 1605 | 1596 | $connect = ' . |
| 1606 | - _q($connect) . '; |
|
| 1597 | + _q($connect).'; |
|
| 1607 | 1598 | $page = ' . |
| 1608 | 1599 | // ATTENTION, le calcul de l'expression $corps affectera $Cache |
| 1609 | 1600 | // c'est pourquoi on l'affecte a la variable auxiliaire $page. |
| 1610 | 1601 | // avant de referencer $Cache |
| 1611 | - $corps . '; |
|
| 1602 | + $corps.'; |
|
| 1612 | 1603 | |
| 1613 | 1604 | return analyse_resultat_skel(' . var_export($nom, true) |
| 1614 | - . ', $Cache, $page, ' . var_export($sourcefile, true) . '); |
|
| 1605 | + . ', $Cache, $page, '.var_export($sourcefile, true).'); |
|
| 1615 | 1606 | }'; |
| 1616 | 1607 | |
| 1617 | 1608 | $secondes = spip_timer('calcul_skel'); |
@@ -1625,10 +1616,10 @@ discard block |
||
| 1625 | 1616 | $code->return = ' |
| 1626 | 1617 | // |
| 1627 | 1618 | // Fonction principale du squelette ' . |
| 1628 | - $sourcefile . |
|
| 1629 | - ($connect ? " pour $connect" : '') . |
|
| 1630 | - (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes") . |
|
| 1631 | - "\n//\n" . |
|
| 1619 | + $sourcefile. |
|
| 1620 | + ($connect ? " pour $connect" : ''). |
|
| 1621 | + (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes"). |
|
| 1622 | + "\n//\n". |
|
| 1632 | 1623 | $principal; |
| 1633 | 1624 | |
| 1634 | 1625 | $boucles[''] = $code; |
@@ -1680,7 +1671,7 @@ discard block |
||
| 1680 | 1671 | **/ |
| 1681 | 1672 | function requeteur_data_dist(&$boucles, &$boucle, &$id) { |
| 1682 | 1673 | include_spip('iterateur/data'); |
| 1683 | - if ($h = charger_fonction($boucle->type_requete . '_to_array', 'inc', true)) { |
|
| 1674 | + if ($h = charger_fonction($boucle->type_requete.'_to_array', 'inc', true)) { |
|
| 1684 | 1675 | $g = charger_fonction('data', 'iterateur'); |
| 1685 | 1676 | $boucles[$id] = $g($boucle); |
| 1686 | 1677 | // from[0] stocke le type de data (rss, yql, ...) |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | $infos['url_voir'] = $infos['type']; |
| 707 | 707 | } |
| 708 | 708 | if (!isset($infos['url_edit'])) { |
| 709 | - $infos['url_edit'] = $infos['url_voir'] . ($infos['editable'] ? '_edit' : ''); |
|
| 709 | + $infos['url_edit'] = $infos['url_voir'].($infos['editable'] ? '_edit' : ''); |
|
| 710 | 710 | } |
| 711 | 711 | if (!isset($infos['icone_objet'])) { |
| 712 | 712 | $infos['icone_objet'] = $infos['type']; |
@@ -718,48 +718,48 @@ discard block |
||
| 718 | 718 | $infos['texte_retour'] = 'icone_retour'; |
| 719 | 719 | } |
| 720 | 720 | if (!isset($infos['texte_modifier'])) { |
| 721 | - $infos['texte_modifier'] = $infos['type'] . ':' . 'icone_modifier_' . $infos['type']; |
|
| 721 | + $infos['texte_modifier'] = $infos['type'].':'.'icone_modifier_'.$infos['type']; |
|
| 722 | 722 | } |
| 723 | 723 | if (!isset($infos['texte_creer'])) { |
| 724 | - $infos['texte_creer'] = $infos['type'] . ':' . 'icone_creer_' . $infos['type']; |
|
| 724 | + $infos['texte_creer'] = $infos['type'].':'.'icone_creer_'.$infos['type']; |
|
| 725 | 725 | } |
| 726 | 726 | if (!isset($infos['texte_creer_associer'])) { |
| 727 | - $infos['texte_creer_associer'] = $infos['type'] . ':' . 'texte_creer_associer_' . $infos['type']; |
|
| 727 | + $infos['texte_creer_associer'] = $infos['type'].':'.'texte_creer_associer_'.$infos['type']; |
|
| 728 | 728 | } |
| 729 | 729 | if (!isset($infos['texte_ajouter'])) { |
| 730 | 730 | // Ajouter un X |
| 731 | - $infos['texte_ajouter'] = $infos['type'] . ':' . 'texte_ajouter_' . $infos['type']; |
|
| 731 | + $infos['texte_ajouter'] = $infos['type'].':'.'texte_ajouter_'.$infos['type']; |
|
| 732 | 732 | } |
| 733 | 733 | if (!isset($infos['texte_objets'])) { |
| 734 | - $infos['texte_objets'] = $infos['type'] . ':' . 'titre_' . $infos['table_objet']; |
|
| 734 | + $infos['texte_objets'] = $infos['type'].':'.'titre_'.$infos['table_objet']; |
|
| 735 | 735 | } |
| 736 | 736 | if (!isset($infos['texte_objet'])) { |
| 737 | - $infos['texte_objet'] = $infos['type'] . ':' . 'titre_' . $infos['type']; |
|
| 737 | + $infos['texte_objet'] = $infos['type'].':'.'titre_'.$infos['type']; |
|
| 738 | 738 | } |
| 739 | 739 | if (!isset($infos['texte_logo_objet'])) { |
| 740 | 740 | // objet:titre_logo_objet "Logo de ce X" |
| 741 | - $infos['texte_logo_objet'] = $infos['type'] . ':' . 'titre_logo_' . $infos['type']; |
|
| 741 | + $infos['texte_logo_objet'] = $infos['type'].':'.'titre_logo_'.$infos['type']; |
|
| 742 | 742 | } |
| 743 | 743 | if (!isset($infos['texte_langue_objet'])) { |
| 744 | 744 | // objet:texte_langue_objet "Langue de ce X" |
| 745 | - $infos['texte_langue_objet'] = $infos['type'] . ':' . 'titre_langue_' . $infos['type']; |
|
| 745 | + $infos['texte_langue_objet'] = $infos['type'].':'.'titre_langue_'.$infos['type']; |
|
| 746 | 746 | } |
| 747 | 747 | if (!isset($infos['texte_definir_comme_traduction_objet'])) { |
| 748 | 748 | // "Ce X est une traduction du X numéro :" |
| 749 | - $infos['texte_definir_comme_traduction_objet'] = $infos['type'] . ':' . 'texte_definir_comme_traduction_' . $infos['type']; |
|
| 749 | + $infos['texte_definir_comme_traduction_objet'] = $infos['type'].':'.'texte_definir_comme_traduction_'.$infos['type']; |
|
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | // objet:info_aucun_objet |
| 753 | 753 | if (!isset($infos['info_aucun_objet'])) { |
| 754 | - $infos['info_aucun_objet'] = $infos['type'] . ':' . 'info_aucun_' . $infos['type']; |
|
| 754 | + $infos['info_aucun_objet'] = $infos['type'].':'.'info_aucun_'.$infos['type']; |
|
| 755 | 755 | } |
| 756 | 756 | // objet:info_1_objet |
| 757 | 757 | if (!isset($infos['info_1_objet'])) { |
| 758 | - $infos['info_1_objet'] = $infos['type'] . ':' . 'info_1_' . $infos['type']; |
|
| 758 | + $infos['info_1_objet'] = $infos['type'].':'.'info_1_'.$infos['type']; |
|
| 759 | 759 | } |
| 760 | 760 | // objet:info_nb_objets |
| 761 | 761 | if (!isset($infos['info_nb_objets'])) { |
| 762 | - $infos['info_nb_objets'] = $infos['type'] . ':' . 'info_nb_' . $infos['table_objet']; |
|
| 762 | + $infos['info_nb_objets'] = $infos['type'].':'.'info_nb_'.$infos['table_objet']; |
|
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | if (!isset($infos['champs_editables'])) { |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | } |
| 960 | 960 | $ts = sql_alltable(null, $serveur); // toutes les tables "spip_" (ou prefixe perso) |
| 961 | 961 | $connexion = $GLOBALS['connexions'][$serveur ?: 0]; |
| 962 | - $spip = $connexion['prefixe'] . '_'; |
|
| 962 | + $spip = $connexion['prefixe'].'_'; |
|
| 963 | 963 | foreach ($ts as $t) { |
| 964 | 964 | $t = substr($t, strlen($spip)); |
| 965 | 965 | $tables[$serveur]["spip_$t"] = $t; |
@@ -1028,10 +1028,10 @@ discard block |
||
| 1028 | 1028 | if ($serveur !== false) { |
| 1029 | 1029 | $t = lister_tables_spip($serveur); |
| 1030 | 1030 | $trouver_table = charger_fonction('trouver_table', 'base'); |
| 1031 | - $typetrim = rtrim($type, 's') . 's'; |
|
| 1031 | + $typetrim = rtrim($type, 's').'s'; |
|
| 1032 | 1032 | if ( |
| 1033 | 1033 | (isset($t[$typetrim]) or in_array($typetrim, $t)) |
| 1034 | - and ($desc = $trouver_table(rtrim($type, 's') . 's', $serveur)) |
|
| 1034 | + and ($desc = $trouver_table(rtrim($type, 's').'s', $serveur)) |
|
| 1035 | 1035 | ) { |
| 1036 | 1036 | return $desc['id_table']; |
| 1037 | 1037 | } elseif ( |
@@ -1041,11 +1041,11 @@ discard block |
||
| 1041 | 1041 | return $desc['id_table']; |
| 1042 | 1042 | } |
| 1043 | 1043 | |
| 1044 | - spip_log('table_objet(' . $type . ') calculee sans verification'); |
|
| 1044 | + spip_log('table_objet('.$type.') calculee sans verification'); |
|
| 1045 | 1045 | #spip_log(debug_backtrace(),'db'); |
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | - return rtrim($type, 's') . 's'; # cas historique ne devant plus servir, sauf si $serveur=false |
|
| 1048 | + return rtrim($type, 's').'s'; # cas historique ne devant plus servir, sauf si $serveur=false |
|
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | /** |
@@ -1229,7 +1229,7 @@ discard block |
||
| 1229 | 1229 | function objet_test_si_publie($objet, $id_objet, $serveur = '') { |
| 1230 | 1230 | // voir si une fonction est definie pour faire le boulot |
| 1231 | 1231 | // elle a la priorite dans ce cas |
| 1232 | - if ($f = charger_fonction($objet . '_test_si_publie', 'base', true)) { |
|
| 1232 | + if ($f = charger_fonction($objet.'_test_si_publie', 'base', true)) { |
|
| 1233 | 1233 | return $f($objet, $id_objet, $serveur); |
| 1234 | 1234 | } |
| 1235 | 1235 | |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | $boucle->sql_serveur = $serveur; |
| 1252 | 1252 | $boucle->select[] = $id_table_objet; |
| 1253 | 1253 | $boucle->from[$table_objet] = table_objet_sql($objet, $serveur); |
| 1254 | - $boucle->where[] = $id_table . '.' . $id_table_objet . '=' . intval($id_objet); |
|
| 1254 | + $boucle->where[] = $id_table.'.'.$id_table_objet.'='.intval($id_objet); |
|
| 1255 | 1255 | |
| 1256 | 1256 | $boucle->descr['nom'] = 'objet_test_si_publie'; // eviter notice php |
| 1257 | 1257 | $boucle->descr['sourcefile'] = 'internal'; |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | ? "{$parent_methode['source_champ']} = $id_objet" |
| 1379 | 1379 | : "$cle_objet = $id_objet"; |
| 1380 | 1380 | if (isset($parent_methode['source_champ_type'])) { |
| 1381 | - $where[] = "{$parent_methode['source_champ_type']} = " . sql_quote($objet); |
|
| 1381 | + $where[] = "{$parent_methode['source_champ_type']} = ".sql_quote($objet); |
|
| 1382 | 1382 | } |
| 1383 | 1383 | // -- Condition supplémentaire sur la détection du parent |
| 1384 | 1384 | if (isset($parent_methode['table_condition'])) { |
@@ -1502,11 +1502,11 @@ discard block |
||
| 1502 | 1502 | $where = []; |
| 1503 | 1503 | // -- L'identifiant du parent |
| 1504 | 1504 | if (isset($_methode_parent['champ'])) { |
| 1505 | - $where[] = $_methode_parent['champ'] . ' = ' . $id_objet; |
|
| 1505 | + $where[] = $_methode_parent['champ'].' = '.$id_objet; |
|
| 1506 | 1506 | } |
| 1507 | 1507 | // -- Si le parent est variable |
| 1508 | 1508 | if (isset($_methode_parent['champ_type'])) { |
| 1509 | - $where[] = $_methode_parent['champ_type'] . ' = ' . sql_quote($objet); |
|
| 1509 | + $where[] = $_methode_parent['champ_type'].' = '.sql_quote($objet); |
|
| 1510 | 1510 | } |
| 1511 | 1511 | |
| 1512 | 1512 | // On détermine la table, le champ id des enfants et on complète éventuellement les conditions |
@@ -64,27 +64,27 @@ discard block |
||
| 64 | 64 | // determiner le dossier de la base : $addr ou _DIR_DB |
| 65 | 65 | $f = _DIR_DB; |
| 66 | 66 | if ($addr and strpos($addr, '/') !== false) { |
| 67 | - $f = rtrim($addr, '/') . '/'; |
|
| 67 | + $f = rtrim($addr, '/').'/'; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // un nom de base demande et impossible d'obtenir la base, on s'en va : |
| 71 | 71 | // il faut que la base existe ou que le repertoire parent soit writable |
| 72 | - if ($db and !is_file($f .= $db . '.sqlite') and !is_writable(dirname($f))) { |
|
| 73 | - spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.' . _LOG_HS); |
|
| 72 | + if ($db and !is_file($f .= $db.'.sqlite') and !is_writable(dirname($f))) { |
|
| 73 | + spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.'._LOG_HS); |
|
| 74 | 74 | |
| 75 | 75 | return false; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // charger les modules sqlite au besoin |
| 79 | 79 | if (!_sqlite_charger_version($sqlite_version)) { |
| 80 | - spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.' . _LOG_HS); |
|
| 80 | + spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.'._LOG_HS); |
|
| 81 | 81 | |
| 82 | 82 | return false; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // chargement des constantes |
| 86 | 86 | // il ne faut pas definir les constantes avant d'avoir charge les modules sqlite |
| 87 | - $define = 'spip_sqlite' . $sqlite_version . '_constantes'; |
|
| 87 | + $define = 'spip_sqlite'.$sqlite_version.'_constantes'; |
|
| 88 | 88 | $define(); |
| 89 | 89 | |
| 90 | 90 | $ok = false; |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | // si pas de db -> |
| 93 | 93 | // base temporaire tant qu'on ne connait pas son vrai nom |
| 94 | 94 | // pour tester la connexion |
| 95 | - $db = '_sqlite' . $sqlite_version . '_install'; |
|
| 96 | - $tmp = _DIR_DB . $db . '.sqlite'; |
|
| 95 | + $db = '_sqlite'.$sqlite_version.'_install'; |
|
| 96 | + $tmp = _DIR_DB.$db.'.sqlite'; |
|
| 97 | 97 | $ok = $link = new \PDO("sqlite:$tmp"); |
| 98 | 98 | } else { |
| 99 | 99 | // Ouvrir (eventuellement creer la base) |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | if (!$ok) { |
| 104 | 104 | $e = _sqlite_last_error_from_link($link); |
| 105 | - spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.' . _LOG_HS); |
|
| 105 | + spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.'._LOG_HS); |
|
| 106 | 106 | |
| 107 | 107 | return false; |
| 108 | 108 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $table = $regs[3]; |
| 189 | 189 | $suite = $regs[4]; |
| 190 | 190 | } else { |
| 191 | - spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.' . _LOG_ERREUR); |
|
| 191 | + spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.'._LOG_ERREUR); |
|
| 192 | 192 | |
| 193 | 193 | return false; |
| 194 | 194 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $i = 0; |
| 206 | 206 | $ouverte = false; |
| 207 | 207 | while ($do = array_shift($todo)) { |
| 208 | - $todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . ',' . $do : $do; |
|
| 208 | + $todo2[$i] = isset($todo2[$i]) ? $todo2[$i].','.$do : $do; |
|
| 209 | 209 | $o = (false !== strpos($do, '(')); |
| 210 | 210 | $f = (false !== strpos($do, ')')); |
| 211 | 211 | if ($o and !$f) { |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | ) { |
| 232 | 232 | spip_log( |
| 233 | 233 | "SQLite : Probleme de ALTER TABLE, utilisation non reconnue dans : $do \n(requete d'origine : $query)", |
| 234 | - 'sqlite.' . _LOG_ERREUR |
|
| 234 | + 'sqlite.'._LOG_ERREUR |
|
| 235 | 235 | ); |
| 236 | 236 | |
| 237 | 237 | return false; |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | // pas geres en sqlite2 |
| 329 | 329 | case 'RENAME': |
| 330 | - $do = 'RENAME TO' . substr($do, 6); |
|
| 330 | + $do = 'RENAME TO'.substr($do, 6); |
|
| 331 | 331 | case 'RENAME TO': |
| 332 | 332 | if (!spip_sqlite::executer_requete("$debut $do", $serveur)) { |
| 333 | - spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 333 | + spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.'._LOG_ERREUR); |
|
| 334 | 334 | |
| 335 | 335 | return false; |
| 336 | 336 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | $colonnes = substr($colonne_origine, 1, -1); |
| 374 | 374 | if (false !== strpos(',', $colonnes)) { |
| 375 | 375 | spip_log('SQLite : Erreur, impossible de creer un index sur plusieurs colonnes' |
| 376 | - . " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.' . _LOG_ERREUR); |
|
| 376 | + . " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.'._LOG_ERREUR); |
|
| 377 | 377 | break; |
| 378 | 378 | } else { |
| 379 | 379 | $nom_index = $colonnes; |
@@ -388,12 +388,12 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | // pas geres en sqlite2 |
| 390 | 390 | case 'ADD COLUMN': |
| 391 | - $do = 'ADD' . substr($do, 10); |
|
| 391 | + $do = 'ADD'.substr($do, 10); |
|
| 392 | 392 | case 'ADD': |
| 393 | 393 | default: |
| 394 | 394 | if (!preg_match(',primary\s+key,i', $do)) { |
| 395 | 395 | if (!spip_sqlite::executer_requete("$debut $do", $serveur)) { |
| 396 | - spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 396 | + spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR); |
|
| 397 | 397 | |
| 398 | 398 | return false; |
| 399 | 399 | } |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | $opts['field'] = [$colonne_ajoutee => $def]; |
| 415 | 415 | if (!_sqlite_modifier_table($table, [$colonne_ajoutee], $opts, $serveur)) { |
| 416 | - spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 416 | + spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR); |
|
| 417 | 417 | |
| 418 | 418 | return false; |
| 419 | 419 | } |
@@ -421,10 +421,10 @@ discard block |
||
| 421 | 421 | break; |
| 422 | 422 | } |
| 423 | 423 | // tout est bon, ouf ! |
| 424 | - spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.' . _LOG_INFO); |
|
| 424 | + spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.'._LOG_INFO); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | - spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.' . _LOG_INFO); |
|
| 427 | + spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.'._LOG_INFO); |
|
| 428 | 428 | |
| 429 | 429 | return true; |
| 430 | 430 | } |
@@ -493,9 +493,9 @@ discard block |
||
| 493 | 493 | * @return bool true si la base est créee. |
| 494 | 494 | **/ |
| 495 | 495 | function spip_sqlite_create_base($nom, $serveur = '', $option = true) { |
| 496 | - $f = $nom . '.sqlite'; |
|
| 496 | + $f = $nom.'.sqlite'; |
|
| 497 | 497 | if (strpos($nom, '/') === false) { |
| 498 | - $f = _DIR_DB . $f; |
|
| 498 | + $f = _DIR_DB.$f; |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | $ok = new \PDO("sqlite:$f"); |
@@ -535,13 +535,13 @@ discard block |
||
| 535 | 535 | if (sql_showtable($nom, false, $serveur)) { |
| 536 | 536 | spip_log( |
| 537 | 537 | "Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", |
| 538 | - 'sqlite.' . _LOG_ERREUR |
|
| 538 | + 'sqlite.'._LOG_ERREUR |
|
| 539 | 539 | ); |
| 540 | 540 | |
| 541 | 541 | return false; |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 544 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 545 | 545 | |
| 546 | 546 | return spip_sqlite_query($query, $serveur, $requeter); |
| 547 | 547 | } |
@@ -567,8 +567,8 @@ discard block |
||
| 567 | 567 | function spip_sqlite_create_index($nom, $table, $champs, $unique = '', $serveur = '', $requeter = true) { |
| 568 | 568 | if (!($nom or $table or $champs)) { |
| 569 | 569 | spip_log( |
| 570 | - "Champ manquant pour creer un index sqlite ($nom, $table, (" . join(',', $champs) . '))', |
|
| 571 | - 'sqlite.' . _LOG_ERREUR |
|
| 570 | + "Champ manquant pour creer un index sqlite ($nom, $table, (".join(',', $champs).'))', |
|
| 571 | + 'sqlite.'._LOG_ERREUR |
|
| 572 | 572 | ); |
| 573 | 573 | |
| 574 | 574 | return false; |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | // SQLite ne differentie pas noms des index en fonction des tables |
| 578 | 578 | // il faut donc creer des noms uniques d'index pour une base sqlite |
| 579 | - $nom = $table . '_' . $nom; |
|
| 579 | + $nom = $table.'_'.$nom; |
|
| 580 | 580 | // enlever d'eventuelles parentheses deja presentes sur champs |
| 581 | 581 | if (!is_array($champs)) { |
| 582 | 582 | if ($champs[0] == '(') { |
@@ -598,12 +598,12 @@ discard block |
||
| 598 | 598 | } else { |
| 599 | 599 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 600 | 600 | $a = spip_sqlite_showtable($table, $serveur); |
| 601 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 601 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 602 | 602 | return true; |
| 603 | 603 | } |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - $query = 'CREATE ' . ($unique ? 'UNIQUE ' : '') . "INDEX$ifnotexists $nom ON $table (" . join(',', $champs) . ')'; |
|
| 606 | + $query = 'CREATE '.($unique ? 'UNIQUE ' : '')."INDEX$ifnotexists $nom ON $table (".join(',', $champs).')'; |
|
| 607 | 607 | $res = spip_sqlite_query($query, $serveur, $requeter); |
| 608 | 608 | if (!$requeter) { |
| 609 | 609 | return $res; |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | $serveur = '', |
| 680 | 680 | $requeter = true |
| 681 | 681 | ) { |
| 682 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 682 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 683 | 683 | $r = spip_sqlite_select( |
| 684 | 684 | "COUNT($c)", |
| 685 | 685 | $from, |
@@ -788,14 +788,14 @@ discard block |
||
| 788 | 788 | */ |
| 789 | 789 | function spip_sqlite_drop_index($nom, $table, $serveur = '', $requeter = true) { |
| 790 | 790 | if (!($nom or $table)) { |
| 791 | - spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.' . _LOG_ERREUR); |
|
| 791 | + spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.'._LOG_ERREUR); |
|
| 792 | 792 | |
| 793 | 793 | return false; |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | // SQLite ne differentie pas noms des index en fonction des tables |
| 797 | 797 | // il faut donc creer des noms uniques d'index pour une base sqlite |
| 798 | - $index = $table . '_' . $nom; |
|
| 798 | + $index = $table.'_'.$nom; |
|
| 799 | 799 | $exist = ' IF EXISTS'; |
| 800 | 800 | |
| 801 | 801 | $query = "DROP INDEX$exist $index"; |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | if ($s) { |
| 828 | 828 | $trace = debug_backtrace(); |
| 829 | 829 | if ($trace[0]['function'] != 'spip_sqlite_error') { |
| 830 | - spip_log("$s - $query - " . sql_error_backtrace(), 'sqlite.' . _LOG_ERREUR); |
|
| 830 | + spip_log("$s - $query - ".sql_error_backtrace(), 'sqlite.'._LOG_ERREUR); |
|
| 831 | 831 | } |
| 832 | 832 | } |
| 833 | 833 | |
@@ -874,14 +874,14 @@ discard block |
||
| 874 | 874 | $t = $link->errorInfo(); |
| 875 | 875 | $s = ltrim($t[0], '0'); // 00000 si pas d'erreur |
| 876 | 876 | if ($s) { |
| 877 | - $s .= ' / ' . $t[1]; |
|
| 877 | + $s .= ' / '.$t[1]; |
|
| 878 | 878 | } // ajoute l'erreur du moteur SQLite |
| 879 | 879 | } else { |
| 880 | 880 | $s = ': aucune ressource sqlite (link)'; |
| 881 | 881 | } |
| 882 | 882 | |
| 883 | 883 | if ($s) { |
| 884 | - spip_log("Erreur sqlite $s", 'sqlite.' . _LOG_ERREUR); |
|
| 884 | + spip_log("Erreur sqlite $s", 'sqlite.'._LOG_ERREUR); |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | return $s ? $s : 0; |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | $query = spip_sqlite::traduire_requete($query, $serveur); |
| 908 | - $query = 'EXPLAIN ' . $query; |
|
| 908 | + $query = 'EXPLAIN '.$query; |
|
| 909 | 909 | if (!$requeter) { |
| 910 | 910 | return $query; |
| 911 | 911 | } |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | **/ |
| 1075 | 1075 | function spip_sqlite_insert($table, $champs, $valeurs, $desc = [], $serveur = '', $requeter = true) { |
| 1076 | 1076 | |
| 1077 | - $query = "INSERT INTO $table " . ($champs ? "$champs VALUES $valeurs" : 'DEFAULT VALUES'); |
|
| 1077 | + $query = "INSERT INTO $table ".($champs ? "$champs VALUES $valeurs" : 'DEFAULT VALUES'); |
|
| 1078 | 1078 | if ($r = spip_sqlite_query($query, $serveur, $requeter)) { |
| 1079 | 1079 | if (!$requeter) { |
| 1080 | 1080 | return $r; |
@@ -1129,8 +1129,8 @@ discard block |
||
| 1129 | 1129 | |
| 1130 | 1130 | $cles = $valeurs = ''; |
| 1131 | 1131 | if (count($couples)) { |
| 1132 | - $cles = '(' . join(',', array_keys($couples)) . ')'; |
|
| 1133 | - $valeurs = '(' . join(',', $couples) . ')'; |
|
| 1132 | + $cles = '('.join(',', array_keys($couples)).')'; |
|
| 1133 | + $valeurs = '('.join(',', $couples).')'; |
|
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | 1136 | return spip_sqlite_insert($table, $cles, $valeurs, $desc, $serveur, $requeter); |
@@ -1190,11 +1190,11 @@ discard block |
||
| 1190 | 1190 | |
| 1191 | 1191 | $champs = $valeurs = ''; |
| 1192 | 1192 | if (count($couples)) { |
| 1193 | - $champs = '(' . join(',', array_keys($couples)) . ')'; |
|
| 1194 | - $valeurs = '(' . join(',', $couples) . ')'; |
|
| 1195 | - $query = $query_start . "$champs VALUES $valeurs"; |
|
| 1193 | + $champs = '('.join(',', array_keys($couples)).')'; |
|
| 1194 | + $valeurs = '('.join(',', $couples).')'; |
|
| 1195 | + $query = $query_start."$champs VALUES $valeurs"; |
|
| 1196 | 1196 | } else { |
| 1197 | - $query = $query_start . 'DEFAULT VALUES'; |
|
| 1197 | + $query = $query_start.'DEFAULT VALUES'; |
|
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | 1200 | if ($requeter) { |
@@ -1326,7 +1326,7 @@ discard block |
||
| 1326 | 1326 | * @return string Texte de sélection pour la requête |
| 1327 | 1327 | */ |
| 1328 | 1328 | function spip_sqlite_multi($objet, $lang) { |
| 1329 | - $r = 'EXTRAIRE_MULTI(' . $objet . ", '" . $lang . "') AS multi"; |
|
| 1329 | + $r = 'EXTRAIRE_MULTI('.$objet.", '".$lang."') AS multi"; |
|
| 1330 | 1330 | |
| 1331 | 1331 | return $r; |
| 1332 | 1332 | } |
@@ -1397,7 +1397,7 @@ discard block |
||
| 1397 | 1397 | function spip_sqlite_date_proche($champ, $interval, $unite) { |
| 1398 | 1398 | $op = (($interval <= 0) ? '>' : '<'); |
| 1399 | 1399 | |
| 1400 | - return "($champ $op datetime('" . date('Y-m-d H:i:s') . "', '$interval $unite'))"; |
|
| 1400 | + return "($champ $op datetime('".date('Y-m-d H:i:s')."', '$interval $unite'))"; |
|
| 1401 | 1401 | } |
| 1402 | 1402 | |
| 1403 | 1403 | |
@@ -1429,7 +1429,7 @@ discard block |
||
| 1429 | 1429 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1430 | 1430 | ) { |
| 1431 | 1431 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur); |
| 1432 | - spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE); |
|
| 1432 | + spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE); |
|
| 1433 | 1433 | } |
| 1434 | 1434 | if ( |
| 1435 | 1435 | preg_match(',^(INTEGER),i', $d) |
@@ -1439,7 +1439,7 @@ discard block |
||
| 1439 | 1439 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1440 | 1440 | ) { |
| 1441 | 1441 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur); |
| 1442 | - spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE); |
|
| 1442 | + spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE); |
|
| 1443 | 1443 | } |
| 1444 | 1444 | if ( |
| 1445 | 1445 | preg_match(',^(datetime),i', $d) |
@@ -1449,7 +1449,7 @@ discard block |
||
| 1449 | 1449 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1450 | 1450 | ) { |
| 1451 | 1451 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0000-00-00 00:00:00'", $serveur); |
| 1452 | - spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE); |
|
| 1452 | + spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE); |
|
| 1453 | 1453 | } |
| 1454 | 1454 | } |
| 1455 | 1455 | |
@@ -1500,10 +1500,10 @@ discard block |
||
| 1500 | 1500 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
| 1501 | 1501 | $couples = _sqlite_ajouter_champs_timestamp($table, $couples, $desc, $serveur); |
| 1502 | 1502 | |
| 1503 | - return spip_sqlite_query("REPLACE INTO $table (" . join(',', array_keys($couples)) . ') VALUES (' . join( |
|
| 1503 | + return spip_sqlite_query("REPLACE INTO $table (".join(',', array_keys($couples)).') VALUES ('.join( |
|
| 1504 | 1504 | ',', |
| 1505 | 1505 | $couples |
| 1506 | - ) . ')', $serveur); |
|
| 1506 | + ).')', $serveur); |
|
| 1507 | 1507 | } |
| 1508 | 1508 | |
| 1509 | 1509 | |
@@ -1589,7 +1589,7 @@ discard block |
||
| 1589 | 1589 | . _sqlite_calculer_expression('WHERE', $where) |
| 1590 | 1590 | . _sqlite_calculer_expression('GROUP BY', $groupby, ',') |
| 1591 | 1591 | . _sqlite_calculer_expression('HAVING', $having) |
| 1592 | - . ($orderby ? ("\nORDER BY " . _sqlite_calculer_order($orderby)) : '') |
|
| 1592 | + . ($orderby ? ("\nORDER BY "._sqlite_calculer_order($orderby)) : '') |
|
| 1593 | 1593 | . ($limit ? "\nLIMIT $limit" : ''); |
| 1594 | 1594 | |
| 1595 | 1595 | // dans un select, on doit renvoyer la requête en cas d'erreur |
@@ -1627,10 +1627,10 @@ discard block |
||
| 1627 | 1627 | // interdire la creation d'une nouvelle base, |
| 1628 | 1628 | // sauf si on est dans l'installation |
| 1629 | 1629 | if ( |
| 1630 | - !is_file($f = _DIR_DB . $db . '.sqlite') |
|
| 1630 | + !is_file($f = _DIR_DB.$db.'.sqlite') |
|
| 1631 | 1631 | && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL) |
| 1632 | 1632 | ) { |
| 1633 | - spip_log("Il est interdit de creer la base $db", 'sqlite.' . _LOG_HS); |
|
| 1633 | + spip_log("Il est interdit de creer la base $db", 'sqlite.'._LOG_HS); |
|
| 1634 | 1634 | |
| 1635 | 1635 | return false; |
| 1636 | 1636 | } |
@@ -1639,12 +1639,12 @@ discard block |
||
| 1639 | 1639 | // avec les identifiants connus |
| 1640 | 1640 | $index = $serveur ? $serveur : 0; |
| 1641 | 1641 | |
| 1642 | - if ($link = spip_connect_db('', '', '', '', '@selectdb@' . $db, $serveur, '', '')) { |
|
| 1642 | + if ($link = spip_connect_db('', '', '', '', '@selectdb@'.$db, $serveur, '', '')) { |
|
| 1643 | 1643 | if (($db == $link['db']) && $GLOBALS['connexions'][$index] = $link) { |
| 1644 | 1644 | return $db; |
| 1645 | 1645 | } |
| 1646 | 1646 | } else { |
| 1647 | - spip_log("Impossible de selectionner la base $db", 'sqlite.' . _LOG_HS); |
|
| 1647 | + spip_log("Impossible de selectionner la base $db", 'sqlite.'._LOG_HS); |
|
| 1648 | 1648 | |
| 1649 | 1649 | return false; |
| 1650 | 1650 | } |
@@ -1695,7 +1695,7 @@ discard block |
||
| 1695 | 1695 | $match = "^$match$"; |
| 1696 | 1696 | |
| 1697 | 1697 | return spip_sqlite_query( |
| 1698 | - "SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP " . _q($match), |
|
| 1698 | + "SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP "._q($match), |
|
| 1699 | 1699 | $serveur, |
| 1700 | 1700 | $requeter |
| 1701 | 1701 | ); |
@@ -1719,7 +1719,7 @@ discard block |
||
| 1719 | 1719 | $r = spip_sqlite_query( |
| 1720 | 1720 | 'SELECT name FROM sqlite_master WHERE' |
| 1721 | 1721 | . ' type=\'table\'' |
| 1722 | - . ' AND name=' . spip_sqlite_quote($table, 'string') |
|
| 1722 | + . ' AND name='.spip_sqlite_quote($table, 'string') |
|
| 1723 | 1723 | . ' AND name NOT LIKE \'sqlite_%\'', |
| 1724 | 1724 | $serveur, |
| 1725 | 1725 | $requeter |
@@ -1816,7 +1816,7 @@ discard block |
||
| 1816 | 1816 | // s'il y a une parenthèse fermante dans la clé |
| 1817 | 1817 | // ou dans la définition sans qu'il n'y ait une ouverture avant |
| 1818 | 1818 | if (false !== strpos($k, ')') or preg_match('/^[^\(]*\)/', $def)) { |
| 1819 | - $fields[$k_precedent] .= ',' . $k . ' ' . $def; |
|
| 1819 | + $fields[$k_precedent] .= ','.$k.' '.$def; |
|
| 1820 | 1820 | continue; |
| 1821 | 1821 | } |
| 1822 | 1822 | |
@@ -1851,13 +1851,13 @@ discard block |
||
| 1851 | 1851 | . 'ORDER BY substr(type,2,1), name'; |
| 1852 | 1852 | $a = spip_sqlite_query($query, $serveur, $requeter); |
| 1853 | 1853 | while ($r = spip_sqlite_fetch($a, null, $serveur)) { |
| 1854 | - $key = str_replace($nom_table . '_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1854 | + $key = str_replace($nom_table.'_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1855 | 1855 | $keytype = 'KEY'; |
| 1856 | 1856 | if (strpos($r['sql'], 'UNIQUE INDEX') !== false) { |
| 1857 | 1857 | $keytype = 'UNIQUE KEY'; |
| 1858 | 1858 | } |
| 1859 | 1859 | $colonnes = preg_replace(',.*\((.*)\).*,', '$1', $r['sql']); |
| 1860 | - $keys[$keytype . ' ' . $key] = $colonnes; |
|
| 1860 | + $keys[$keytype.' '.$key] = $colonnes; |
|
| 1861 | 1861 | } |
| 1862 | 1862 | } |
| 1863 | 1863 | } // c'est une vue, on liste les champs disponibles simplement |
@@ -1904,7 +1904,7 @@ discard block |
||
| 1904 | 1904 | |
| 1905 | 1905 | $set = []; |
| 1906 | 1906 | foreach ($champs as $champ => $val) { |
| 1907 | - $set[] = $champ . "=$val"; |
|
| 1907 | + $set[] = $champ."=$val"; |
|
| 1908 | 1908 | } |
| 1909 | 1909 | if (!empty($set)) { |
| 1910 | 1910 | return spip_sqlite_query( |
@@ -1957,7 +1957,7 @@ discard block |
||
| 1957 | 1957 | |
| 1958 | 1958 | $set = []; |
| 1959 | 1959 | foreach ($champs as $champ => $val) { |
| 1960 | - $set[$champ] = $champ . '=' . _sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 1960 | + $set[$champ] = $champ.'='._sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 1961 | 1961 | } |
| 1962 | 1962 | |
| 1963 | 1963 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
@@ -1965,7 +1965,7 @@ discard block |
||
| 1965 | 1965 | $maj = _sqlite_ajouter_champs_timestamp($table, [], $desc, $serveur); |
| 1966 | 1966 | foreach ($maj as $champ => $val) { |
| 1967 | 1967 | if (!isset($set[$champ])) { |
| 1968 | - $set[$champ] = $champ . '=' . $val; |
|
| 1968 | + $set[$champ] = $champ.'='.$val; |
|
| 1969 | 1969 | } |
| 1970 | 1970 | } |
| 1971 | 1971 | |
@@ -1994,7 +1994,7 @@ discard block |
||
| 1994 | 1994 | */ |
| 1995 | 1995 | function _sqlite_init() { |
| 1996 | 1996 | if (!defined('_DIR_DB')) { |
| 1997 | - define('_DIR_DB', _DIR_ETC . 'bases/'); |
|
| 1997 | + define('_DIR_DB', _DIR_ETC.'bases/'); |
|
| 1998 | 1998 | } |
| 1999 | 1999 | if (!defined('_SQLITE_CHMOD')) { |
| 2000 | 2000 | define('_SQLITE_CHMOD', _SPIP_CHMOD); |
@@ -2104,9 +2104,9 @@ discard block |
||
| 2104 | 2104 | } |
| 2105 | 2105 | |
| 2106 | 2106 | // echapper les ' en '' |
| 2107 | - spip_log('Pas de methode ->quote pour echapper', 'sqlite.' . _LOG_INFO_IMPORTANTE); |
|
| 2107 | + spip_log('Pas de methode ->quote pour echapper', 'sqlite.'._LOG_INFO_IMPORTANTE); |
|
| 2108 | 2108 | |
| 2109 | - return ("'" . str_replace("'", "''", $v) . "'"); |
|
| 2109 | + return ("'".str_replace("'", "''", $v)."'"); |
|
| 2110 | 2110 | } |
| 2111 | 2111 | |
| 2112 | 2112 | |
@@ -2129,12 +2129,12 @@ discard block |
||
| 2129 | 2129 | $exp = "\n$expression "; |
| 2130 | 2130 | |
| 2131 | 2131 | if (!is_array($v)) { |
| 2132 | - return $exp . $v; |
|
| 2132 | + return $exp.$v; |
|
| 2133 | 2133 | } else { |
| 2134 | 2134 | if (strtoupper($join) === 'AND') { |
| 2135 | - return $exp . join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2135 | + return $exp.join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2136 | 2136 | } else { |
| 2137 | - return $exp . join($join, $v); |
|
| 2137 | + return $exp.join($join, $v); |
|
| 2138 | 2138 | } |
| 2139 | 2139 | } |
| 2140 | 2140 | } |
@@ -2168,17 +2168,17 @@ discard block |
||
| 2168 | 2168 | if (substr($k, -1) == '@') { |
| 2169 | 2169 | // c'est une jointure qui se refere au from precedent |
| 2170 | 2170 | // pas de virgule |
| 2171 | - $res .= ' ' . $v; |
|
| 2171 | + $res .= ' '.$v; |
|
| 2172 | 2172 | } else { |
| 2173 | 2173 | if (!is_numeric($k)) { |
| 2174 | 2174 | $p = strpos($v, ' '); |
| 2175 | 2175 | if ($p) { |
| 2176 | - $v = substr($v, 0, $p) . " AS '$k'" . substr($v, $p); |
|
| 2176 | + $v = substr($v, 0, $p)." AS '$k'".substr($v, $p); |
|
| 2177 | 2177 | } else { |
| 2178 | 2178 | $v .= " AS '$k'"; |
| 2179 | 2179 | } |
| 2180 | 2180 | } |
| 2181 | - $res .= ', ' . $v; |
|
| 2181 | + $res .= ', '.$v; |
|
| 2182 | 2182 | } |
| 2183 | 2183 | } |
| 2184 | 2184 | |
@@ -2316,13 +2316,13 @@ discard block |
||
| 2316 | 2316 | |
| 2317 | 2317 | $def_origine = sql_showtable($table_origine, false, $serveur); |
| 2318 | 2318 | if (!$def_origine or !isset($def_origine['field'])) { |
| 2319 | - spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite' . _LOG_ERREUR); |
|
| 2319 | + spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite'._LOG_ERREUR); |
|
| 2320 | 2320 | |
| 2321 | 2321 | return false; |
| 2322 | 2322 | } |
| 2323 | 2323 | |
| 2324 | 2324 | |
| 2325 | - $table_tmp = $table_origine . '_tmp'; |
|
| 2325 | + $table_tmp = $table_origine.'_tmp'; |
|
| 2326 | 2326 | |
| 2327 | 2327 | // 1) creer une table temporaire avec les modifications |
| 2328 | 2328 | // - DROP : suppression de la colonne |
@@ -2409,7 +2409,7 @@ discard block |
||
| 2409 | 2409 | } else { |
| 2410 | 2410 | // enlever KEY |
| 2411 | 2411 | $k = substr($k, 4); |
| 2412 | - $queries[] = "CREATE INDEX $table_destination" . "_$k ON $table_destination ($v)"; |
|
| 2412 | + $queries[] = "CREATE INDEX $table_destination"."_$k ON $table_destination ($v)"; |
|
| 2413 | 2413 | } |
| 2414 | 2414 | } |
| 2415 | 2415 | |
@@ -2420,7 +2420,7 @@ discard block |
||
| 2420 | 2420 | foreach ($queries as $q) { |
| 2421 | 2421 | if (!spip_sqlite::executer_requete($q, $serveur)) { |
| 2422 | 2422 | spip_log('SQLite : ALTER TABLE table :' |
| 2423 | - . " Erreur a l'execution de la requete : $q", 'sqlite.' . _LOG_ERREUR); |
|
| 2423 | + . " Erreur a l'execution de la requete : $q", 'sqlite.'._LOG_ERREUR); |
|
| 2424 | 2424 | spip_sqlite::annuler_transaction($serveur); |
| 2425 | 2425 | |
| 2426 | 2426 | return false; |
@@ -2510,27 +2510,27 @@ discard block |
||
| 2510 | 2510 | $enum = '(\s*\([^\)]*\))?'; |
| 2511 | 2511 | |
| 2512 | 2512 | $remplace = [ |
| 2513 | - '/enum' . $enum . '/is' => 'VARCHAR(255)', |
|
| 2513 | + '/enum'.$enum.'/is' => 'VARCHAR(255)', |
|
| 2514 | 2514 | '/COLLATE \w+_bin/is' => 'COLLATE BINARY', |
| 2515 | 2515 | '/COLLATE \w+_ci/is' => 'COLLATE NOCASE', |
| 2516 | 2516 | '/auto_increment/is' => '', |
| 2517 | 2517 | '/current_timestamp\(\)/is' => 'CURRENT_TIMESTAMP', // Fix export depuis mariaDB #4374 |
| 2518 | 2518 | '/(timestamp .* )ON .*$/is' => '\\1', |
| 2519 | 2519 | '/character set \w+/is' => '', |
| 2520 | - '/((big|small|medium|tiny)?int(eger)?)' . $num . '\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2520 | + '/((big|small|medium|tiny)?int(eger)?)'.$num.'\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2521 | 2521 | '/(text\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
| 2522 | - '/((char|varchar)' . $num . '\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2522 | + '/((char|varchar)'.$num.'\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2523 | 2523 | '/(datetime\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00 00:00:00'", |
| 2524 | 2524 | '/(date\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00'", |
| 2525 | 2525 | ]; |
| 2526 | 2526 | |
| 2527 | 2527 | // pour l'autoincrement, il faut des INTEGER NOT NULL PRIMARY KEY |
| 2528 | 2528 | $remplace_autocinc = [ |
| 2529 | - '/(big|small|medium|tiny)?int(eger)?' . $num . '/is' => 'INTEGER' |
|
| 2529 | + '/(big|small|medium|tiny)?int(eger)?'.$num.'/is' => 'INTEGER' |
|
| 2530 | 2530 | ]; |
| 2531 | 2531 | // pour les int non autoincrement, il faut un DEFAULT |
| 2532 | 2532 | $remplace_nonautocinc = [ |
| 2533 | - '/((big|small|medium|tiny)?int(eger)?' . $num . '\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2533 | + '/((big|small|medium|tiny)?int(eger)?'.$num.'\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2534 | 2534 | ]; |
| 2535 | 2535 | |
| 2536 | 2536 | if (is_string($query)) { |
@@ -2572,7 +2572,7 @@ discard block |
||
| 2572 | 2572 | return str_ireplace('BINARY', 'COLLATE BINARY', $champ); |
| 2573 | 2573 | } |
| 2574 | 2574 | if (preg_match(',^(char|varchar|(long|small|medium|tiny)?text),i', $champ)) { |
| 2575 | - return $champ . ' COLLATE NOCASE'; |
|
| 2575 | + return $champ.' COLLATE NOCASE'; |
|
| 2576 | 2576 | } |
| 2577 | 2577 | |
| 2578 | 2578 | return $champ; |
@@ -2662,14 +2662,14 @@ discard block |
||
| 2662 | 2662 | } else { |
| 2663 | 2663 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 2664 | 2664 | $a = spip_sqlite_showtable($nom, $serveur); |
| 2665 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 2665 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 2666 | 2666 | return true; |
| 2667 | 2667 | } |
| 2668 | 2668 | } |
| 2669 | 2669 | } |
| 2670 | 2670 | |
| 2671 | 2671 | $temporary = $temporary ? ' TEMPORARY' : ''; |
| 2672 | - $q = "CREATE$temporary TABLE$ifnotexists $nom ($query" . ($keys ? ",$keys" : '') . ")\n"; |
|
| 2672 | + $q = "CREATE$temporary TABLE$ifnotexists $nom ($query".($keys ? ",$keys" : '').")\n"; |
|
| 2673 | 2673 | |
| 2674 | 2674 | return $q; |
| 2675 | 2675 | } |
@@ -2890,7 +2890,7 @@ discard block |
||
| 2890 | 2890 | $this->serveur = strtolower($serveur); |
| 2891 | 2891 | |
| 2892 | 2892 | if (!($this->link = _sqlite_link($this->serveur)) && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)) { |
| 2893 | - spip_log('Aucune connexion sqlite (link)', 'sqlite.' . _LOG_ERREUR); |
|
| 2893 | + spip_log('Aucune connexion sqlite (link)', 'sqlite.'._LOG_ERREUR); |
|
| 2894 | 2894 | |
| 2895 | 2895 | return false; |
| 2896 | 2896 | } |
@@ -2936,7 +2936,7 @@ discard block |
||
| 2936 | 2936 | try { |
| 2937 | 2937 | $r = $this->link->query($query); |
| 2938 | 2938 | } catch (\PDOException $e) { |
| 2939 | - spip_log('PDOException: ' . $e->getMessage(), 'sqlite.' . _LOG_DEBUG); |
|
| 2939 | + spip_log('PDOException: '.$e->getMessage(), 'sqlite.'._LOG_DEBUG); |
|
| 2940 | 2940 | $r = false; |
| 2941 | 2941 | } |
| 2942 | 2942 | |
@@ -2951,11 +2951,11 @@ discard block |
||
| 2951 | 2951 | |
| 2952 | 2952 | // loger les warnings/erreurs eventuels de sqlite remontant dans PHP |
| 2953 | 2953 | if ($e and $e instanceof \PDOException) { |
| 2954 | - $err = strip_tags($e->getMessage()) . ' in ' . $e->getFile() . ' line ' . $e->getLine(); |
|
| 2955 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 2954 | + $err = strip_tags($e->getMessage()).' in '.$e->getFile().' line '.$e->getLine(); |
|
| 2955 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 2956 | 2956 | } elseif ($err = (function_exists('error_get_last') ? error_get_last() : '') and $err != $last_error) { |
| 2957 | - $err = strip_tags($err['message']) . ' in ' . $err['file'] . ' line ' . $err['line']; |
|
| 2958 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 2957 | + $err = strip_tags($err['message']).' in '.$err['file'].' line '.$err['line']; |
|
| 2958 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 2959 | 2959 | } else { |
| 2960 | 2960 | $err = ''; |
| 2961 | 2961 | } |
@@ -3033,15 +3033,15 @@ discard block |
||
| 3033 | 3033 | // Correction Create Database |
| 3034 | 3034 | // Create Database -> requete ignoree |
| 3035 | 3035 | if (strpos($this->query, 'CREATE DATABASE') === 0) { |
| 3036 | - spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.' . _LOG_AVERTISSEMENT); |
|
| 3036 | + spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.'._LOG_AVERTISSEMENT); |
|
| 3037 | 3037 | $this->query = 'SELECT 1'; |
| 3038 | 3038 | } |
| 3039 | 3039 | |
| 3040 | 3040 | // Correction Insert Ignore |
| 3041 | 3041 | // INSERT IGNORE -> insert (tout court et pas 'insert or replace') |
| 3042 | 3042 | if (strpos($this->query, 'INSERT IGNORE') === 0) { |
| 3043 | - spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.' . _LOG_DEBUG); |
|
| 3044 | - $this->query = 'INSERT ' . substr($this->query, '13'); |
|
| 3043 | + spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.'._LOG_DEBUG); |
|
| 3044 | + $this->query = 'INSERT '.substr($this->query, '13'); |
|
| 3045 | 3045 | } |
| 3046 | 3046 | |
| 3047 | 3047 | // Correction des dates avec INTERVAL |
@@ -3069,7 +3069,7 @@ discard block |
||
| 3069 | 3069 | if (($this->sqlite_version == 2) && (strpos($this->query, 'USING') !== false)) { |
| 3070 | 3070 | spip_log( |
| 3071 | 3071 | "'USING (champ)' n'est pas reconnu en SQLite 2. Utilisez 'ON table1.champ = table2.champ'", |
| 3072 | - 'sqlite.' . _LOG_ERREUR |
|
| 3072 | + 'sqlite.'._LOG_ERREUR |
|
| 3073 | 3073 | ); |
| 3074 | 3074 | $this->query = preg_replace('/USING\s*\([^\)]*\)/', '', $this->query); |
| 3075 | 3075 | } |
@@ -3092,8 +3092,8 @@ discard block |
||
| 3092 | 3092 | } else { |
| 3093 | 3093 | $suite = ''; |
| 3094 | 3094 | } |
| 3095 | - $pref = ($this->prefixe) ? $this->prefixe . '_' : ''; |
|
| 3096 | - $this->query = preg_replace('/([,\s])spip_/S', '\1' . $pref, $this->query) . $suite; |
|
| 3095 | + $pref = ($this->prefixe) ? $this->prefixe.'_' : ''; |
|
| 3096 | + $this->query = preg_replace('/([,\s])spip_/S', '\1'.$pref, $this->query).$suite; |
|
| 3097 | 3097 | |
| 3098 | 3098 | // Correction zero AS x |
| 3099 | 3099 | // pg n'aime pas 0+x AS alias, sqlite, dans le meme style, |