@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | function objet_modifier($objet, $id, $set = null) { |
| 78 | 78 | if (($t = objet_type($objet)) !== $objet) { |
| 79 | - spip_log("objet_modifier: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 79 | + spip_log("objet_modifier: appel avec type $objet invalide au lieu de $t", 'editer'._LOG_INFO_IMPORTANTE); |
|
| 80 | 80 | $objet = $t; |
| 81 | 81 | } |
| 82 | 82 | if ( |
| 83 | - include_spip('action/editer_' . $objet) |
|
| 84 | - and function_exists($modifier = $objet . '_modifier') |
|
| 83 | + include_spip('action/editer_'.$objet) |
|
| 84 | + and function_exists($modifier = $objet.'_modifier') |
|
| 85 | 85 | ) { |
| 86 | 86 | return $modifier($id, $set); |
| 87 | 87 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $trouver_table = charger_fonction('trouver_table', 'base'); |
| 91 | 91 | $desc = $trouver_table($table_sql); |
| 92 | 92 | if (!$desc or !isset($desc['field'])) { |
| 93 | - spip_log("Objet $objet inconnu dans objet_modifier", 'editer' . _LOG_ERREUR); |
|
| 93 | + spip_log("Objet $objet inconnu dans objet_modifier", 'editer'._LOG_ERREUR); |
|
| 94 | 94 | |
| 95 | 95 | return _L("Erreur objet $objet inconnu"); |
| 96 | 96 | } |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | function objet_inserer($objet, $id_parent = null, $set = null) { |
| 171 | 171 | $d = null; |
| 172 | 172 | if (($t = objet_type($objet)) !== $objet) { |
| 173 | - spip_log("objet_inserer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 173 | + spip_log("objet_inserer: appel avec type $objet invalide au lieu de $t", 'editer'._LOG_INFO_IMPORTANTE); |
|
| 174 | 174 | $objet = $t; |
| 175 | 175 | } |
| 176 | 176 | if ( |
| 177 | - include_spip('action/editer_' . $objet) |
|
| 178 | - and function_exists($inserer = $objet . '_inserer') |
|
| 177 | + include_spip('action/editer_'.$objet) |
|
| 178 | + and function_exists($inserer = $objet.'_inserer') |
|
| 179 | 179 | ) { |
| 180 | 180 | return $inserer($id_parent, $set); |
| 181 | 181 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $row = sql_fetsel('id_rubrique, id_secteur, lang', 'spip_rubriques', 'id_parent=0', '', '0+titre,titre', '1'); |
| 197 | 197 | $id_rubrique = $row['id_rubrique']; |
| 198 | 198 | } else { |
| 199 | - $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 199 | + $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique)); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | $champs['id_rubrique'] = $id_rubrique; |
@@ -314,12 +314,12 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | function objet_instituer($objet, $id, $c, $calcul_rub = true) { |
| 316 | 316 | if (($t = objet_type($objet)) !== $objet) { |
| 317 | - spip_log("objet_instituer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 317 | + spip_log("objet_instituer: appel avec type $objet invalide au lieu de $t", 'editer'._LOG_INFO_IMPORTANTE); |
|
| 318 | 318 | $objet = $t; |
| 319 | 319 | } |
| 320 | 320 | if ( |
| 321 | - include_spip('action/editer_' . $objet) |
|
| 322 | - and function_exists($instituer = $objet . '_instituer') |
|
| 321 | + include_spip('action/editer_'.$objet) |
|
| 322 | + and function_exists($instituer = $objet.'_instituer') |
|
| 323 | 323 | ) { |
| 324 | 324 | return $instituer($id, $c, $calcul_rub); |
| 325 | 325 | } |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $sel[] = ($champ_date ? "$champ_date as date" : "'' as date"); |
| 349 | 349 | $sel[] = (isset($desc['field']['id_rubrique']) ? 'id_rubrique' : '0 as id_rubrique'); |
| 350 | 350 | |
| 351 | - $row = sql_fetsel($sel, $table_sql, id_table_objet($objet) . '=' . intval($id)); |
|
| 351 | + $row = sql_fetsel($sel, $table_sql, id_table_objet($objet).'='.intval($id)); |
|
| 352 | 352 | |
| 353 | 353 | $id_rubrique = $row['id_rubrique']; |
| 354 | 354 | $statut_ancien = $statut = $row['statut']; |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | if ($s != 'publie' and autoriser('modifier', $objet, $id)) { |
| 372 | 372 | $statut = $champs['statut'] = $s; |
| 373 | 373 | } else { |
| 374 | - spip_log("editer_objet $objet #$id refus " . json_encode($c, JSON_THROW_ON_ERROR), 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 374 | + spip_log("editer_objet $objet #$id refus ".json_encode($c, JSON_THROW_ON_ERROR), 'editer'._LOG_INFO_IMPORTANTE); |
|
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | and isset($c['id_parent']) |
| 402 | 402 | and $id_parent = $c['id_parent'] |
| 403 | 403 | and $id_parent != $id_rubrique |
| 404 | - and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent))) |
|
| 404 | + and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique='.intval($id_parent))) |
|
| 405 | 405 | ) { |
| 406 | 406 | $champs['id_rubrique'] = $id_parent; |
| 407 | 407 | |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | // Si on deplace l'objet |
| 501 | 501 | // changer aussi son secteur et sa langue (si heritee) |
| 502 | 502 | if (isset($champs['id_rubrique'])) { |
| 503 | - $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique'])); |
|
| 503 | + $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique='.sql_quote($champs['id_rubrique'])); |
|
| 504 | 504 | $langue = $row_rub['lang']; |
| 505 | 505 | |
| 506 | 506 | if (isset($desc['field']['id_secteur'])) { |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | sql_fetsel( |
| 513 | 513 | '1', |
| 514 | 514 | $table_sql, |
| 515 | - id_table_objet($objet) . '=' . intval($id) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue) |
|
| 515 | + id_table_objet($objet).'='.intval($id)." AND langue_choisie<>'oui' AND lang<>".sql_quote($langue) |
|
| 516 | 516 | ) |
| 517 | 517 | ) { |
| 518 | 518 | $champs['lang'] = $langue; |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | if (!$champs) { |
| 524 | 524 | return; |
| 525 | 525 | } |
| 526 | - sql_updateq($table_sql, $champs, id_table_objet($objet) . '=' . intval($id)); |
|
| 526 | + sql_updateq($table_sql, $champs, id_table_objet($objet).'='.intval($id)); |
|
| 527 | 527 | |
| 528 | 528 | // Changer le statut des rubriques concernees |
| 529 | 529 | if ($cond) { |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | */ |
| 568 | 568 | function objet_lire($objet, $valeur_id, $options = []) { |
| 569 | 569 | if (($t = objet_type($objet)) !== $objet) { |
| 570 | - spip_log("objet_lire: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 570 | + spip_log("objet_lire: appel avec type $objet invalide au lieu de $t", 'editer'._LOG_INFO_IMPORTANTE); |
|
| 571 | 571 | $objet = $t; |
| 572 | 572 | } |
| 573 | 573 | |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | ) { |
| 590 | 590 | // Il est possible pour un type d'objet de fournir une fonction de lecture de tous les champs d'un objet. |
| 591 | 591 | if ( |
| 592 | - include_spip('action/editer_' . $objet) |
|
| 592 | + include_spip('action/editer_'.$objet) |
|
| 593 | 593 | and function_exists($lire = "{$objet}_lire_champs") |
| 594 | 594 | ) { |
| 595 | 595 | $valeurs = $lire($objet, $valeur_id, $champ_id); |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | |
| 600 | 600 | // La condition est appliquée sur le champ désigné par l'utilisateur. |
| 601 | 601 | $where = [ |
| 602 | - $champ_id . '=' . sql_quote($valeur_id) |
|
| 602 | + $champ_id.'='.sql_quote($valeur_id) |
|
| 603 | 603 | ]; |
| 604 | 604 | |
| 605 | 605 | // Acquisition de tous les champs de l'objet : si l'accès SQL retourne une erreur on renvoie un tableau vide. |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $_id = $e['id_table_objet']; |
| 51 | 51 | if (isset($contexte[$_id]) and $id = intval($contexte[$_id])) { |
| 52 | 52 | $table = $e['table_objet_sql']; |
| 53 | - $row = sql_fetsel('*', $table, "$_id=" . intval($id)); |
|
| 53 | + $row = sql_fetsel('*', $table, "$_id=".intval($id)); |
|
| 54 | 54 | if (isset($row['id_rubrique'])) { |
| 55 | 55 | $contexte['id_rubrique'] = $row['id_rubrique']; |
| 56 | 56 | if (isset($row['id_secteur'])) { |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | $boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position) |
| 115 | 115 | + [ |
| 116 | 116 | $id => new Bouton( |
| 117 | - ($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '', // icone |
|
| 118 | - $infos['titre'], // titre |
|
| 117 | + ($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '', // icone |
|
| 118 | + $infos['titre'], // titre |
|
| 119 | 119 | (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
| 120 | 120 | (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
| 121 | 121 | ) |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | $boutons_admin = array_slice($boutons_admin, 0, $position) |
| 133 | 133 | + [ |
| 134 | 134 | $id => new Bouton( |
| 135 | - ($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '', // icone |
|
| 136 | - $infos['titre'], // titre |
|
| 135 | + ($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '', // icone |
|
| 136 | + $infos['titre'], // titre |
|
| 137 | 137 | (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
| 138 | 138 | (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
| 139 | 139 | ) |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $url = str_replace('&', '&', $url); |
| 221 | 221 | while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) { |
| 222 | 222 | if ($matches[2] == 'id_secteur' and !isset($contexte['id_secteur']) and isset($contexte['id_rubrique'])) { |
| 223 | - $contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($contexte['id_rubrique'])); |
|
| 223 | + $contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.intval($contexte['id_rubrique'])); |
|
| 224 | 224 | } |
| 225 | 225 | $val = _request($matches[2], $contexte); |
| 226 | 226 | $url = parametre_url($url, $matches[1], $val ?: '', '&'); |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | function changer_langue($lang, $liste_langues = null) { |
| 41 | 41 | |
| 42 | 42 | if (is_null($liste_langues)) { |
| 43 | - $liste_langues = ($GLOBALS['meta']['langues_proposees'] ?? '') . ',' . ($GLOBALS['meta']['langues_multilingue'] ?? ''); |
|
| 43 | + $liste_langues = ($GLOBALS['meta']['langues_proposees'] ?? '').','.($GLOBALS['meta']['langues_multilingue'] ?? ''); |
|
| 44 | 44 | } else { |
| 45 | 45 | if (is_array($liste_langues)) { |
| 46 | 46 | $liste_langues = implode(',', $liste_langues); |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | - $liste_langues = ',' . $liste_langues . ','; |
|
| 49 | + $liste_langues = ','.$liste_langues.','; |
|
| 50 | 50 | |
| 51 | 51 | // Si la langue demandee n'existe pas, on essaie d'autres variantes |
| 52 | 52 | // Exemple : 'pt-br' => 'pt_br' => 'pt' |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | foreach ($langues as $l) { |
| 194 | 194 | $selected = ($l == $default) ? ' selected=\'selected\'' : ''; |
| 195 | - $ret .= "<option value='$l'$selected>[" . $l . '] ' . traduire_nom_langue($l) . "</option>\n"; |
|
| 195 | + $ret .= "<option value='$l'$selected>[".$l.'] '.traduire_nom_langue($l)."</option>\n"; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (!test_espace_prive()) { |
@@ -210,23 +210,21 @@ discard block |
||
| 210 | 210 | $base, |
| 211 | 211 | $cible, |
| 212 | 212 | (select_langues($nom_select, $change, $ret) |
| 213 | - . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='" . _T('bouton_changer') . "' /></div></noscript>"), |
|
| 213 | + . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='"._T('bouton_changer')."' /></div></noscript>"), |
|
| 214 | 214 | " method='post'" |
| 215 | 215 | ); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | function select_langues($nom_select, $change, $options, $label = '') { |
| 219 | 219 | static $cpt = 0; |
| 220 | - $id = 'menu_langues' . $cpt++; |
|
| 220 | + $id = 'menu_langues'.$cpt++; |
|
| 221 | 221 | |
| 222 | 222 | return |
| 223 | - "<label for='$id'>" . ($label ?: _T('info_langues')) . '</label> ' . |
|
| 223 | + "<label for='$id'>".($label ?: _T('info_langues')).'</label> '. |
|
| 224 | 224 | "<select name='$nom_select' id='$id' " |
| 225 | 225 | . ((!test_espace_prive()) ? |
| 226 | - ("class='forml menu_langues'") : |
|
| 227 | - (($nom_select == 'var_lang_ecrire') ? |
|
| 228 | - ("class='lang_ecrire'") : |
|
| 229 | - "class='fondl'")) |
|
| 226 | + ("class='forml menu_langues'") : (($nom_select == 'var_lang_ecrire') ? |
|
| 227 | + ("class='lang_ecrire'") : "class='fondl'")) |
|
| 230 | 228 | . $change |
| 231 | 229 | . ">\n" |
| 232 | 230 | . $options |
@@ -352,7 +350,7 @@ discard block |
||
| 352 | 350 | and (!isset($GLOBALS['spip_lang']) |
| 353 | 351 | or $GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site']) |
| 354 | 352 | ) { |
| 355 | - return changer_langue($GLOBALS['meta']['langue_site'], $liste_langues);//@:install |
|
| 353 | + return changer_langue($GLOBALS['meta']['langue_site'], $liste_langues); //@:install |
|
| 356 | 354 | } |
| 357 | 355 | // en theorie là, la globale est définie, sinon c'est un problème. |
| 358 | 356 | if (!isset($GLOBALS['spip_lang'])) { |
@@ -455,7 +453,7 @@ discard block |
||
| 455 | 453 | if (!isset($GLOBALS['meta']['langue_site'])) { |
| 456 | 454 | // Initialisation : le francais si dispo, sinon la premiere langue trouvee |
| 457 | 455 | $GLOBALS['meta']['langue_site'] = $tout = |
| 458 | - (!$all_langs or (strpos(',' . _LANGUE_PAR_DEFAUT . ',', (string) ",$all_langs,") !== false)) |
|
| 456 | + (!$all_langs or (strpos(','._LANGUE_PAR_DEFAUT.',', (string) ",$all_langs,") !== false)) |
|
| 459 | 457 | ? _LANGUE_PAR_DEFAUT : substr($all_langs, 0, strpos($all_langs, ',')); |
| 460 | 458 | ecrire_meta('langue_site', $tout); |
| 461 | 459 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | /** l'adresse du repertoire de telechargement et de decompactage des plugins */ |
| 24 | 24 | if (!defined('_DIR_PLUGINS_AUTO')) { |
| 25 | - define('_DIR_PLUGINS_AUTO', _DIR_PLUGINS . 'auto/'); |
|
| 25 | + define('_DIR_PLUGINS_AUTO', _DIR_PLUGINS.'auto/'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | #include_spip('inc/texte'); // ????? Appelle public/parametrer trop tot avant la reconstruction du chemin des plugins. |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | if ($dir) { |
| 382 | 382 | $dir .= '/'; |
| 383 | 383 | } |
| 384 | - $dir .= 'procure:' . $procure['nom']; |
|
| 384 | + $dir .= 'procure:'.$procure['nom']; |
|
| 385 | 385 | |
| 386 | 386 | $procure['etat'] = '?'; |
| 387 | 387 | $procure['dir_type'] = $resume['dir_type']; |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | $plug = $resume['dir']; |
| 566 | 566 | $k = $infos[$dir_type][$plug]; |
| 567 | 567 | |
| 568 | - $plug = constant($dir_type) . $plug; |
|
| 568 | + $plug = constant($dir_type).$plug; |
|
| 569 | 569 | if (!isset($msg[$p])) { |
| 570 | 570 | if (isset($resume['erreur']) and $resume['erreur']) { |
| 571 | 571 | $msg[$p] = [$resume['erreur']]; |
@@ -608,10 +608,10 @@ discard block |
||
| 608 | 608 | $list = $raw ? [] : $GLOBALS['meta']['plugin_erreur_activation']; |
| 609 | 609 | } elseif (!$raw) { |
| 610 | 610 | foreach ($list as $plug => $msg) { |
| 611 | - $list[$plug] = '<li>' . _T('plugin_impossible_activer', ['plugin' => $plug]) |
|
| 612 | - . '<ul><li>' . implode('</li><li>', $msg) . '</li></ul></li>'; |
|
| 611 | + $list[$plug] = '<li>'._T('plugin_impossible_activer', ['plugin' => $plug]) |
|
| 612 | + . '<ul><li>'.implode('</li><li>', $msg).'</li></ul></li>'; |
|
| 613 | 613 | } |
| 614 | - $list = '<ul>' . join("\n", $list) . '</ul>'; |
|
| 614 | + $list = '<ul>'.join("\n", $list).'</ul>'; |
|
| 615 | 615 | } |
| 616 | 616 | if ($raz) { |
| 617 | 617 | effacer_meta('plugin_erreur_activation'); |
@@ -725,13 +725,13 @@ discard block |
||
| 725 | 725 | if ($minimum_inclus and spip_version_compare($version, $minimum, '<')) { |
| 726 | 726 | return _T("plugin_{$balise}_{$type}", [ |
| 727 | 727 | 'plugin' => $nom, |
| 728 | - 'version' => ' ≥ ' . $minimum |
|
| 728 | + 'version' => ' ≥ '.$minimum |
|
| 729 | 729 | ]); |
| 730 | 730 | } |
| 731 | 731 | if (!$minimum_inclus and spip_version_compare($version, $minimum, '<=')) { |
| 732 | 732 | return _T("plugin_{$balise}_{$type}", [ |
| 733 | 733 | 'plugin' => $nom, |
| 734 | - 'version' => ' > ' . $minimum |
|
| 734 | + 'version' => ' > '.$minimum |
|
| 735 | 735 | ]); |
| 736 | 736 | } |
| 737 | 737 | } |
@@ -740,13 +740,13 @@ discard block |
||
| 740 | 740 | if ($maximum_inclus and spip_version_compare($version, $maximum, '>')) { |
| 741 | 741 | return _T("plugin_{$balise}_{$type}", [ |
| 742 | 742 | 'plugin' => $nom, |
| 743 | - 'version' => ' ≤ ' . $maximum |
|
| 743 | + 'version' => ' ≤ '.$maximum |
|
| 744 | 744 | ]); |
| 745 | 745 | } |
| 746 | 746 | if (!$maximum_inclus and spip_version_compare($version, $maximum, '>=')) { |
| 747 | 747 | return _T("plugin_{$balise}_plugin", [ |
| 748 | 748 | 'plugin' => $nom, |
| 749 | - 'version' => ' < ' . $maximum |
|
| 749 | + 'version' => ' < '.$maximum |
|
| 750 | 750 | ]); |
| 751 | 751 | } |
| 752 | 752 | } |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | include_spip('inc/charger_plugin'); |
| 766 | 766 | $url = '<br />' . bouton_telechargement_plugin($url, 'lib'); |
| 767 | 767 | }*/ |
| 768 | - return _T('plugin_necessite_lib', ['lib' => $lib]) . " <a href='$url'>$url</a>"; |
|
| 768 | + return _T('plugin_necessite_lib', ['lib' => $lib])." <a href='$url'>$url</a>"; |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | foreach ($plugin_valides as $p => $resume) { |
| 866 | 866 | // Les headers ne doivent pas indiquer les versions des extensions PHP, ni la version PHP |
| 867 | 867 | if (0 !== strpos($p, 'PHP:') and $p !== 'PHP') { |
| 868 | - $header[] = $p . ($resume['version'] ? '(' . $resume['version'] . ')' : ''); |
|
| 868 | + $header[] = $p.($resume['version'] ? '('.$resume['version'].')' : ''); |
|
| 869 | 869 | } |
| 870 | 870 | if ($resume['dir']) { |
| 871 | 871 | foreach ($infos[$resume['dir_type']][$resume['dir']]['lib'] as $l) { |
@@ -890,11 +890,11 @@ discard block |
||
| 890 | 890 | $header = strtolower(implode(',', $header)); |
| 891 | 891 | if (!isset($GLOBALS['spip_header_silencieux']) or !$GLOBALS['spip_header_silencieux']) { |
| 892 | 892 | ecrire_fichier( |
| 893 | - _DIR_VAR . 'config.txt', |
|
| 894 | - (defined('_HEADER_COMPOSED_BY') ? _HEADER_COMPOSED_BY : 'Composed-By: SPIP') . ' ' . $GLOBALS['spip_version_affichee'] . ' @ www.spip.net + ' . $header |
|
| 893 | + _DIR_VAR.'config.txt', |
|
| 894 | + (defined('_HEADER_COMPOSED_BY') ? _HEADER_COMPOSED_BY : 'Composed-By: SPIP').' '.$GLOBALS['spip_version_affichee'].' @ www.spip.net + '.$header |
|
| 895 | 895 | ); |
| 896 | 896 | } else { |
| 897 | - @unlink(_DIR_VAR . 'config.txt'); |
|
| 897 | + @unlink(_DIR_VAR.'config.txt'); |
|
| 898 | 898 | } |
| 899 | 899 | // generer charger_plugins_chemin.php |
| 900 | 900 | plugins_precompile_chemin($plugin_valides, $ordre); |
@@ -948,7 +948,7 @@ discard block |
||
| 948 | 948 | // definir le plugin, donc le path avant l'include du fichier options |
| 949 | 949 | // permet de faire des include_spip pour attraper un inc_ du plugin |
| 950 | 950 | |
| 951 | - $dir = $dir_type . ".'" . $plug . "/'"; |
|
| 951 | + $dir = $dir_type.".'".$plug."/'"; |
|
| 952 | 952 | |
| 953 | 953 | $prefix = strtoupper(preg_replace(',\W,', '_', $info['prefix'])); |
| 954 | 954 | if ( |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | if (!$info['chemin']) { |
| 960 | 960 | $chemins['public'][] = "_DIR_PLUGIN_$prefix"; |
| 961 | 961 | $chemins['prive'][] = "_DIR_PLUGIN_$prefix"; |
| 962 | - if (is_dir(constant($dir_type) . $plug . '/squelettes/')) { |
|
| 962 | + if (is_dir(constant($dir_type).$plug.'/squelettes/')) { |
|
| 963 | 963 | $chemins['public'][] = "_DIR_PLUGIN_{$prefix}.'squelettes/'"; |
| 964 | 964 | } |
| 965 | 965 | } |
@@ -980,13 +980,13 @@ discard block |
||
| 980 | 980 | $dir = ''; |
| 981 | 981 | } |
| 982 | 982 | if (strlen($dir)) { |
| 983 | - $dir = rtrim($dir, '/') . '/'; |
|
| 983 | + $dir = rtrim($dir, '/').'/'; |
|
| 984 | 984 | } |
| 985 | 985 | if (!isset($chemin['type']) or $chemin['type'] == 'public') { |
| 986 | - $chemins['public'][] = "_DIR_PLUGIN_$prefix" . (strlen($dir) ? ".'$dir'" : ''); |
|
| 986 | + $chemins['public'][] = "_DIR_PLUGIN_$prefix".(strlen($dir) ? ".'$dir'" : ''); |
|
| 987 | 987 | } |
| 988 | 988 | if (!isset($chemin['type']) or $chemin['type'] == 'prive') { |
| 989 | - $chemins['prive'][] = "_DIR_PLUGIN_$prefix" . (strlen($dir) ? ".'$dir'" : ''); |
|
| 989 | + $chemins['prive'][] = "_DIR_PLUGIN_$prefix".(strlen($dir) ? ".'$dir'" : ''); |
|
| 990 | 990 | } |
| 991 | 991 | } |
| 992 | 992 | } |
@@ -995,11 +995,11 @@ discard block |
||
| 995 | 995 | } |
| 996 | 996 | } |
| 997 | 997 | if (count($chemins['public']) or count($chemins['prive'])) { |
| 998 | - $contenu .= 'if (_DIR_RESTREINT) _chemin([' . implode( |
|
| 998 | + $contenu .= 'if (_DIR_RESTREINT) _chemin(['.implode( |
|
| 999 | 999 | ',', |
| 1000 | 1000 | array_reverse($chemins['public']) |
| 1001 | - ) . "]);\n" |
|
| 1002 | - . 'else _chemin([' . implode(',', array_reverse($chemins['prive'])) . "]);\n"; |
|
| 1001 | + )."]);\n" |
|
| 1002 | + . 'else _chemin(['.implode(',', array_reverse($chemins['prive']))."]);\n"; |
|
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | 1005 | ecrire_fichier_php(_CACHE_PLUGINS_PATH, $contenu); |
@@ -1048,7 +1048,7 @@ discard block |
||
| 1048 | 1048 | and strpos($dir, ':') === false // exclure le cas des procure: |
| 1049 | 1049 | and file_exists("$dir$plug/paquet.xml") // uniquement pour les paquet.xml |
| 1050 | 1050 | ) { |
| 1051 | - if (is_readable("$dir$plug/" . ($file = $info['prefix'] . '_' . $charge . '.php'))) { |
|
| 1051 | + if (is_readable("$dir$plug/".($file = $info['prefix'].'_'.$charge.'.php'))) { |
|
| 1052 | 1052 | $info[$charge] = [$file]; |
| 1053 | 1053 | } |
| 1054 | 1054 | } |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | ) { |
| 1066 | 1066 | unset($info[$charge][$k]); |
| 1067 | 1067 | } else { |
| 1068 | - $_file = $root_dir_type . ".'$plug/$file'"; |
|
| 1068 | + $_file = $root_dir_type.".'$plug/$file'"; |
|
| 1069 | 1069 | $contenu[$charge] .= "include_once_check($_file);\n"; |
| 1070 | 1070 | } |
| 1071 | 1071 | } |
@@ -1075,7 +1075,7 @@ discard block |
||
| 1075 | 1075 | } |
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | - $contenu['options'] = "define('_PLUGINS_HASH','" . md5($sign) . "');\n" . $contenu['options']; |
|
| 1078 | + $contenu['options'] = "define('_PLUGINS_HASH','".md5($sign)."');\n".$contenu['options']; |
|
| 1079 | 1079 | $contenu['fonctions'] .= plugin_ongletbouton('boutons_plugins', $boutons) |
| 1080 | 1080 | . plugin_ongletbouton('onglets_plugins', $onglets); |
| 1081 | 1081 | |
@@ -1110,12 +1110,12 @@ discard block |
||
| 1110 | 1110 | define("_UPDATED_$nom", $val); |
| 1111 | 1111 | define("_UPDATED_md5_$nom", $md5); |
| 1112 | 1112 | } |
| 1113 | - $val = "unserialize('" . str_replace("'", "\'", $val) . "')"; |
|
| 1113 | + $val = "unserialize('".str_replace("'", "\'", $val)."')"; |
|
| 1114 | 1114 | |
| 1115 | 1115 | return |
| 1116 | 1116 | "if (!function_exists('$nom')) {\n" |
| 1117 | 1117 | . "function $nom(){return defined('_UPDATED_$nom')?unserialize(_UPDATED_$nom):$val;}\n" |
| 1118 | - . "function md5_$nom(){return defined('_UPDATED_md5_$nom')?_UPDATED_md5_$nom:'" . $md5 . "';}\n" |
|
| 1118 | + . "function md5_$nom(){return defined('_UPDATED_md5_$nom')?_UPDATED_md5_$nom:'".$md5."';}\n" |
|
| 1119 | 1119 | . "}\n"; |
| 1120 | 1120 | } |
| 1121 | 1121 | |
@@ -1138,7 +1138,7 @@ discard block |
||
| 1138 | 1138 | if (@is_readable(_CACHE_PLUGINS_OPT)) { |
| 1139 | 1139 | include_once(_CACHE_PLUGINS_OPT); |
| 1140 | 1140 | } else { |
| 1141 | - spip_log('pipelines desactives: impossible de produire ' . _CACHE_PLUGINS_OPT); |
|
| 1141 | + spip_log('pipelines desactives: impossible de produire '._CACHE_PLUGINS_OPT); |
|
| 1142 | 1142 | } |
| 1143 | 1143 | } |
| 1144 | 1144 | |
@@ -1175,7 +1175,7 @@ discard block |
||
| 1175 | 1175 | $dir_type = $plugin_valides[$p]['dir_type']; |
| 1176 | 1176 | $root_dir_type = str_replace('_DIR_', '_ROOT_', $dir_type); |
| 1177 | 1177 | $plug = $plugin_valides[$p]['dir']; |
| 1178 | - $prefix = (($info['prefix'] == 'spip') ? '' : $info['prefix'] . '_'); |
|
| 1178 | + $prefix = (($info['prefix'] == 'spip') ? '' : $info['prefix'].'_'); |
|
| 1179 | 1179 | if (isset($info['pipeline']) and is_array($info['pipeline'])) { |
| 1180 | 1180 | foreach ($info['pipeline'] as $pipe) { |
| 1181 | 1181 | $nom = $pipe['nom']; |
@@ -1209,7 +1209,7 @@ discard block |
||
| 1209 | 1209 | } |
| 1210 | 1210 | if (isset($pipe['inclure'])) { |
| 1211 | 1211 | $GLOBALS['spip_matrice']["$prefix$action"] = |
| 1212 | - "$root_dir_type:$plug/" . $pipe['inclure']; |
|
| 1212 | + "$root_dir_type:$plug/".$pipe['inclure']; |
|
| 1213 | 1213 | } |
| 1214 | 1214 | } |
| 1215 | 1215 | } |
@@ -1219,7 +1219,7 @@ discard block |
||
| 1219 | 1219 | $prepend_code['taches_generales_cron'] = ''; |
| 1220 | 1220 | } |
| 1221 | 1221 | foreach ($info['genie'] as $genie) { |
| 1222 | - $nom = $prefix . $genie['nom']; |
|
| 1222 | + $nom = $prefix.$genie['nom']; |
|
| 1223 | 1223 | $periode = max(60, intval($genie['periode'])); |
| 1224 | 1224 | if (charger_fonction($nom, 'genie', true)) { |
| 1225 | 1225 | $prepend_code['taches_generales_cron'] .= "\$val['$nom'] = $periode;\n"; |
@@ -1237,13 +1237,13 @@ discard block |
||
| 1237 | 1237 | } |
| 1238 | 1238 | foreach ($info['style'] as $style) { |
| 1239 | 1239 | if (isset($style['path']) and $style['path']) { |
| 1240 | - $code = "if (\$f=timestamp(direction_css(find_in_path('" . addslashes($style['path']) . "')))) "; |
|
| 1240 | + $code = "if (\$f=timestamp(direction_css(find_in_path('".addslashes($style['path'])."')))) "; |
|
| 1241 | 1241 | } else { |
| 1242 | - $code = "if (\$f='" . addslashes($style['url']) . "') "; |
|
| 1242 | + $code = "if (\$f='".addslashes($style['url'])."') "; |
|
| 1243 | 1243 | } |
| 1244 | 1244 | $code .= "\$val .= '<link rel=\"stylesheet\" href=\"'.\$f.'\" type=\"text/css\""; |
| 1245 | 1245 | if (isset($style['media']) and strlen($style['media'])) { |
| 1246 | - $code .= ' media="' . addslashes($style['media']) . '"'; |
|
| 1246 | + $code .= ' media="'.addslashes($style['media']).'"'; |
|
| 1247 | 1247 | } |
| 1248 | 1248 | $code .= "/>';\n"; |
| 1249 | 1249 | if ($style['type'] != 'prive') { |
@@ -1263,9 +1263,9 @@ discard block |
||
| 1263 | 1263 | if (isset($info['script']) and is_countable($info['script']) ? count($info['script']) : 0) { |
| 1264 | 1264 | foreach ($info['script'] as $script) { |
| 1265 | 1265 | if (isset($script['path']) and $script['path']) { |
| 1266 | - $code = "if (\$f=timestamp(find_in_path('" . addslashes($script['path']) . "'))) "; |
|
| 1266 | + $code = "if (\$f=timestamp(find_in_path('".addslashes($script['path'])."'))) "; |
|
| 1267 | 1267 | } else { |
| 1268 | - $code = "if (\$f='" . addslashes($script['url']) . "') "; |
|
| 1268 | + $code = "if (\$f='".addslashes($script['url'])."') "; |
|
| 1269 | 1269 | } |
| 1270 | 1270 | $code .= "\$val .= '<script src=\"'.\$f.'\" type=\"text/javascript\"></script>';\n"; |
| 1271 | 1271 | if ($script['type'] != 'prive') { |
@@ -1328,10 +1328,10 @@ discard block |
||
| 1328 | 1328 | unset($GLOBALS['spip_pipeline']['all']); |
| 1329 | 1329 | $all_pipes = trim(array_shift($a)); |
| 1330 | 1330 | if ($all_pipes) { |
| 1331 | - $all_pipes = '|' . ltrim($all_pipes, '|'); |
|
| 1331 | + $all_pipes = '|'.ltrim($all_pipes, '|'); |
|
| 1332 | 1332 | } |
| 1333 | 1333 | if (count($a)) { |
| 1334 | - $all_pipes_end = '||' . array_shift($a); |
|
| 1334 | + $all_pipes_end = '||'.array_shift($a); |
|
| 1335 | 1335 | } |
| 1336 | 1336 | } |
| 1337 | 1337 | $content = ''; |
@@ -1348,7 +1348,7 @@ discard block |
||
| 1348 | 1348 | // Eclater le pipeline en filtres et appliquer chaque filtre |
| 1349 | 1349 | foreach ($pipe as $fonc) { |
| 1350 | 1350 | $fonc = trim($fonc); |
| 1351 | - $s_call .= '$val = minipipe(\'' . $fonc . '\', $val);' . "\n"; |
|
| 1351 | + $s_call .= '$val = minipipe(\''.$fonc.'\', $val);'."\n"; |
|
| 1352 | 1352 | if (isset($GLOBALS['spip_matrice'][$fonc])) { |
| 1353 | 1353 | $file = $GLOBALS['spip_matrice'][$fonc]; |
| 1354 | 1354 | $file = "'$file'"; |
@@ -1359,7 +1359,7 @@ discard block |
||
| 1359 | 1359 | if (defined($root_dir)) { |
| 1360 | 1360 | $dir = $root_dir; |
| 1361 | 1361 | } |
| 1362 | - $file = str_replace($regs[0], "'." . $dir . ".'", $file); |
|
| 1362 | + $file = str_replace($regs[0], "'.".$dir.".'", $file); |
|
| 1363 | 1363 | $file = str_replace("''.", '', $file); |
| 1364 | 1364 | $file = str_replace(constant($dir), '', $file); |
| 1365 | 1365 | } |
@@ -1372,7 +1372,7 @@ discard block |
||
| 1372 | 1372 | $content .= "// Pipeline $action \n" |
| 1373 | 1373 | . "function execute_pipeline_$action(&\$val){\n" |
| 1374 | 1374 | . $s_inc |
| 1375 | - . ((isset($prepend_code[$action]) and strlen($prepend_code[$action])) ? trim($prepend_code[$action]) . "\n" : '') |
|
| 1375 | + . ((isset($prepend_code[$action]) and strlen($prepend_code[$action])) ? trim($prepend_code[$action])."\n" : '') |
|
| 1376 | 1376 | . $s_call |
| 1377 | 1377 | . "return \$val;\n}\n"; |
| 1378 | 1378 | } |
@@ -1428,9 +1428,9 @@ discard block |
||
| 1428 | 1428 | $result = ($ok ? ((isset($infos['upgrade']) && $infos['upgrade']) ? _T('plugin_info_upgrade_ok') : _T('plugin_info_install_ok')) : _T('avis_operation_echec')); |
| 1429 | 1429 | if (_IS_CLI) { |
| 1430 | 1430 | include_spip('inc/filtres'); |
| 1431 | - $trace = ltrim(textebrut($trace) . "\n" . $result); |
|
| 1432 | - $trace = ' ' . str_replace("\n", "\n ", $trace); |
|
| 1433 | - echo "\n" . ($ok ? 'OK ' : '/!\ ') . textebrut($titre) . "\n", |
|
| 1431 | + $trace = ltrim(textebrut($trace)."\n".$result); |
|
| 1432 | + $trace = ' '.str_replace("\n", "\n ", $trace); |
|
| 1433 | + echo "\n".($ok ? 'OK ' : '/!\ ').textebrut($titre)."\n", |
|
| 1434 | 1434 | $trace, |
| 1435 | 1435 | "\n"; |
| 1436 | 1436 | } |
@@ -1465,15 +1465,15 @@ discard block |
||
| 1465 | 1465 | $GLOBALS['fichier_php_compile_recent'] = 0; |
| 1466 | 1466 | } |
| 1467 | 1467 | |
| 1468 | - $contenu = '<' . '?php' . "\n" . $comment . "\nif (defined('_ECRIRE_INC_VERSION')) {\n" . $contenu . "}\n?" . '>'; |
|
| 1468 | + $contenu = '<'.'?php'."\n".$comment."\nif (defined('_ECRIRE_INC_VERSION')) {\n".$contenu."}\n?".'>'; |
|
| 1469 | 1469 | // si un fichier existe deja on verifie que son contenu change avant de l'ecraser |
| 1470 | 1470 | // si pas de modif on ne touche pas au fichier initial |
| 1471 | 1471 | if (file_exists($nom)) { |
| 1472 | 1472 | if (substr($nom, -4) == '.php') { |
| 1473 | - $fichier_tmp = substr($nom, 0, -4) . '.tmp.php'; |
|
| 1473 | + $fichier_tmp = substr($nom, 0, -4).'.tmp.php'; |
|
| 1474 | 1474 | } |
| 1475 | 1475 | else { |
| 1476 | - $fichier_tmp = $nom . '.tmp'; |
|
| 1476 | + $fichier_tmp = $nom.'.tmp'; |
|
| 1477 | 1477 | } |
| 1478 | 1478 | file_put_contents($fichier_tmp, $contenu); |
| 1479 | 1479 | if (md5_file($nom) == md5_file($fichier_tmp)) { |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | $blue = dechex($blue); |
| 44 | 44 | |
| 45 | 45 | if (strlen($red) == 1) { |
| 46 | - $red = '0' . $red; |
|
| 46 | + $red = '0'.$red; |
|
| 47 | 47 | } |
| 48 | 48 | if (strlen($green) == 1) { |
| 49 | - $green = '0' . $green; |
|
| 49 | + $green = '0'.$green; |
|
| 50 | 50 | } |
| 51 | 51 | if (strlen($blue) == 1) { |
| 52 | - $blue = '0' . $blue; |
|
| 52 | + $blue = '0'.$blue; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | return "$red$green$blue"; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $couleur = couleur_html_to_hex($couleur); |
| 68 | 68 | $couleur = ltrim($couleur, '#'); |
| 69 | 69 | if (strlen($couleur) === 3) { |
| 70 | - $couleur = $couleur[0] . $couleur[0] . $couleur[1] . $couleur[1] . $couleur[2] . $couleur[2]; |
|
| 70 | + $couleur = $couleur[0].$couleur[0].$couleur[1].$couleur[1].$couleur[2].$couleur[2]; |
|
| 71 | 71 | } |
| 72 | 72 | $retour = []; |
| 73 | 73 | $retour['red'] = hexdec(substr($couleur, 0, 2)); |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | $var_G = ($G / 255); |
| 126 | 126 | $var_B = ($B / 255); |
| 127 | 127 | |
| 128 | - $var_Min = min($var_R, $var_G, $var_B); //Min. value of RGB |
|
| 129 | - $var_Max = max($var_R, $var_G, $var_B); //Max. value of RGB |
|
| 130 | - $del_Max = $var_Max - $var_Min; //Delta RGB value |
|
| 128 | + $var_Min = min($var_R, $var_G, $var_B); //Min. value of RGB |
|
| 129 | + $var_Max = max($var_R, $var_G, $var_B); //Max. value of RGB |
|
| 130 | + $del_Max = $var_Max - $var_Min; //Delta RGB value |
|
| 131 | 131 | |
| 132 | 132 | $L = ($var_Max + $var_Min) / 2; |
| 133 | 133 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | function _couleur_hsl_to_rgb($H, $S, $L) { |
| 191 | 191 | // helper |
| 192 | - $hue_2_rgb = function ($v1, $v2, $vH) { |
|
| 192 | + $hue_2_rgb = function($v1, $v2, $vH) { |
|
| 193 | 193 | if ($vH < 0) { |
| 194 | 194 | $vH += 1; |
| 195 | 195 | } |
@@ -321,11 +321,11 @@ discard block |
||
| 321 | 321 | $img = "<img src='$source' />"; |
| 322 | 322 | } elseif ( |
| 323 | 323 | preg_match('@^data:image/([^;]*);base64,(.*)$@isS', $source, $regs) |
| 324 | - and $extension = _image_trouver_extension_depuis_mime('image/' . $regs[1]) |
|
| 324 | + and $extension = _image_trouver_extension_depuis_mime('image/'.$regs[1]) |
|
| 325 | 325 | and in_array($extension, _image_extensions_acceptees_en_entree()) |
| 326 | 326 | ) { |
| 327 | 327 | # gerer img src="data:....base64" |
| 328 | - $local = sous_repertoire(_DIR_VAR, 'image-data') . md5($regs[2]) . '.' . _image_extension_normalisee($extension); |
|
| 328 | + $local = sous_repertoire(_DIR_VAR, 'image-data').md5($regs[2]).'.'._image_extension_normalisee($extension); |
|
| 329 | 329 | if (!file_exists($local)) { |
| 330 | 330 | ecrire_fichier($local, base64_decode($regs[2])); |
| 331 | 331 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | // les protocoles web prennent au moins 3 lettres |
| 343 | 343 | if (tester_url_absolue($source)) { |
| 344 | 344 | include_spip('inc/distant'); |
| 345 | - $fichier = _DIR_RACINE . copie_locale($source); |
|
| 345 | + $fichier = _DIR_RACINE.copie_locale($source); |
|
| 346 | 346 | if (!$fichier) { |
| 347 | 347 | return ''; |
| 348 | 348 | } |
@@ -440,9 +440,9 @@ discard block |
||
| 440 | 440 | // on garde la terminaison initiale car image simplement copiee |
| 441 | 441 | // et on postfixe son nom avec un md5 du path |
| 442 | 442 | $terminaison_dest = $terminaison; |
| 443 | - $fichier_dest .= '-' . substr(md5("$identifiant"), 0, 5); |
|
| 443 | + $fichier_dest .= '-'.substr(md5("$identifiant"), 0, 5); |
|
| 444 | 444 | } else { |
| 445 | - $fichier_dest .= '-' . substr(md5("$identifiant-$effet"), 0, 5); |
|
| 445 | + $fichier_dest .= '-'.substr(md5("$identifiant-$effet"), 0, 5); |
|
| 446 | 446 | } |
| 447 | 447 | $cache = sous_repertoire(_DIR_VAR, $cache); |
| 448 | 448 | $cache = sous_repertoire($cache, $effet); |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $fichier_dest = substr($fichier_dest, 2); |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - $fichier_dest = $cache . $fichier_dest . '.' . $terminaison_dest; |
|
| 456 | + $fichier_dest = $cache.$fichier_dest.'.'.$terminaison_dest; |
|
| 457 | 457 | |
| 458 | 458 | $GLOBALS['images_calculees'][] = $fichier_dest; |
| 459 | 459 | |
@@ -491,15 +491,15 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | if ($creer) { |
| 493 | 493 | spip_log( |
| 494 | - 'filtre image ' . ($fonction_creation ? reset($fonction_creation) : '') . "[$effet] sur $fichier", |
|
| 495 | - 'images' . _LOG_DEBUG |
|
| 494 | + 'filtre image '.($fonction_creation ? reset($fonction_creation) : '')."[$effet] sur $fichier", |
|
| 495 | + 'images'._LOG_DEBUG |
|
| 496 | 496 | ); |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | $term_fonction = _image_trouver_extension_pertinente($fichier); |
| 500 | - $ret['fonction_imagecreatefrom'] = '_imagecreatefrom' . $term_fonction; |
|
| 500 | + $ret['fonction_imagecreatefrom'] = '_imagecreatefrom'.$term_fonction; |
|
| 501 | 501 | $ret['fichier'] = $fichier; |
| 502 | - $ret['fonction_image'] = '_image_image' . $terminaison_dest; |
|
| 502 | + $ret['fonction_image'] = '_image_image'.$terminaison_dest; |
|
| 503 | 503 | $ret['fichier_dest'] = $fichier_dest; |
| 504 | 504 | $ret['format_source'] = _image_extension_normalisee($terminaison); |
| 505 | 505 | $ret['format_dest'] = $terminaison_dest; |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | |
| 650 | 650 | $_terminaison = _image_trouver_extension_depuis_mime($mime); |
| 651 | 651 | if ($_terminaison and $_terminaison !== $terminaison) { |
| 652 | - spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", 'images.' . _LOG_INFO_IMPORTANTE); |
|
| 652 | + spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", 'images.'._LOG_INFO_IMPORTANTE); |
|
| 653 | 653 | $terminaison = $_terminaison; |
| 654 | 654 | } |
| 655 | 655 | return $terminaison; |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | if (!function_exists('imagepng')) { |
| 807 | 807 | return false; |
| 808 | 808 | } |
| 809 | - $tmp = $fichier . '.tmp'; |
|
| 809 | + $tmp = $fichier.'.tmp'; |
|
| 810 | 810 | $ret = imagepng($img, $tmp); |
| 811 | 811 | if (file_exists($tmp)) { |
| 812 | 812 | $taille_test = getimagesize($tmp); |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | if (!function_exists('imagegif')) { |
| 842 | 842 | return false; |
| 843 | 843 | } |
| 844 | - $tmp = $fichier . '.tmp'; |
|
| 844 | + $tmp = $fichier.'.tmp'; |
|
| 845 | 845 | $ret = imagegif($img, $tmp); |
| 846 | 846 | if (file_exists($tmp)) { |
| 847 | 847 | $taille_test = getimagesize($tmp); |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | if (!function_exists('imagejpeg')) { |
| 882 | 882 | return false; |
| 883 | 883 | } |
| 884 | - $tmp = $fichier . '.tmp'; |
|
| 884 | + $tmp = $fichier.'.tmp'; |
|
| 885 | 885 | |
| 886 | 886 | // Enable interlancing |
| 887 | 887 | imageinterlace($img, true); |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | if (!function_exists('imagewebp')) { |
| 943 | 943 | return false; |
| 944 | 944 | } |
| 945 | - $tmp = $fichier . '.tmp'; |
|
| 945 | + $tmp = $fichier.'.tmp'; |
|
| 946 | 946 | $ret = imagewebp($img, $tmp, $qualite); |
| 947 | 947 | if (file_exists($tmp)) { |
| 948 | 948 | $taille_test = getimagesize($tmp); |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | */ |
| 977 | 977 | function _image_imagesvg($img, $fichier) { |
| 978 | 978 | |
| 979 | - $tmp = $fichier . '.tmp'; |
|
| 979 | + $tmp = $fichier.'.tmp'; |
|
| 980 | 980 | if (strpos($img, '<') === false) { |
| 981 | 981 | $img = supprimer_timestamp($img); |
| 982 | 982 | if (!file_exists($img)) { |
@@ -1033,13 +1033,13 @@ discard block |
||
| 1033 | 1033 | */ |
| 1034 | 1034 | function _image_gd_output($img, $valeurs, $qualite = _IMG_GD_QUALITE, $fonction = null) { |
| 1035 | 1035 | if (is_null($fonction)) { |
| 1036 | - $fonction = '_image_image' . $valeurs['format_dest']; |
|
| 1036 | + $fonction = '_image_image'.$valeurs['format_dest']; |
|
| 1037 | 1037 | } |
| 1038 | 1038 | $ret = false; |
| 1039 | 1039 | #un flag pour reperer les images gravees |
| 1040 | 1040 | $lock = ( |
| 1041 | 1041 | !statut_effacer_images_temporaires('get') // si la fonction n'a pas ete activee, on grave tout |
| 1042 | - or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'] . '.src')) |
|
| 1042 | + or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'].'.src')) |
|
| 1043 | 1043 | ); |
| 1044 | 1044 | if ( |
| 1045 | 1045 | function_exists($fonction) |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | // dans tous les cas mettre a jour la taille de l'image finale |
| 1052 | 1052 | [$valeurs['hauteur_dest'], $valeurs['largeur_dest']] = taille_image($valeurs['fichier_dest']); |
| 1053 | 1053 | $valeurs['date'] = @filemtime($valeurs['fichier_dest']); // pour la retrouver apres disparition |
| 1054 | - ecrire_fichier($valeurs['fichier_dest'] . '.src', serialize($valeurs), true); |
|
| 1054 | + ecrire_fichier($valeurs['fichier_dest'].'.src', serialize($valeurs), true); |
|
| 1055 | 1055 | } |
| 1056 | 1056 | } |
| 1057 | 1057 | |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | |
| 1227 | 1227 | // attributs deprecies. Transformer en CSS |
| 1228 | 1228 | if ($espace = extraire_attribut($tag, 'hspace')) { |
| 1229 | - $style = "margin:{$espace}px;" . $style; |
|
| 1229 | + $style = "margin:{$espace}px;".$style; |
|
| 1230 | 1230 | $tag = inserer_attribut($tag, 'hspace', ''); |
| 1231 | 1231 | } |
| 1232 | 1232 | |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | $image = $valeurs['fichier']; |
| 1354 | 1354 | $format = $valeurs['format_source']; |
| 1355 | 1355 | $destdir = dirname($valeurs['fichier_dest']); |
| 1356 | - $destfile = basename($valeurs['fichier_dest'], '.' . $valeurs['format_dest']); |
|
| 1356 | + $destfile = basename($valeurs['fichier_dest'], '.'.$valeurs['format_dest']); |
|
| 1357 | 1357 | |
| 1358 | 1358 | $format_sortie = $valeurs['format_dest']; |
| 1359 | 1359 | |
@@ -1385,14 +1385,14 @@ discard block |
||
| 1385 | 1385 | |
| 1386 | 1386 | // Si l'image est de la taille demandee (ou plus petite), simplement la retourner |
| 1387 | 1387 | if ($srcWidth and $srcWidth <= $maxWidth and $srcHeight <= $maxHeight) { |
| 1388 | - $vignette = $destination . '.' . $format; |
|
| 1388 | + $vignette = $destination.'.'.$format; |
|
| 1389 | 1389 | @copy($image, $vignette); |
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | 1392 | elseif ($valeurs['format_source'] === 'svg') { |
| 1393 | 1393 | if ($svg = svg_redimensionner($valeurs['fichier'], $destWidth, $destHeight)) { |
| 1394 | 1394 | $format_sortie = 'svg'; |
| 1395 | - $vignette = $destination . '.' . $format_sortie; |
|
| 1395 | + $vignette = $destination.'.'.$format_sortie; |
|
| 1396 | 1396 | $valeurs['fichier_dest'] = $vignette; |
| 1397 | 1397 | _image_gd_output($svg, $valeurs); |
| 1398 | 1398 | } |
@@ -1404,9 +1404,9 @@ discard block |
||
| 1404 | 1404 | define('_CONVERT_COMMAND', 'convert'); |
| 1405 | 1405 | } // Securite : mes_options.php peut preciser le chemin absolu |
| 1406 | 1406 | if (!defined('_RESIZE_COMMAND')) { |
| 1407 | - define('_RESIZE_COMMAND', _CONVERT_COMMAND . ' -quality ' . _IMG_CONVERT_QUALITE . ' -resize %xx%y! %src %dest'); |
|
| 1407 | + define('_RESIZE_COMMAND', _CONVERT_COMMAND.' -quality '._IMG_CONVERT_QUALITE.' -resize %xx%y! %src %dest'); |
|
| 1408 | 1408 | } |
| 1409 | - $vignette = $destination . '.' . $format_sortie; |
|
| 1409 | + $vignette = $destination.'.'.$format_sortie; |
|
| 1410 | 1410 | $commande = str_replace( |
| 1411 | 1411 | ['%x', '%y', '%src', '%dest'], |
| 1412 | 1412 | [ |
@@ -1422,7 +1422,7 @@ discard block |
||
| 1422 | 1422 | if (!@file_exists($vignette)) { |
| 1423 | 1423 | spip_log("echec convert sur $vignette"); |
| 1424 | 1424 | |
| 1425 | - return; // echec commande |
|
| 1425 | + return; // echec commande |
|
| 1426 | 1426 | } |
| 1427 | 1427 | } |
| 1428 | 1428 | |
@@ -1439,7 +1439,7 @@ discard block |
||
| 1439 | 1439 | if (!$output) { |
| 1440 | 1440 | return; |
| 1441 | 1441 | } |
| 1442 | - $vignette = $output . DIRECTORY_SEPARATOR . basename($destination) . '.' . $format_sortie; |
|
| 1442 | + $vignette = $output.DIRECTORY_SEPARATOR.basename($destination).'.'.$format_sortie; |
|
| 1443 | 1443 | |
| 1444 | 1444 | $imagick = new Imagick(); |
| 1445 | 1445 | $imagick->readImage(realpath($image)); |
@@ -1448,7 +1448,7 @@ discard block |
||
| 1448 | 1448 | $destHeight, |
| 1449 | 1449 | Imagick::FILTER_LANCZOS, |
| 1450 | 1450 | 1 |
| 1451 | - );//, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100); |
|
| 1451 | + ); //, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100); |
|
| 1452 | 1452 | $imagick->writeImage($vignette); |
| 1453 | 1453 | |
| 1454 | 1454 | if (!@file_exists($vignette)) { |
@@ -1457,7 +1457,7 @@ discard block |
||
| 1457 | 1457 | return; |
| 1458 | 1458 | } |
| 1459 | 1459 | // remettre le chemin relatif car c'est ce qu'attend SPIP pour la suite (en particlier action/tester) |
| 1460 | - $vignette = $destination . '.' . $format_sortie; |
|
| 1460 | + $vignette = $destination.'.'.$format_sortie; |
|
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | 1463 | // netpbm |
@@ -1468,11 +1468,11 @@ discard block |
||
| 1468 | 1468 | if (_PNMSCALE_COMMAND == '') { |
| 1469 | 1469 | return; |
| 1470 | 1470 | } |
| 1471 | - $vignette = $destination . '.' . $format_sortie; |
|
| 1471 | + $vignette = $destination.'.'.$format_sortie; |
|
| 1472 | 1472 | $pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', _PNMSCALE_COMMAND); |
| 1473 | 1473 | if ($format == 'jpg') { |
| 1474 | 1474 | $jpegtopnm_command = str_replace('pnmscale', 'jpegtopnm', _PNMSCALE_COMMAND); |
| 1475 | - exec("$jpegtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1475 | + exec("$jpegtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1476 | 1476 | if (!($s = @filesize($vignette))) { |
| 1477 | 1477 | spip_unlink($vignette); |
| 1478 | 1478 | } |
@@ -1484,7 +1484,7 @@ discard block |
||
| 1484 | 1484 | } else { |
| 1485 | 1485 | if ($format == 'gif') { |
| 1486 | 1486 | $giftopnm_command = str_replace('pnmscale', 'giftopnm', _PNMSCALE_COMMAND); |
| 1487 | - exec("$giftopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1487 | + exec("$giftopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1488 | 1488 | if (!($s = @filesize($vignette))) { |
| 1489 | 1489 | spip_unlink($vignette); |
| 1490 | 1490 | } |
@@ -1496,7 +1496,7 @@ discard block |
||
| 1496 | 1496 | } else { |
| 1497 | 1497 | if ($format == 'png') { |
| 1498 | 1498 | $pngtopnm_command = str_replace('pnmscale', 'pngtopnm', _PNMSCALE_COMMAND); |
| 1499 | - exec("$pngtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1499 | + exec("$pngtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1500 | 1500 | if (!($s = @filesize($vignette))) { |
| 1501 | 1501 | spip_unlink($vignette); |
| 1502 | 1502 | } |
@@ -1518,7 +1518,7 @@ discard block |
||
| 1518 | 1518 | return; |
| 1519 | 1519 | } |
| 1520 | 1520 | if (_IMG_GD_MAX_PIXELS && $srcWidth * $srcHeight > _IMG_GD_MAX_PIXELS) { |
| 1521 | - spip_log('vignette gd1/gd2 impossible : ' . $srcWidth * $srcHeight . 'pixels'); |
|
| 1521 | + spip_log('vignette gd1/gd2 impossible : '.$srcWidth * $srcHeight.'pixels'); |
|
| 1522 | 1522 | |
| 1523 | 1523 | return; |
| 1524 | 1524 | } |
@@ -1828,7 +1828,7 @@ discard block |
||
| 1828 | 1828 | // de l'image, de facon a tromper le cache du navigateur |
| 1829 | 1829 | // quand on fait supprimer/reuploader un logo |
| 1830 | 1830 | // (pas de filemtime si SAFE MODE) |
| 1831 | - $date = test_espace_prive() ? ('?' . $date) : ''; |
|
| 1831 | + $date = test_espace_prive() ? ('?'.$date) : ''; |
|
| 1832 | 1832 | |
| 1833 | 1833 | return _image_ecrire_tag($image, ['src' => "$logo$date", 'width' => $destWidth, 'height' => $destHeight]); |
| 1834 | 1834 | } |
@@ -1874,7 +1874,7 @@ discard block |
||
| 1874 | 1874 | public static function LittleEndian2String($number, $minbytes = 1) { |
| 1875 | 1875 | $intstring = ''; |
| 1876 | 1876 | while ($number > 0) { |
| 1877 | - $intstring = $intstring . chr($number & 255); |
|
| 1877 | + $intstring = $intstring.chr($number & 255); |
|
| 1878 | 1878 | $number >>= 8; |
| 1879 | 1879 | } |
| 1880 | 1880 | |
@@ -1906,9 +1906,9 @@ discard block |
||
| 1906 | 1906 | $b = $argb['blue']; |
| 1907 | 1907 | |
| 1908 | 1908 | if ($bpp[$key] == 32) { |
| 1909 | - $icXOR[$key] .= chr($b) . chr($g) . chr($r) . chr($a); |
|
| 1909 | + $icXOR[$key] .= chr($b).chr($g).chr($r).chr($a); |
|
| 1910 | 1910 | } elseif ($bpp[$key] == 24) { |
| 1911 | - $icXOR[$key] .= chr($b) . chr($g) . chr($r); |
|
| 1911 | + $icXOR[$key] .= chr($b).chr($g).chr($r); |
|
| 1912 | 1912 | } |
| 1913 | 1913 | |
| 1914 | 1914 | if ($a < 128) { |
@@ -1935,48 +1935,48 @@ discard block |
||
| 1935 | 1935 | |
| 1936 | 1936 | // BITMAPINFOHEADER - 40 bytes |
| 1937 | 1937 | $BitmapInfoHeader[$key] = ''; |
| 1938 | - $BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize; |
|
| 1939 | - $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth; |
|
| 1938 | + $BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize; |
|
| 1939 | + $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth; |
|
| 1940 | 1940 | // The biHeight member specifies the combined |
| 1941 | 1941 | // height of the XOR and AND masks. |
| 1942 | 1942 | $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageHeights[$key] * 2, 4); // LONG biHeight; |
| 1943 | - $BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes; |
|
| 1944 | - $BitmapInfoHeader[$key] .= chr($bpp[$key]) . "\x00"; // wBitCount; |
|
| 1945 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression; |
|
| 1946 | - $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage; |
|
| 1947 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter; |
|
| 1948 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter; |
|
| 1949 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed; |
|
| 1950 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant; |
|
| 1943 | + $BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes; |
|
| 1944 | + $BitmapInfoHeader[$key] .= chr($bpp[$key])."\x00"; // wBitCount; |
|
| 1945 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression; |
|
| 1946 | + $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage; |
|
| 1947 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter; |
|
| 1948 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter; |
|
| 1949 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed; |
|
| 1950 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant; |
|
| 1951 | 1951 | } |
| 1952 | 1952 | |
| 1953 | 1953 | |
| 1954 | - $icondata = "\x00\x00"; // idReserved; // Reserved (must be 0) |
|
| 1955 | - $icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons) |
|
| 1956 | - $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images? |
|
| 1954 | + $icondata = "\x00\x00"; // idReserved; // Reserved (must be 0) |
|
| 1955 | + $icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons) |
|
| 1956 | + $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images? |
|
| 1957 | 1957 | |
| 1958 | 1958 | $dwImageOffset = 6 + (count($gd_image_array) * 16); |
| 1959 | 1959 | foreach ($gd_image_array as $key => $gd_image) { |
| 1960 | 1960 | // ICONDIRENTRY idEntries[1]; // An entry for each image (idCount of 'em) |
| 1961 | 1961 | |
| 1962 | - $icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image |
|
| 1963 | - $icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image |
|
| 1964 | - $icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp) |
|
| 1965 | - $icondata .= "\x00"; // bReserved; // Reserved ( must be 0) |
|
| 1962 | + $icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image |
|
| 1963 | + $icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image |
|
| 1964 | + $icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp) |
|
| 1965 | + $icondata .= "\x00"; // bReserved; // Reserved ( must be 0) |
|
| 1966 | 1966 | |
| 1967 | - $icondata .= "\x01\x00"; // wPlanes; // Color Planes |
|
| 1968 | - $icondata .= chr($bpp[$key]) . "\x00"; // wBitCount; // Bits per pixel |
|
| 1967 | + $icondata .= "\x01\x00"; // wPlanes; // Color Planes |
|
| 1968 | + $icondata .= chr($bpp[$key])."\x00"; // wBitCount; // Bits per pixel |
|
| 1969 | 1969 | |
| 1970 | 1970 | $dwBytesInRes = 40 + strlen($icXOR[$key]) + strlen($icAND[$key]); |
| 1971 | 1971 | $icondata .= phpthumb_functions::LittleEndian2String( |
| 1972 | 1972 | $dwBytesInRes, |
| 1973 | 1973 | 4 |
| 1974 | - ); // dwBytesInRes; // How many bytes in this resource? |
|
| 1974 | + ); // dwBytesInRes; // How many bytes in this resource? |
|
| 1975 | 1975 | |
| 1976 | 1976 | $icondata .= phpthumb_functions::LittleEndian2String( |
| 1977 | 1977 | $dwImageOffset, |
| 1978 | 1978 | 4 |
| 1979 | - ); // dwImageOffset; // Where in the file is this image? |
|
| 1979 | + ); // dwImageOffset; // Where in the file is this image? |
|
| 1980 | 1980 | $dwImageOffset += strlen($BitmapInfoHeader[$key]); |
| 1981 | 1981 | $dwImageOffset += strlen($icXOR[$key]); |
| 1982 | 1982 | $dwImageOffset += strlen($icAND[$key]); |
@@ -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, |