@@ -77,13 +77,13 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | function chrono_requete($temps) { |
| 79 | 79 | $total = 0; |
| 80 | - $hors = "<i>" . _T('zbug_hors_compilation') . "</i>"; |
|
| 80 | + $hors = "<i>"._T('zbug_hors_compilation')."</i>"; |
|
| 81 | 81 | $t = $q = $n = $d = array(); |
| 82 | 82 | // Totaliser les temps et completer le Explain |
| 83 | 83 | foreach ($temps as $key => $v) { |
| 84 | 84 | list($dt, $nb, $boucle, $query, $explain, $res, $contexte) = $v; |
| 85 | 85 | if (is_array($contexte)) { |
| 86 | - $k = ($contexte[0] . " $boucle"); |
|
| 86 | + $k = ($contexte[0]." $boucle"); |
|
| 87 | 87 | include_spip('public/compiler'); |
| 88 | 88 | $env = reconstruire_contexte_compil($contexte); |
| 89 | 89 | } else { |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | // Fabriquer les liens de navigations dans le tableau des temps |
| 129 | 129 | foreach ($temps as $k => $v) { |
| 130 | 130 | $titre = strip_tags($v[2]); |
| 131 | - $href = quote_amp($GLOBALS['REQUEST_URI']) . "#req$i"; |
|
| 131 | + $href = quote_amp($GLOBALS['REQUEST_URI'])."#req$i"; |
|
| 132 | 132 | $href = str_replace("\\'", ''', $href); |
| 133 | 133 | |
| 134 | 134 | if (!isset($t[$v[2]])) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | unset($d['']); |
| 150 | 150 | // Fabriquer le tableau des liens de navigation dans le grand tableau |
| 151 | 151 | foreach ($d as $k => $v) { |
| 152 | - $d[$k] = $n[$k] . "</td><td>$k</td><td class='time'>$v</td><td class='liste-reqs'>" |
|
| 152 | + $d[$k] = $n[$k]."</td><td>$k</td><td class='time'>$v</td><td class='liste-reqs'>" |
|
| 153 | 153 | . join('', $t[$k]); |
| 154 | 154 | } |
| 155 | 155 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | . join("</td></tr>\n<tr><td>", $d) |
| 160 | 160 | . "</td></tr>\n" |
| 161 | 161 | . (# _request('var_mode_objet') ? '' : |
| 162 | - ("<tr><td>" . count($temps) . "</td><td>" . _T('info_total') . '</td><td class="time">' . $total . "</td><td></td></tr>")) |
|
| 162 | + ("<tr><td>".count($temps)."</td><td>"._T('info_total').'</td><td class="time">'.$total."</td><td></td></tr>")) |
|
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | 165 | return array($temps, $navigation); |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | return $r3; |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | - if ((tester_url_absolue($redirect) or preg_match(',^\w+:,',trim($redirect))) |
|
| 25 | + if ((tester_url_absolue($redirect) or preg_match(',^\w+:,', trim($redirect))) |
|
| 26 | 26 | and !defined('_AUTORISER_ACTION_ABS_REDIRECT')) { |
| 27 | 27 | // si l'url est une url du site, on la laisse passer sans rien faire |
| 28 | 28 | // c'est encore le plus simple |
| 29 | - $base = $GLOBALS['meta']['adresse_site'] . "/"; |
|
| 29 | + $base = $GLOBALS['meta']['adresse_site']."/"; |
|
| 30 | 30 | if (strlen($base) and strncmp($redirect, $base, strlen($base)) == 0) { |
| 31 | 31 | return $redirect; |
| 32 | 32 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | if ($ancre = _request('var_ajax_ancre')) { |
| 146 | 146 | // pas n'importe quoi quand meme dans la variable ! |
| 147 | 147 | $ancre = str_replace(array('<', '"', "'"), array('<', '"', ''), $ancre); |
| 148 | - $texte = "<a href='#$ancre' name='ajax_ancre' style='display:none;'>anchor</a>" . $texte; |
|
| 148 | + $texte = "<a href='#$ancre' name='ajax_ancre' style='display:none;'>anchor</a>".$texte; |
|
| 149 | 149 | } |
| 150 | 150 | } else { |
| 151 | 151 | include_spip('inc/headers'); |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | // on ajoute un br en display none en tete du retour ajax pour regler un bug dans IE6/7 |
| 300 | 300 | // sans cela le formulaire n'est pas actif apres le hit ajax |
| 301 | 301 | // la classe ajax-form-is-ok sert a s'assurer que le retour ajax s'est bien passe |
| 302 | - $retour = "<br class='bugajaxie ajax-form-is-ok' style='display:none;'/>" . $retour; |
|
| 302 | + $retour = "<br class='bugajaxie ajax-form-is-ok' style='display:none;'/>".$retour; |
|
| 303 | 303 | ajax_retour($retour, false); |
| 304 | 304 | |
| 305 | 305 | return true; // on a fini le hit |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | renouvelle_alea(); |
| 63 | 63 | $new = false; |
| 64 | 64 | } else { |
| 65 | - spip_log("impossible d'ecrire dans " . $cache); |
|
| 65 | + spip_log("impossible d'ecrire dans ".$cache); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | // et refaire le cache si on a du lire en base |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | if (!isset($touch[$table])) { |
| 163 | 163 | touch_meta($antidate, $table); |
| 164 | 164 | } |
| 165 | - sql_delete('spip_' . $table, "nom='$nom'", '', 'continue'); |
|
| 165 | + sql_delete('spip_'.$table, "nom='$nom'", '', 'continue'); |
|
| 166 | 166 | unset($GLOBALS[$table][$nom]); |
| 167 | 167 | if (!isset($touch[$table])) { |
| 168 | 168 | touch_meta($antidate, $table); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | return; |
| 194 | 194 | } |
| 195 | 195 | include_spip('base/abstract_sql'); |
| 196 | - $res = sql_select("*", 'spip_' . $table, "nom=" . sql_quote($nom), '', '', '', '', '', 'continue'); |
|
| 196 | + $res = sql_select("*", 'spip_'.$table, "nom=".sql_quote($nom), '', '', '', '', '', 'continue'); |
|
| 197 | 197 | // table pas encore installee, travailler en php seulement |
| 198 | 198 | if (!$res) { |
| 199 | 199 | $GLOBALS[$table][$nom] = $valeur; |
@@ -226,9 +226,9 @@ discard block |
||
| 226 | 226 | $r['impt'] = sql_quote($importable, '', 'text'); |
| 227 | 227 | } |
| 228 | 228 | if ($row) { |
| 229 | - sql_update('spip_' . $table, $r, "nom=" . sql_quote($nom)); |
|
| 229 | + sql_update('spip_'.$table, $r, "nom=".sql_quote($nom)); |
|
| 230 | 230 | } else { |
| 231 | - sql_insert('spip_' . $table, "(" . join(',', array_keys($r)) . ")", "(" . join(',', array_values($r)) . ")"); |
|
| 231 | + sql_insert('spip_'.$table, "(".join(',', array_keys($r)).")", "(".join(',', array_values($r)).")"); |
|
| 232 | 232 | } |
| 233 | 233 | if (!isset($touch[$table])) { |
| 234 | 234 | touch_meta($antidate, $table); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * Nom du fichier cache |
| 246 | 246 | **/ |
| 247 | 247 | function cache_meta($table = 'meta') { |
| 248 | - return ($table == 'meta') ? _FILE_META : (_DIR_CACHE . $table . '.php'); |
|
| 248 | + return ($table == 'meta') ? _FILE_META : (_DIR_CACHE.$table.'.php'); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $cle = array_search($table, $liste); |
| 308 | 308 | if ($cle !== false) { |
| 309 | 309 | unset($liste[$cle]); |
| 310 | - if ($liste ) { |
|
| 310 | + if ($liste) { |
|
| 311 | 311 | ecrire_meta('tables_config', serialize($liste)); |
| 312 | 312 | } else { |
| 313 | 313 | effacer_meta('tables_config'); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | // si demande de traduction |
| 65 | 65 | // on recupere les valeurs de la traduction |
| 66 | 66 | if ($lier_trad) { |
| 67 | - if ($select = charger_fonction("precharger_traduction_" . $type, 'inc', true)) { |
|
| 67 | + if ($select = charger_fonction("precharger_traduction_".$type, 'inc', true)) { |
|
| 68 | 68 | $row = $select($id_objet, $id_rubrique, $lier_trad); |
| 69 | 69 | } else { |
| 70 | 70 | $row = precharger_traduction_objet($type, $id_objet, $id_rubrique, $lier_trad, $champ_titre); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | // recuperer le secteur, pour affecter les bons champs extras |
| 103 | 103 | if ($id_rubrique and $is_secteur) { |
| 104 | 104 | if (!$row['id_secteur']) { |
| 105 | - $row_rub = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=" . sql_quote($id_rubrique)); |
|
| 105 | + $row_rub = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=".sql_quote($id_rubrique)); |
|
| 106 | 106 | $row['id_secteur'] = $row_rub; |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $row = sql_fetsel("*", $table, "$_id_objet=".intval($lier_trad)); |
| 137 | 137 | if ($row) { |
| 138 | 138 | include_spip('inc/filtres'); |
| 139 | - $row[$champ_titre] = filtrer_entites(objet_T($type, 'info_nouvelle_traduction')) . ' ' . $row[$champ_titre]; |
|
| 139 | + $row[$champ_titre] = filtrer_entites(objet_T($type, 'info_nouvelle_traduction')).' '.$row[$champ_titre]; |
|
| 140 | 140 | } else { |
| 141 | 141 | $row = array(); |
| 142 | 142 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $row_rub = sql_fetsel("id_rubrique", "spip_rubriques", |
| 180 | - "lang='" . $GLOBALS['spip_lang'] . "' AND id_parent=".intval($id_parent)); |
|
| 180 | + "lang='".$GLOBALS['spip_lang']."' AND id_parent=".intval($id_parent)); |
|
| 181 | 181 | if ($row_rub) { |
| 182 | 182 | $row['id_rubrique'] = $row_rub['id_rubrique']; |
| 183 | 183 | } |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | $where_resultat_recent = sql_date_proche('maj', (0 - ($delai_fraicheur + 100)), " SECOND"); |
| 81 | 81 | if (!isset($cache[$serveur][$table][$recherche])) { |
| 82 | 82 | $hash_serv = ($serveur ? substr(md5($serveur), 0, 16) : ''); |
| 83 | - $hash = substr(md5($recherche . $table), 0, 16); |
|
| 84 | - $where = "(resultats.recherche='$hash' AND resultats.table_objet=" . sql_quote($table) . " AND resultats.serveur='$hash_serv')"; |
|
| 83 | + $hash = substr(md5($recherche.$table), 0, 16); |
|
| 84 | + $where = "(resultats.recherche='$hash' AND resultats.table_objet=".sql_quote($table)." AND resultats.serveur='$hash_serv')"; |
|
| 85 | 85 | $row = sql_fetsel('recherche', 'spip_resultats AS resultats', |
| 86 | - $where . " AND $where_resultat_recent", '', '', '0,1'); |
|
| 86 | + $where." AND $where_resultat_recent", '', '', '0,1'); |
|
| 87 | 87 | if (!$row |
| 88 | 88 | or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') |
| 89 | 89 | ) { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | foreach ($listes_ids as $p => $ids) { |
| 183 | - $select .= "+$p*(" . |
|
| 183 | + $select .= "+$p*(". |
|
| 184 | 184 | sql_in("$table.$primary", $ids, '', $serveur) |
| 185 | 185 | . ") "; |
| 186 | 186 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $contenu = @gzfile($fichier); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - return is_array($contenu) ? join('', $contenu) : (string)$contenu; |
|
| 125 | + return is_array($contenu) ? join('', $contenu) : (string) $contenu; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -315,9 +315,9 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | function ecrire_fichier_securise($fichier, $contenu, $ecrire_quand_meme = false, $truncate = true) { |
| 317 | 317 | if (substr($fichier, -4) !== '.php') { |
| 318 | - spip_log('Erreur de programmation: ' . $fichier . ' doit finir par .php'); |
|
| 318 | + spip_log('Erreur de programmation: '.$fichier.' doit finir par .php'); |
|
| 319 | 319 | } |
| 320 | - $contenu = "<" . "?php die ('Acces interdit'); ?" . ">\n" . $contenu; |
|
| 320 | + $contenu = "<"."?php die ('Acces interdit'); ?".">\n".$contenu; |
|
| 321 | 321 | |
| 322 | 322 | return ecrire_fichier($fichier, $contenu, $ecrire_quand_meme, $truncate); |
| 323 | 323 | } |
@@ -329,9 +329,9 @@ discard block |
||
| 329 | 329 | * @param bool $force |
| 330 | 330 | * @return bool |
| 331 | 331 | */ |
| 332 | -function ecrire_fichier_calcule_si_modifie($fichier, $contenu, $force=false, $use_copy=false) { |
|
| 333 | - $fichier_tmp = $fichier . '.last'; |
|
| 334 | - if (!ecrire_fichier($fichier_tmp, $contenu, true)){ |
|
| 332 | +function ecrire_fichier_calcule_si_modifie($fichier, $contenu, $force = false, $use_copy = false) { |
|
| 333 | + $fichier_tmp = $fichier.'.last'; |
|
| 334 | + if (!ecrire_fichier($fichier_tmp, $contenu, true)) { |
|
| 335 | 335 | return false; |
| 336 | 336 | } |
| 337 | 337 | if ($force |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | function lire_fichier_securise($fichier, &$contenu, $options = array()) { |
| 370 | 370 | if ($res = lire_fichier($fichier, $contenu, $options)) { |
| 371 | - $contenu = substr($contenu, strlen("<" . "?php die ('Acces interdit'); ?" . ">\n")); |
|
| 371 | + $contenu = substr($contenu, strlen("<"."?php die ('Acces interdit'); ?".">\n")); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | return $res; |
@@ -488,11 +488,11 @@ discard block |
||
| 488 | 488 | $invalidate = @opcache_invalidate($filepath, true); |
| 489 | 489 | // si l'invalidation a echoue lever un flag |
| 490 | 490 | if (!$invalidate and !defined('_spip_attend_invalidation_opcode_cache')) { |
| 491 | - define('_spip_attend_invalidation_opcode_cache',true); |
|
| 491 | + define('_spip_attend_invalidation_opcode_cache', true); |
|
| 492 | 492 | } |
| 493 | 493 | } elseif (!defined('_spip_attend_invalidation_opcode_cache')) { |
| 494 | 494 | // n'agira que si opcache est effectivement actif (il semble qu'on a pas toujours la fonction opcache_invalidate) |
| 495 | - define('_spip_attend_invalidation_opcode_cache',true); |
|
| 495 | + define('_spip_attend_invalidation_opcode_cache', true); |
|
| 496 | 496 | } |
| 497 | 497 | // APC. |
| 498 | 498 | if (function_exists('apc_delete_file')) { |
@@ -532,11 +532,11 @@ discard block |
||
| 532 | 532 | $wait = $duree + 1; |
| 533 | 533 | if ($timestamp) { |
| 534 | 534 | $wait -= (time() - $timestamp); |
| 535 | - if ($wait<0) { |
|
| 535 | + if ($wait < 0) { |
|
| 536 | 536 | $wait = 0; |
| 537 | 537 | } |
| 538 | 538 | } |
| 539 | - spip_log('Probleme de configuration opcache.revalidate_freq '. $duree .'s : on attend '.$wait.'s', _LOG_INFO_IMPORTANTE); |
|
| 539 | + spip_log('Probleme de configuration opcache.revalidate_freq '.$duree.'s : on attend '.$wait.'s', _LOG_INFO_IMPORTANTE); |
|
| 540 | 540 | if ($wait) { |
| 541 | 541 | sleep($duree + 1); |
| 542 | 542 | } |
@@ -564,9 +564,9 @@ discard block |
||
| 564 | 564 | if ($item == '.' || $item == '..') { |
| 565 | 565 | continue; |
| 566 | 566 | } |
| 567 | - if (!supprimer_repertoire($dir . "/" . $item)) { |
|
| 568 | - @chmod($dir . "/" . $item, 0777); |
|
| 569 | - if (!supprimer_repertoire($dir . "/" . $item)) { |
|
| 567 | + if (!supprimer_repertoire($dir."/".$item)) { |
|
| 568 | + @chmod($dir."/".$item, 0777); |
|
| 569 | + if (!supprimer_repertoire($dir."/".$item)) { |
|
| 570 | 570 | return false; |
| 571 | 571 | } |
| 572 | 572 | }; |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | if (!strlen($subdir)) { |
| 612 | 612 | $n = strrpos($base, "/"); |
| 613 | 613 | if ($n === false) { |
| 614 | - return $nobase ? '' : ($base . '/'); |
|
| 614 | + return $nobase ? '' : ($base.'/'); |
|
| 615 | 615 | } |
| 616 | 616 | $subdir = substr($base, $n + 1); |
| 617 | 617 | $base = substr($base, 0, $n + 1); |
@@ -621,14 +621,14 @@ discard block |
||
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | $baseaff = $nobase ? '' : $base; |
| 624 | - if (isset($dirs[$base . $subdir])) { |
|
| 625 | - return $baseaff . $dirs[$base . $subdir]; |
|
| 624 | + if (isset($dirs[$base.$subdir])) { |
|
| 625 | + return $baseaff.$dirs[$base.$subdir]; |
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | - $path = $base . $subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf' |
|
| 628 | + $path = $base.$subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf' |
|
| 629 | 629 | |
| 630 | 630 | if (file_exists("$path/.ok")) { |
| 631 | - return $baseaff . ($dirs[$base . $subdir] = "$subdir/"); |
|
| 631 | + return $baseaff.($dirs[$base.$subdir] = "$subdir/"); |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | @mkdir($path, _SPIP_CHMOD); |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | @touch("$path/.ok"); |
| 639 | 639 | spip_log("creation $base$subdir/"); |
| 640 | 640 | |
| 641 | - return $baseaff . ($dirs[$base . $subdir] = "$subdir/"); |
|
| 641 | + return $baseaff.($dirs[$base.$subdir] = "$subdir/"); |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | // en cas d'echec c'est peut etre tout simplement que le disque est plein : |
@@ -648,10 +648,10 @@ discard block |
||
| 648 | 648 | return ''; |
| 649 | 649 | } |
| 650 | 650 | if (!_DIR_RESTREINT) { |
| 651 | - $base = preg_replace(',^' . _DIR_RACINE . ',', '', $base); |
|
| 651 | + $base = preg_replace(',^'._DIR_RACINE.',', '', $base); |
|
| 652 | 652 | } |
| 653 | 653 | $base .= $subdir; |
| 654 | - raler_fichier($base . '/.ok'); |
|
| 654 | + raler_fichier($base.'/.ok'); |
|
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | $beginning = $fichiers; |
| 720 | 720 | $end = preg_files("$f/", $pattern, |
| 721 | 721 | $maxfiles - $nbfiles, $recurs); |
| 722 | - $fichiers = array_merge((array)$beginning, (array)$end); |
|
| 722 | + $fichiers = array_merge((array) $beginning, (array) $end); |
|
| 723 | 723 | $nbfiles = count($fichiers); |
| 724 | 724 | } |
| 725 | 725 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | $dir = constant($dir); |
| 70 | 70 | foreach ($infos['install'] as $file) { |
| 71 | - $file = $dir . $plug . "/" . trim($file); |
|
| 71 | + $file = $dir.$plug."/".trim($file); |
|
| 72 | 72 | if (file_exists($file)) { |
| 73 | 73 | include_once($file); |
| 74 | 74 | } |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | // S'assurer que les metas de la table spécifique sont bien accessibles dans la globale |
| 82 | 82 | lire_metas($table); |
| 83 | 83 | } |
| 84 | - $nom_meta = $infos['prefix'] . '_base_version'; |
|
| 84 | + $nom_meta = $infos['prefix'].'_base_version'; |
|
| 85 | 85 | |
| 86 | 86 | // Détermination de la fonction à appeler et de ses arguments |
| 87 | - $f = $infos['prefix'] . "_install"; |
|
| 87 | + $f = $infos['prefix']."_install"; |
|
| 88 | 88 | if (!function_exists($f)) { |
| 89 | 89 | $f = isset($infos['schema']) ? 'spip_plugin_install' : ''; |
| 90 | 90 | $arg = $infos; |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | and spip_version_compare($GLOBALS[$table][$nom_meta], $version_cible, '>=')); |
| 169 | 169 | break; |
| 170 | 170 | case 'install': |
| 171 | - if (function_exists($upgrade = $infos['prefix'] . '_upgrade')) { |
|
| 171 | + if (function_exists($upgrade = $infos['prefix'].'_upgrade')) { |
|
| 172 | 172 | $upgrade($nom_meta, $version_cible, $table); |
| 173 | 173 | } |
| 174 | 174 | break; |
| 175 | 175 | case 'uninstall': |
| 176 | - if (function_exists($vider_tables = $infos['prefix'] . '_vider_tables')) { |
|
| 176 | + if (function_exists($vider_tables = $infos['prefix'].'_vider_tables')) { |
|
| 177 | 177 | $vider_tables($nom_meta, $table); |
| 178 | 178 | } |
| 179 | 179 | break; |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | // de connexion, et tout risque d'ambiguite |
| 81 | 81 | if (!isset($nom_cache_desc_sql[$serveur][$objets_sql])) { |
| 82 | 82 | $nom_cache_desc_sql[$serveur][$objets_sql] = |
| 83 | - _DIR_CACHE . 'sql_desc_' |
|
| 83 | + _DIR_CACHE.'sql_desc_' |
|
| 84 | 84 | . ($serveur ? "{$serveur}_" : "") |
| 85 | - . substr(md5($connexion['db'] . ":" . $connexion['prefixe'] . ":$objets_sql"), 0, 8) |
|
| 85 | + . substr(md5($connexion['db'].":".$connexion['prefixe'].":$objets_sql"), 0, 8) |
|
| 86 | 86 | . '.txt'; |
| 87 | 87 | // nouveau nom de cache = nouvelle version en memoire |
| 88 | 88 | unset($connexion['tables']); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | if ($connexion['spip_connect_version']) { |
| 111 | 111 | if ($table_spip and isset($GLOBALS['table_des_tables'][$nom])) { |
| 112 | 112 | $nom = $GLOBALS['table_des_tables'][$nom]; |
| 113 | - $nom_sql = 'spip_' . $nom; |
|
| 113 | + $nom_sql = 'spip_'.$nom; |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -136,11 +136,11 @@ discard block |
||
| 136 | 136 | // meme si pas d'abreviation declaree, trouver la table spip_$nom |
| 137 | 137 | // si c'est une table principale, |
| 138 | 138 | // puisqu'on le fait aussi pour les tables auxiliaires |
| 139 | - elseif ($nom_sql == $nom and isset($GLOBALS['tables_principales']['spip_' . $nom])) { |
|
| 140 | - $nom_sql = 'spip_' . $nom; |
|
| 139 | + elseif ($nom_sql == $nom and isset($GLOBALS['tables_principales']['spip_'.$nom])) { |
|
| 140 | + $nom_sql = 'spip_'.$nom; |
|
| 141 | 141 | $fdesc = &$GLOBALS['tables_principales'][$nom_sql]; |
| 142 | 142 | } elseif (isset($GLOBALS['tables_auxiliaires'][$n = $nom]) |
| 143 | - or isset($GLOBALS['tables_auxiliaires'][$n = 'spip_' . $nom]) |
|
| 143 | + or isset($GLOBALS['tables_auxiliaires'][$n = 'spip_'.$nom]) |
|
| 144 | 144 | ) { |
| 145 | 145 | $nom_sql = $n; |
| 146 | 146 | $fdesc = &$GLOBALS['tables_auxiliaires'][$n]; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $desc = sql_showtable($nom_sql, $table_spip, $serveur); |
| 153 | 153 | if (!$desc or !$desc['field']) { |
| 154 | 154 | if (!$fdesc) { |
| 155 | - spip_log("trouver_table: table inconnue '$serveur' '$nom'", 'base' . _LOG_INFO_IMPORTANTE); |
|
| 155 | + spip_log("trouver_table: table inconnue '$serveur' '$nom'", 'base'._LOG_INFO_IMPORTANTE); |
|
| 156 | 156 | |
| 157 | 157 | return null; |
| 158 | 158 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $desc['exist'] = true; |
| 165 | 165 | // gerer le cas des cles vides (echec de l'analyse sur une vue par exemple) |
| 166 | 166 | // pour recuperer la declaration de lister_tables_objets_sql() si il y en a une |
| 167 | - if (! $desc['key']) { |
|
| 167 | + if (!$desc['key']) { |
|
| 168 | 168 | spip_log("trouver_table: table sans cle '$serveur' '$nom'", 'base'); |
| 169 | 169 | unset($desc['key']); |
| 170 | 170 | } |
@@ -178,10 +178,10 @@ discard block |
||
| 178 | 178 | // $desc est prioritaire pour la description de la table |
| 179 | 179 | $desc = array_merge(lister_tables_objets_sql($nom_sql, $desc), $desc); |
| 180 | 180 | // s'assurer qu'on a toujours un 'key' |
| 181 | - if (!isset($desc['key']) && !empty($fdesc['key'])){ |
|
| 181 | + if (!isset($desc['key']) && !empty($fdesc['key'])) { |
|
| 182 | 182 | $desc['key'] = $fdesc['key']; |
| 183 | 183 | } |
| 184 | - if (! isset($desc['key'])) { |
|
| 184 | + if (!isset($desc['key'])) { |
|
| 185 | 185 | $desc['key'] = array(); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $l = ""; |
| 54 | 54 | if ($primary = id_table_objet($objet) |
| 55 | - and $trouver_table($l = $table_sql . "_liens") |
|
| 55 | + and $trouver_table($l = $table_sql."_liens") |
|
| 56 | 56 | and !preg_match(',[^\w],', $primary) |
| 57 | 57 | and !preg_match(',[^\w],', $l) |
| 58 | 58 | ) { |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @return int |
| 212 | 212 | */ |
| 213 | 213 | function objet_optimiser_liens($objets_source, $objets_lies) { |
| 214 | - spip_log("objet_optimiser_liens : ".json_encode($objets_source) . ', ' . json_encode($objets_lies), 'genie'._LOG_DEBUG); |
|
| 214 | + spip_log("objet_optimiser_liens : ".json_encode($objets_source).', '.json_encode($objets_lies), 'genie'._LOG_DEBUG); |
|
| 215 | 215 | return objet_traiter_liaisons('lien_optimise', $objets_source, $objets_lies); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | $where = lien_where($primary, '*', $objet, $id_objet); |
| 402 | 402 | $rang = intval(sql_getfetsel('max(rang_lien)', $table_lien, $where)); |
| 403 | 403 | // si aucun lien n'a de rang, on en introduit pas, on garde zero |
| 404 | - if ($rang>0) { |
|
| 404 | + if ($rang > 0) { |
|
| 405 | 405 | $rang = intval($rang) + 1; |
| 406 | 406 | } |
| 407 | 407 | } |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | |
| 437 | 437 | if (lien_triables($table_lien) and isset($insertions['rang_lien']) and intval($insertions['rang_lien'])) { |
| 438 | 438 | // on decale les liens de rang_lien>=la valeur inseree pour faire la place |
| 439 | - $w = lien_where($primary, '*', $objet, $id_objet, array('rang_lien>='.intval($insertions['rang_lien']),"$primary!=".intval($id))); |
|
| 439 | + $w = lien_where($primary, '*', $objet, $id_objet, array('rang_lien>='.intval($insertions['rang_lien']), "$primary!=".intval($id))); |
|
| 440 | 440 | sql_update($table_lien, array('rang_lien'=>'rang_lien+1'), $w); |
| 441 | 441 | } |
| 442 | 442 | |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | // si on a fait des insertions, on reordonne les liens concernes |
| 462 | - if ($ins>0) { |
|
| 462 | + if ($ins > 0) { |
|
| 463 | 463 | lien_ordonner($objet_source, $primary, $table_lien, $id, $objets); |
| 464 | 464 | } |
| 465 | 465 | |
@@ -489,10 +489,10 @@ discard block |
||
| 489 | 489 | $objet = (($objet == '*') ? $objet : objet_type($objet)); # securite |
| 490 | 490 | |
| 491 | 491 | $where = lien_where($primary, '*', $objet, $id_objet); |
| 492 | - $liens = sql_allfetsel("$primary, id_objet, objet, rang_lien", $table_lien, $where, $primary,"rang_lien"); |
|
| 492 | + $liens = sql_allfetsel("$primary, id_objet, objet, rang_lien", $table_lien, $where, $primary, "rang_lien"); |
|
| 493 | 493 | |
| 494 | 494 | $rangs = array_column($liens, 'rang_lien'); |
| 495 | - if (count($rangs) and (max($rangs)>0 or min($rangs)<0)) { |
|
| 495 | + if (count($rangs) and (max($rangs) > 0 or min($rangs) < 0)) { |
|
| 496 | 496 | $rang = 1; |
| 497 | 497 | foreach ($liens as $lien) { |
| 498 | 498 | $where = lien_where($primary, $lien[$primary], $objet, $id_objet, array('rang_lien!='.intval($rang))); |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | |
| 557 | 557 | if ($id_source !== '*') { |
| 558 | 558 | $where[] = (is_array($id_source) ? sql_in(addslashes($primary), array_map('intval', $id_source), |
| 559 | - $not) : addslashes($primary) . ($not ? "<>" : "=") . intval($id_source)); |
|
| 559 | + $not) : addslashes($primary).($not ? "<>" : "=").intval($id_source)); |
|
| 560 | 560 | } elseif ($not) { |
| 561 | 561 | $where[] = "0=1"; |
| 562 | 562 | } // idiot mais quand meme |
@@ -568,11 +568,11 @@ discard block |
||
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | if ($objet !== '*') { |
| 571 | - $where[] = "objet=" . sql_quote($objet); |
|
| 571 | + $where[] = "objet=".sql_quote($objet); |
|
| 572 | 572 | } |
| 573 | 573 | if ($id_objet !== '*') { |
| 574 | 574 | $where[] = (is_array($id_objet) ? sql_in('id_objet', array_map('intval', $id_objet), |
| 575 | - $not) : "id_objet" . ($not ? "<>" : "=") . intval($id_objet)); |
|
| 575 | + $not) : "id_objet".($not ? "<>" : "=").intval($id_objet)); |
|
| 576 | 576 | } elseif ($not) { |
| 577 | 577 | $where[] = "0=1"; |
| 578 | 578 | } // idiot mais quand meme |
@@ -735,19 +735,19 @@ discard block |
||
| 735 | 735 | // il faut les eliminier en repetant la condition dans le where L.objet='xxx' |
| 736 | 736 | "$table_lien AS L |
| 737 | 737 | LEFT JOIN $spip_table_objet AS O |
| 738 | - ON (O.$id_table_objet=L.id_objet AND L.objet=" . sql_quote($type) . ")", |
|
| 739 | - "L.objet=" . sql_quote($type) . " AND O.$id_table_objet IS NULL"); |
|
| 738 | + ON (O.$id_table_objet=L.id_objet AND L.objet=".sql_quote($type).")", |
|
| 739 | + "L.objet=".sql_quote($type)." AND O.$id_table_objet IS NULL"); |
|
| 740 | 740 | // sur une cle primaire composee, pas d'autres solutions que de virer un a un |
| 741 | 741 | while ($row = sql_fetch($res)) { |
| 742 | 742 | if ($primary === 'id_document' and in_array($type, ['site', 'rubrique']) and !intval($row['id_objet'])) { |
| 743 | 743 | continue; // gaffe, c'est le logo du site ou des rubriques! |
| 744 | 744 | } |
| 745 | 745 | $e = sql_delete($table_lien, |
| 746 | - array("$primary=" . $row['id'], "id_objet=" . $row['id_objet'], "objet=" . sql_quote($type))); |
|
| 746 | + array("$primary=".$row['id'], "id_objet=".$row['id_objet'], "objet=".sql_quote($type))); |
|
| 747 | 747 | if ($e != false) { |
| 748 | 748 | $dels += $e; |
| 749 | 749 | spip_log( |
| 750 | - "lien_optimise: Entree " . $row['id'] . "/" . $row['id_objet'] . "/$type supprimee dans la table $table_lien", |
|
| 750 | + "lien_optimise: Entree ".$row['id']."/".$row['id_objet']."/$type supprimee dans la table $table_lien", |
|
| 751 | 751 | 'genie'._LOG_INFO_IMPORTANTE |
| 752 | 752 | ); |
| 753 | 753 | } |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | if (lien_triables($table_lien) and isset($qualif['rang_lien'])) { |
| 849 | 849 | if (intval($qualif['rang_lien'])) { |
| 850 | 850 | // on decale les liens de rang_lien>=la valeur inseree pour faire la place |
| 851 | - $w = lien_where($primary, '*', $objet, $id_objet, array('rang_lien>='.intval($qualif['rang_lien']),"$primary!=".intval($id))); |
|
| 851 | + $w = lien_where($primary, '*', $objet, $id_objet, array('rang_lien>='.intval($qualif['rang_lien']), "$primary!=".intval($id))); |
|
| 852 | 852 | sql_update($table_lien, array('rang_lien'=>'rang_lien+1'), $w); |
| 853 | 853 | } |
| 854 | 854 | // tous les liens de même rôle recoivent le rang indiqué aussi |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | */ |
| 940 | 940 | function lien_propage_date_modif($objet, $ids) { |
| 941 | 941 | static $done = array(); |
| 942 | - $hash = md5($objet . serialize($ids)); |
|
| 942 | + $hash = md5($objet.serialize($ids)); |
|
| 943 | 943 | |
| 944 | 944 | // sql_updateq, peut être un rien lent. |
| 945 | 945 | // On évite de l'appeler 2 fois sur les mêmes choses |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | and isset($desc['field']['date_modif']) |
| 955 | 955 | ) { |
| 956 | 956 | $primary = id_table_objet($objet); |
| 957 | - $where = (is_array($ids) ? sql_in($primary, array_map('intval', $ids)) : "$primary=" . intval($ids)); |
|
| 957 | + $where = (is_array($ids) ? sql_in($primary, array_map('intval', $ids)) : "$primary=".intval($ids)); |
|
| 958 | 958 | sql_updateq($table, array('date_modif' => date('Y-m-d H:i:s')), $where); |
| 959 | 959 | } |
| 960 | 960 | |