@@ -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 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $md5args = md5($arguments); |
| 71 | 71 | |
| 72 | 72 | // si pas de date programee, des que possible |
| 73 | - $duplicate_where = 'status=' . intval(_JQ_SCHEDULED) . ' AND '; |
|
| 73 | + $duplicate_where = 'status='.intval(_JQ_SCHEDULED).' AND '; |
|
| 74 | 74 | if (!$time) { |
| 75 | 75 | $time = time(); |
| 76 | 76 | $duplicate_where = ""; // ne pas dupliquer si deja le meme job en cours d'execution |
@@ -94,9 +94,8 @@ discard block |
||
| 94 | 94 | and |
| 95 | 95 | $id_job = sql_getfetsel('id_job', 'spip_jobs', |
| 96 | 96 | $duplicate_where = |
| 97 | - $duplicate_where . 'fonction=' . sql_quote($function) |
|
| 98 | - . (($no_duplicate === 'function_only') ? '' : |
|
| 99 | - ' AND md5args=' . sql_quote($md5args) . ' AND inclure=' . sql_quote($file))) |
|
| 97 | + $duplicate_where.'fonction='.sql_quote($function) |
|
| 98 | + . (($no_duplicate === 'function_only') ? '' : ' AND md5args='.sql_quote($md5args).' AND inclure='.sql_quote($file))) |
|
| 100 | 99 | ) { |
| 101 | 100 | return $id_job; |
| 102 | 101 | } |
@@ -108,9 +107,9 @@ discard block |
||
| 108 | 107 | if ( |
| 109 | 108 | $no_duplicate |
| 110 | 109 | and |
| 111 | - $id_prev = sql_getfetsel('id_job', 'spip_jobs', "id_job<" . intval($id_job) . " AND $duplicate_where") |
|
| 110 | + $id_prev = sql_getfetsel('id_job', 'spip_jobs', "id_job<".intval($id_job)." AND $duplicate_where") |
|
| 112 | 111 | ) { |
| 113 | - sql_delete('spip_jobs', 'id_job=' . intval($id_job)); |
|
| 112 | + sql_delete('spip_jobs', 'id_job='.intval($id_job)); |
|
| 114 | 113 | |
| 115 | 114 | return $id_prev; |
| 116 | 115 | } |
@@ -122,9 +121,9 @@ discard block |
||
| 122 | 121 | // ie cas d'un char non acceptables sur certains type de champs |
| 123 | 122 | // qui coupe la valeur |
| 124 | 123 | if (defined('_JQ_INSERT_CHECK_ARGS') and $id_job) { |
| 125 | - $args = sql_getfetsel('args', 'spip_jobs', 'id_job=' . intval($id_job)); |
|
| 124 | + $args = sql_getfetsel('args', 'spip_jobs', 'id_job='.intval($id_job)); |
|
| 126 | 125 | if ($args !== $arguments) { |
| 127 | - spip_log('arguments job errones / longueur ' . strlen($args) . " vs " . strlen($arguments) . ' / valeur : ' . var_export($arguments, |
|
| 126 | + spip_log('arguments job errones / longueur '.strlen($args)." vs ".strlen($arguments).' / valeur : '.var_export($arguments, |
|
| 128 | 127 | true), 'queue'); |
| 129 | 128 | } |
| 130 | 129 | } |
@@ -152,7 +151,7 @@ discard block |
||
| 152 | 151 | function queue_purger() { |
| 153 | 152 | include_spip('base/abstract_sql'); |
| 154 | 153 | sql_delete('spip_jobs'); |
| 155 | - sql_delete("spip_jobs_liens", "id_job NOT IN (" . sql_get_select("id_job", "spip_jobs") . ")"); |
|
| 154 | + sql_delete("spip_jobs_liens", "id_job NOT IN (".sql_get_select("id_job", "spip_jobs").")"); |
|
| 156 | 155 | include_spip('inc/genie'); |
| 157 | 156 | genie_queue_watch_dist(); |
| 158 | 157 | } |
@@ -167,8 +166,8 @@ discard block |
||
| 167 | 166 | function queue_remove_job($id_job) { |
| 168 | 167 | include_spip('base/abstract_sql'); |
| 169 | 168 | |
| 170 | - if ($row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job=' . intval($id_job)) |
|
| 171 | - and $res = sql_delete('spip_jobs', 'id_job=' . intval($id_job)) |
|
| 169 | + if ($row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job='.intval($id_job)) |
|
| 170 | + and $res = sql_delete('spip_jobs', 'id_job='.intval($id_job)) |
|
| 172 | 171 | ) { |
| 173 | 172 | queue_unlink_job($id_job); |
| 174 | 173 | // est-ce une tache cron qu'il faut relancer ? |
@@ -217,7 +216,7 @@ discard block |
||
| 217 | 216 | * resultat du sql_delete |
| 218 | 217 | */ |
| 219 | 218 | function queue_unlink_job($id_job) { |
| 220 | - return sql_delete("spip_jobs_liens", "id_job=" . intval($id_job)); |
|
| 219 | + return sql_delete("spip_jobs_liens", "id_job=".intval($id_job)); |
|
| 221 | 220 | } |
| 222 | 221 | |
| 223 | 222 | /** |
@@ -233,7 +232,7 @@ discard block |
||
| 233 | 232 | // deserialiser les arguments |
| 234 | 233 | $args = unserialize($row['args']); |
| 235 | 234 | if ($args === false) { |
| 236 | - spip_log('arguments job errones ' . var_export($row, true), 'queue'); |
|
| 235 | + spip_log('arguments job errones '.var_export($row, true), 'queue'); |
|
| 237 | 236 | $args = array(); |
| 238 | 237 | } |
| 239 | 238 | |
@@ -250,12 +249,12 @@ discard block |
||
| 250 | 249 | } |
| 251 | 250 | |
| 252 | 251 | if (!function_exists($fonction)) { |
| 253 | - spip_log("fonction $fonction ($inclure) inexistante " . var_export($row, true), 'queue'); |
|
| 252 | + spip_log("fonction $fonction ($inclure) inexistante ".var_export($row, true), 'queue'); |
|
| 254 | 253 | |
| 255 | 254 | return false; |
| 256 | 255 | } |
| 257 | 256 | |
| 258 | - spip_log("queue [" . $row['id_job'] . "]: $fonction() start", 'queue'); |
|
| 257 | + spip_log("queue [".$row['id_job']."]: $fonction() start", 'queue'); |
|
| 259 | 258 | switch (count($args)) { |
| 260 | 259 | case 0: |
| 261 | 260 | $res = $fonction(); |
@@ -295,7 +294,7 @@ discard block |
||
| 295 | 294 | # plus lent mais completement generique |
| 296 | 295 | $res = call_user_func_array($fonction, $args); |
| 297 | 296 | } |
| 298 | - spip_log("queue [" . $row['id_job'] . "]: $fonction() end", 'queue'); |
|
| 297 | + spip_log("queue [".$row['id_job']."]: $fonction() end", 'queue'); |
|
| 299 | 298 | |
| 300 | 299 | return $res; |
| 301 | 300 | |
@@ -327,14 +326,14 @@ discard block |
||
| 327 | 326 | function queue_schedule($force_jobs = null) { |
| 328 | 327 | $time = time(); |
| 329 | 328 | if (defined('_DEBUG_BLOCK_QUEUE')) { |
| 330 | - spip_log("_DEBUG_BLOCK_QUEUE : schedule stop", 'jq' . _LOG_DEBUG); |
|
| 329 | + spip_log("_DEBUG_BLOCK_QUEUE : schedule stop", 'jq'._LOG_DEBUG); |
|
| 331 | 330 | |
| 332 | 331 | return; |
| 333 | 332 | } |
| 334 | 333 | |
| 335 | 334 | // rien a faire si le prochain job est encore dans le futur |
| 336 | 335 | if (queue_sleep_time_to_next_job() > 0 and (!$force_jobs or !count($force_jobs))) { |
| 337 | - spip_log("queue_sleep_time_to_next_job", 'jq' . _LOG_DEBUG); |
|
| 336 | + spip_log("queue_sleep_time_to_next_job", 'jq'._LOG_DEBUG); |
|
| 338 | 337 | |
| 339 | 338 | return; |
| 340 | 339 | } |
@@ -355,7 +354,7 @@ discard block |
||
| 355 | 354 | } |
| 356 | 355 | $end_time = $time + _JQ_MAX_JOBS_TIME_TO_EXECUTE; |
| 357 | 356 | |
| 358 | - spip_log("JQ schedule $time / $end_time", 'jq' . _LOG_DEBUG); |
|
| 357 | + spip_log("JQ schedule $time / $end_time", 'jq'._LOG_DEBUG); |
|
| 359 | 358 | |
| 360 | 359 | if (!defined('_JQ_MAX_JOBS_EXECUTE')) { |
| 361 | 360 | define('_JQ_MAX_JOBS_EXECUTE', 200); |
@@ -369,19 +368,19 @@ discard block |
||
| 369 | 368 | // lorsqu'un job cron n'a pas fini, sa priorite est descendue |
| 370 | 369 | // pour qu'il ne bloque pas les autres jobs en attente |
| 371 | 370 | if (is_array($force_jobs) and count($force_jobs)) { |
| 372 | - $cond = "status=" . intval(_JQ_SCHEDULED) . " AND " . sql_in("id_job", $force_jobs); |
|
| 371 | + $cond = "status=".intval(_JQ_SCHEDULED)." AND ".sql_in("id_job", $force_jobs); |
|
| 373 | 372 | } else { |
| 374 | 373 | $now = date('Y-m-d H:i:s', $time); |
| 375 | - $cond = "status=" . intval(_JQ_SCHEDULED) . " AND date<=" . sql_quote($now); |
|
| 374 | + $cond = "status=".intval(_JQ_SCHEDULED)." AND date<=".sql_quote($now); |
|
| 376 | 375 | } |
| 377 | 376 | |
| 378 | 377 | register_shutdown_function('queue_error_handler'); // recuperer les erreurs auant que possible |
| 379 | - $res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,' . (_JQ_MAX_JOBS_EXECUTE + 1)); |
|
| 378 | + $res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,'.(_JQ_MAX_JOBS_EXECUTE + 1)); |
|
| 380 | 379 | do { |
| 381 | 380 | if ($row = array_shift($res)) { |
| 382 | 381 | $nbj++; |
| 383 | 382 | // il faut un verrou, a base de sql_delete |
| 384 | - if (sql_delete('spip_jobs', "id_job=" . intval($row['id_job']) . " AND status=" . intval(_JQ_SCHEDULED))) { |
|
| 383 | + if (sql_delete('spip_jobs', "id_job=".intval($row['id_job'])." AND status=".intval(_JQ_SCHEDULED))) { |
|
| 385 | 384 | #spip_log("JQ schedule job ".$nbj." OK",'jq'); |
| 386 | 385 | // on reinsert dans la base aussitot avec un status=_JQ_PENDING |
| 387 | 386 | $row['status'] = _JQ_PENDING; |
@@ -396,13 +395,13 @@ discard block |
||
| 396 | 395 | queue_close_job($row, $time, $result); |
| 397 | 396 | } |
| 398 | 397 | } |
| 399 | - spip_log("JQ schedule job end time " . $time, 'jq' . _LOG_DEBUG); |
|
| 398 | + spip_log("JQ schedule job end time ".$time, 'jq'._LOG_DEBUG); |
|
| 400 | 399 | } while ($nbj < _JQ_MAX_JOBS_EXECUTE and $row and $time < $end_time); |
| 401 | - spip_log("JQ schedule end time " . time(), 'jq' . _LOG_DEBUG); |
|
| 400 | + spip_log("JQ schedule end time ".time(), 'jq'._LOG_DEBUG); |
|
| 402 | 401 | |
| 403 | 402 | if ($row = array_shift($res)) { |
| 404 | 403 | queue_update_next_job_time(0); // on sait qu'il y a encore des jobs a lancer ASAP |
| 405 | - spip_log("JQ encore !", 'jq' . _LOG_DEBUG); |
|
| 404 | + spip_log("JQ encore !", 'jq'._LOG_DEBUG); |
|
| 406 | 405 | } else { |
| 407 | 406 | queue_update_next_job_time(); |
| 408 | 407 | } |
@@ -438,9 +437,9 @@ discard block |
||
| 438 | 437 | } |
| 439 | 438 | } |
| 440 | 439 | // purger ses liens eventuels avec des objets |
| 441 | - sql_delete("spip_jobs_liens", "id_job=" . intval($row['id_job'])); |
|
| 440 | + sql_delete("spip_jobs_liens", "id_job=".intval($row['id_job'])); |
|
| 442 | 441 | // supprimer le job fini |
| 443 | - sql_delete('spip_jobs', 'id_job=' . intval($row['id_job'])); |
|
| 442 | + sql_delete('spip_jobs', 'id_job='.intval($row['id_job'])); |
|
| 444 | 443 | } |
| 445 | 444 | |
| 446 | 445 | /** |
@@ -511,17 +510,17 @@ discard block |
||
| 511 | 510 | // traiter les jobs morts au combat (_JQ_PENDING depuis plus de 180s) |
| 512 | 511 | // pour cause de timeout ou autre erreur fatale |
| 513 | 512 | $res = sql_allfetsel("*", "spip_jobs", |
| 514 | - "status=" . intval(_JQ_PENDING) . " AND date<" . sql_quote(date('Y-m-d H:i:s', $time - 180))); |
|
| 513 | + "status=".intval(_JQ_PENDING)." AND date<".sql_quote(date('Y-m-d H:i:s', $time - 180))); |
|
| 515 | 514 | if (is_array($res)) { |
| 516 | 515 | foreach ($res as $row) { |
| 517 | 516 | queue_close_job($row, $time); |
| 518 | - spip_log ("queue_close_job car _JQ_PENDING depuis +180s : ".print_r($row,1), "job_mort"._LOG_ERREUR); |
|
| 517 | + spip_log("queue_close_job car _JQ_PENDING depuis +180s : ".print_r($row, 1), "job_mort"._LOG_ERREUR); |
|
| 519 | 518 | } |
| 520 | 519 | } |
| 521 | 520 | |
| 522 | 521 | // chercher la date du prochain job si pas connu |
| 523 | 522 | if (is_null($next) or is_null(queue_sleep_time_to_next_job())) { |
| 524 | - $date = sql_getfetsel('date', 'spip_jobs', "status=" . intval(_JQ_SCHEDULED), '', 'date', '0,1'); |
|
| 523 | + $date = sql_getfetsel('date', 'spip_jobs', "status=".intval(_JQ_SCHEDULED), '', 'date', '0,1'); |
|
| 525 | 524 | $next = strtotime($date); |
| 526 | 525 | } |
| 527 | 526 | if (!is_null($next_time)) { |
@@ -533,7 +532,7 @@ discard block |
||
| 533 | 532 | if ($next) { |
| 534 | 533 | if (is_null($nb_jobs_scheduled)) { |
| 535 | 534 | $nb_jobs_scheduled = sql_countsel('spip_jobs', |
| 536 | - "status=" . intval(_JQ_SCHEDULED) . " AND date<" . sql_quote(date('Y-m-d H:i:s', $time))); |
|
| 535 | + "status=".intval(_JQ_SCHEDULED)." AND date<".sql_quote(date('Y-m-d H:i:s', $time))); |
|
| 537 | 536 | } elseif ($next <= $time) { |
| 538 | 537 | $nb_jobs_scheduled++; |
| 539 | 538 | } |
@@ -601,7 +600,7 @@ discard block |
||
| 601 | 600 | } |
| 602 | 601 | |
| 603 | 602 | // ne pas relancer si on vient de lancer dans la meme seconde par un hit concurent |
| 604 | - if (file_exists($lock = _DIR_TMP . "cron.lock") and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) { |
|
| 603 | + if (file_exists($lock = _DIR_TMP."cron.lock") and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) { |
|
| 605 | 604 | return $texte; |
| 606 | 605 | } |
| 607 | 606 | |
@@ -672,20 +671,20 @@ discard block |
||
| 672 | 671 | $scheme = ''; |
| 673 | 672 | $port = 80; |
| 674 | 673 | } |
| 675 | - $fp = @fsockopen($scheme . $parts['host'], |
|
| 674 | + $fp = @fsockopen($scheme.$parts['host'], |
|
| 676 | 675 | isset($parts['port']) ? $parts['port'] : $port, |
| 677 | 676 | $errno, $errstr, 1); |
| 678 | 677 | |
| 679 | 678 | if ($fp) { |
| 680 | 679 | $host_sent = $parts['host']; |
| 681 | 680 | if (isset($parts['port']) and $parts['port'] !== $port) { |
| 682 | - $host_sent .= ':' . $parts['port']; |
|
| 681 | + $host_sent .= ':'.$parts['port']; |
|
| 683 | 682 | } |
| 684 | 683 | $timeout = 200; // ms |
| 685 | 684 | stream_set_timeout($fp, 0, $timeout * 1000); |
| 686 | - $query = $parts['path'] . ($parts['query'] ? "?" . $parts['query'] : ""); |
|
| 687 | - $out = "GET " . $query . " HTTP/1.1\r\n"; |
|
| 688 | - $out .= "Host: " . $host_sent . "\r\n"; |
|
| 685 | + $query = $parts['path'].($parts['query'] ? "?".$parts['query'] : ""); |
|
| 686 | + $out = "GET ".$query." HTTP/1.1\r\n"; |
|
| 687 | + $out .= "Host: ".$host_sent."\r\n"; |
|
| 689 | 688 | $out .= "Connection: Close\r\n\r\n"; |
| 690 | 689 | fwrite($fp, $out); |
| 691 | 690 | spip_timer('read'); |
@@ -26,11 +26,10 @@ discard block |
||
| 26 | 26 | $postaff = decompiler_($struct->postaff, $fmt, $prof); |
| 27 | 27 | |
| 28 | 28 | $type = $struct->sql_serveur ? "$struct->sql_serveur:" : ''; |
| 29 | - $type .= ($struct->type_requete ? $struct->type_requete : |
|
| 30 | - $struct->table_optionnelle); |
|
| 29 | + $type .= ($struct->type_requete ? $struct->type_requete : $struct->table_optionnelle); |
|
| 31 | 30 | |
| 32 | 31 | if ($struct->jointures_explicites) { |
| 33 | - $type .= " " . $struct->jointures_explicites; |
|
| 32 | + $type .= " ".$struct->jointures_explicites; |
|
| 34 | 33 | } |
| 35 | 34 | if ($struct->table_optionnelle) { |
| 36 | 35 | $type .= "?"; |
@@ -39,11 +38,11 @@ discard block |
||
| 39 | 38 | |
| 40 | 39 | $crit = $struct->param; |
| 41 | 40 | if ($crit and !is_array($crit[0])) { |
| 42 | - $type = strtolower($type) . array_shift($crit); |
|
| 41 | + $type = strtolower($type).array_shift($crit); |
|
| 43 | 42 | } |
| 44 | 43 | $crit = decompiler_criteres($struct, $fmt, $prof); |
| 45 | 44 | |
| 46 | - $f = 'format_boucle_' . $fmt; |
|
| 45 | + $f = 'format_boucle_'.$fmt; |
|
| 47 | 46 | |
| 48 | 47 | return $f($preaff, $avant, $nom, $type, $crit, $milieu, $apres, $altern, $postaff, $prof); |
| 49 | 48 | } |
@@ -56,21 +55,20 @@ discard block |
||
| 56 | 55 | $res[] = decompiler_($v, $fmt, $prof); |
| 57 | 56 | } |
| 58 | 57 | } |
| 59 | - $file = is_string($struct->texte) ? $struct->texte : |
|
| 60 | - decompiler_($struct->texte, $fmt, $prof); |
|
| 61 | - $f = 'format_inclure_' . $fmt; |
|
| 58 | + $file = is_string($struct->texte) ? $struct->texte : decompiler_($struct->texte, $fmt, $prof); |
|
| 59 | + $f = 'format_inclure_'.$fmt; |
|
| 62 | 60 | |
| 63 | 61 | return $f($file, $res, $prof); |
| 64 | 62 | } |
| 65 | 63 | |
| 66 | 64 | function decompiler_texte($struct, $fmt = '', $prof = 0) { |
| 67 | - $f = 'format_texte_' . $fmt; |
|
| 65 | + $f = 'format_texte_'.$fmt; |
|
| 68 | 66 | |
| 69 | 67 | return strlen($struct->texte) ? $f($struct->texte, $prof) : ''; |
| 70 | 68 | } |
| 71 | 69 | |
| 72 | 70 | function decompiler_polyglotte($struct, $fmt = '', $prof = 0) { |
| 73 | - $f = 'format_polyglotte_' . $fmt; |
|
| 71 | + $f = 'format_polyglotte_'.$fmt; |
|
| 74 | 72 | |
| 75 | 73 | return $f($struct->traductions, $prof); |
| 76 | 74 | } |
@@ -83,7 +81,7 @@ discard block |
||
| 83 | 81 | |
| 84 | 82 | $filtres = decompiler_liste($struct->param, $fmt, $prof); |
| 85 | 83 | |
| 86 | - $f = 'format_idiome_' . $fmt; |
|
| 84 | + $f = 'format_idiome_'.$fmt; |
|
| 87 | 85 | |
| 88 | 86 | return $f($struct->nom_champ, $struct->module, $args, $filtres, $prof); |
| 89 | 87 | } |
@@ -98,7 +96,7 @@ discard block |
||
| 98 | 96 | } |
| 99 | 97 | $filtres = decompiler_liste($p, $fmt, $prof); |
| 100 | 98 | } |
| 101 | - $f = 'format_champ_' . $fmt; |
|
| 99 | + $f = 'format_champ_'.$fmt; |
|
| 102 | 100 | |
| 103 | 101 | return $f($struct->nom_champ, $struct->nom_boucle, $struct->etoile, $avant, $apres, $args, $filtres, $prof); |
| 104 | 102 | } |
@@ -107,7 +105,7 @@ discard block |
||
| 107 | 105 | if (!is_array($sources)) { |
| 108 | 106 | return ''; |
| 109 | 107 | } |
| 110 | - $f = 'format_liste_' . $fmt; |
|
| 108 | + $f = 'format_liste_'.$fmt; |
|
| 111 | 109 | $res = ''; |
| 112 | 110 | foreach ($sources as $arg) { |
| 113 | 111 | if (!is_array($arg)) { |
@@ -123,7 +121,7 @@ discard block |
||
| 123 | 121 | and (strlen($v[0]->apres) == 1) |
| 124 | 122 | and $v[0]->apres == $v[0]->avant |
| 125 | 123 | ) { |
| 126 | - $args[] = $v[0]->avant . $v[0]->texte . $v[0]->apres; |
|
| 124 | + $args[] = $v[0]->avant.$v[0]->texte.$v[0]->apres; |
|
| 127 | 125 | } else { |
| 128 | 126 | $args[] = decompiler_($v, $fmt, 0 - $prof); |
| 129 | 127 | } |
@@ -146,7 +144,7 @@ discard block |
||
| 146 | 144 | return ''; |
| 147 | 145 | } |
| 148 | 146 | $res = ''; |
| 149 | - $f = 'format_critere_' . $fmt; |
|
| 147 | + $f = 'format_critere_'.$fmt; |
|
| 150 | 148 | foreach ($sources as $crit) { |
| 151 | 149 | if (!is_array($crit)) { |
| 152 | 150 | continue; |
@@ -158,12 +156,12 @@ discard block |
||
| 158 | 156 | and $v[0]->type == 'texte' |
| 159 | 157 | and $v[0]->apres |
| 160 | 158 | ) { |
| 161 | - $args[] = array(array('texte', ($v[0]->apres . $v[0]->texte . $v[0]->apres))); |
|
| 159 | + $args[] = array(array('texte', ($v[0]->apres.$v[0]->texte.$v[0]->apres))); |
|
| 162 | 160 | } else { |
| 163 | 161 | $res2 = array(); |
| 164 | 162 | foreach ($v as $k => $p) { |
| 165 | 163 | if (isset($p->type) |
| 166 | - and function_exists($d = 'decompiler_' . $p->type) |
|
| 164 | + and function_exists($d = 'decompiler_'.$p->type) |
|
| 167 | 165 | ) { |
| 168 | 166 | $r = $d($p, $fmt, (0 - $prof), @$v[$k + 1]); |
| 169 | 167 | $res2[] = array($p->type, $r); |
@@ -191,7 +189,7 @@ discard block |
||
| 191 | 189 | if (!isset($p->type)) { |
| 192 | 190 | continue; |
| 193 | 191 | } #?????? |
| 194 | - $d = 'decompiler_' . $p->type; |
|
| 192 | + $d = 'decompiler_'.$p->type; |
|
| 195 | 193 | $next = isset($liste[$k + 1]) ? $liste[$k + 1] : false; |
| 196 | 194 | // Forcer le champ etendu si son source (pas les reecritures) |
| 197 | 195 | // contenait des args et s'il est suivi d'espaces, |
@@ -216,16 +214,16 @@ discard block |
||
| 216 | 214 | $contenu[] = array($d($p, $fmt, $prof2), $p->type); |
| 217 | 215 | |
| 218 | 216 | } |
| 219 | - $f = 'format_suite_' . $fmt; |
|
| 217 | + $f = 'format_suite_'.$fmt; |
|
| 220 | 218 | |
| 221 | 219 | return $f($contenu); |
| 222 | 220 | } |
| 223 | 221 | |
| 224 | 222 | function public_decompiler($liste, $fmt = '', $prof = 0, $quoi = '') { |
| 225 | - if (!include_spip('public/format_' . $fmt)) { |
|
| 223 | + if (!include_spip('public/format_'.$fmt)) { |
|
| 226 | 224 | return "'$fmt'?"; |
| 227 | 225 | } |
| 228 | - $f = 'decompiler_' . $quoi; |
|
| 226 | + $f = 'decompiler_'.$quoi; |
|
| 229 | 227 | |
| 230 | 228 | return $f($liste, $fmt, $prof); |
| 231 | 229 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | // On reexecute pour deboucher sur le include public. |
| 27 | 27 | // autrement on insiste |
| 28 | 28 | if (is_array($var_auth)) { |
| 29 | - $var_auth = '../?' . $_SERVER['QUERY_STRING']; |
|
| 29 | + $var_auth = '../?'.$_SERVER['QUERY_STRING']; |
|
| 30 | 30 | spip_setcookie('spip_session', $_COOKIE['spip_session'], [ |
| 31 | 31 | 'expires' => time() + 3600 * 24 * 14 |
| 32 | 32 | ]); |
@@ -82,19 +82,19 @@ discard block |
||
| 82 | 82 | spip_log("supprimer sessions auteur $id_auteur", "session"); |
| 83 | 83 | if ($toutes or $id_auteur !== $GLOBALS['visiteur_session']['id_auteur']) { |
| 84 | 84 | if ($dir = opendir(_DIR_SESSIONS)) { |
| 85 | - $t = $_SERVER['REQUEST_TIME'] - (4*_RENOUVELLE_ALEA); // 48h par defaut |
|
| 86 | - $t_short = $_SERVER['REQUEST_TIME'] - max(_RENOUVELLE_ALEA/4,3*3600); // 3h par defaut |
|
| 85 | + $t = $_SERVER['REQUEST_TIME'] - (4 * _RENOUVELLE_ALEA); // 48h par defaut |
|
| 86 | + $t_short = $_SERVER['REQUEST_TIME'] - max(_RENOUVELLE_ALEA / 4, 3 * 3600); // 3h par defaut |
|
| 87 | 87 | $t = time() - (4 * _RENOUVELLE_ALEA); |
| 88 | 88 | while (($f = readdir($dir)) !== false) { |
| 89 | 89 | $nb_files++; |
| 90 | 90 | if (preg_match(",^[^\d-]*(-?\d+)_\w{32}\.php[3]?$,", $f, $regs)) { |
| 91 | - $f = _DIR_SESSIONS . $f; |
|
| 91 | + $f = _DIR_SESSIONS.$f; |
|
| 92 | 92 | if (($actives and $regs[1] == $id_auteur) or ($t > filemtime($f))) { |
| 93 | 93 | spip_unlink($f); |
| 94 | 94 | } |
| 95 | 95 | // si il y a trop de sessions ouvertes, on purge les sessions anonymes de plus de 3H |
| 96 | 96 | // cf http://core.spip.org/issues/3276 |
| 97 | - elseif ($nb_files>$nb_max_files and !intval($regs[1]) and ($t_short > filemtime($f))) { |
|
| 97 | + elseif ($nb_files > $nb_max_files and !intval($regs[1]) and ($t_short > filemtime($f))) { |
|
| 98 | 98 | spip_unlink($f); |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -170,9 +170,9 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if (!isset($_COOKIE['spip_session']) |
| 173 | - or !preg_match(',^' . $id_auteur . '_,', $_COOKIE['spip_session']) |
|
| 173 | + or !preg_match(',^'.$id_auteur.'_,', $_COOKIE['spip_session']) |
|
| 174 | 174 | ) { |
| 175 | - $_COOKIE['spip_session'] = $id_auteur . '_' . md5(uniqid(rand(), true)); |
|
| 175 | + $_COOKIE['spip_session'] = $id_auteur.'_'.md5(uniqid(rand(), true)); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | // Maintenant on sait qu'on a des choses à écrire |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | } else { |
| 204 | 204 | $fichier_session = fichier_session('alea_ephemere'); |
| 205 | 205 | if (!ecrire_fichier_session($fichier_session, $auteur)) { |
| 206 | - spip_log('Echec ecriture fichier session ' . $fichier_session, "session" . _LOG_HS); |
|
| 206 | + spip_log('Echec ecriture fichier session '.$fichier_session, "session"._LOG_HS); |
|
| 207 | 207 | include_spip('inc/minipres'); |
| 208 | 208 | echo minipres(); |
| 209 | 209 | exit; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | // poser le cookie de session SPIP |
| 217 | 217 | include_spip('inc/cookie'); |
| 218 | 218 | $duree = definir_duree_cookie_session($auteur); |
| 219 | - spip_setcookie( 'spip_session', $_COOKIE['spip_session'], [ |
|
| 219 | + spip_setcookie('spip_session', $_COOKIE['spip_session'], [ |
|
| 220 | 220 | 'expires' => time() + $duree |
| 221 | 221 | ]); |
| 222 | 222 | spip_log("ajoute session $fichier_session cookie $duree", "session"); |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | if (!function_exists('autoriser')) { |
| 226 | 226 | include_spip('inc/autoriser'); |
| 227 | 227 | } |
| 228 | - if (autoriser('ecrire','','',$auteur) and _DUREE_COOKIE_ADMIN) { |
|
| 229 | - spip_setcookie('spip_admin', '@' . ($auteur['email'] ?: $auteur['login']), [ |
|
| 228 | + if (autoriser('ecrire', '', '', $auteur) and _DUREE_COOKIE_ADMIN) { |
|
| 229 | + spip_setcookie('spip_admin', '@'.($auteur['email'] ?: $auteur['login']), [ |
|
| 230 | 230 | 'expires' => time() + max(_DUREE_COOKIE_ADMIN, $duree) |
| 231 | 231 | ]); |
| 232 | 232 | } // sinon le supprimer ... |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $coef = 20; |
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | - return (int)(_RENOUVELLE_ALEA * $coef); |
|
| 270 | + return (int) (_RENOUVELLE_ALEA * $coef); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | // Renouveler la session avec l'alea courant |
| 317 | 317 | include($fichier_session); |
| 318 | - spip_log('renouvelle session ' . $GLOBALS['visiteur_session']['id_auteur'], "session"); |
|
| 318 | + spip_log('renouvelle session '.$GLOBALS['visiteur_session']['id_auteur'], "session"); |
|
| 319 | 319 | spip_unlink($fichier_session); |
| 320 | 320 | ajouter_session($GLOBALS['visiteur_session']); |
| 321 | 321 | } |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | } |
| 348 | 348 | } else { |
| 349 | 349 | if ($change) { |
| 350 | - spip_log("rejoue session $fichier_session " . $_COOKIE['spip_session'], "session"); |
|
| 350 | + spip_log("rejoue session $fichier_session ".$_COOKIE['spip_session'], "session"); |
|
| 351 | 351 | if ($fichier_session) { |
| 352 | 352 | spip_unlink($fichier_session); |
| 353 | 353 | } |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | // liste des sessions |
| 566 | - $sessions = preg_files(_DIR_SESSIONS, '/' . $id_auteur . '_.*\.php$'); |
|
| 566 | + $sessions = preg_files(_DIR_SESSIONS, '/'.$id_auteur.'_.*\.php$'); |
|
| 567 | 567 | |
| 568 | 568 | // si on en a plus que la limite, supprimer les plus vieilles |
| 569 | 569 | // si ce ne sont pas des sessions anonymes car elles sont alors chacune differentes |
@@ -642,12 +642,12 @@ discard block |
||
| 642 | 642 | $auteur = preparer_ecriture_session($auteur); |
| 643 | 643 | |
| 644 | 644 | // enregistrer les autres donnees du visiteur |
| 645 | - $texte = "<" . "?php\n"; |
|
| 645 | + $texte = "<"."?php\n"; |
|
| 646 | 646 | foreach ($auteur as $var => $val) { |
| 647 | - $texte .= '$GLOBALS[\'visiteur_session\'][' . var_export($var, true) . '] = ' |
|
| 648 | - . var_export($val, true) . ";\n"; |
|
| 647 | + $texte .= '$GLOBALS[\'visiteur_session\']['.var_export($var, true).'] = ' |
|
| 648 | + . var_export($val, true).";\n"; |
|
| 649 | 649 | } |
| 650 | - $texte .= "?" . ">\n"; |
|
| 650 | + $texte .= "?".">\n"; |
|
| 651 | 651 | |
| 652 | 652 | return ecrire_fichier($fichier, $texte); |
| 653 | 653 | } |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | $repertoire = sous_repertoire(_DIR_SESSIONS, '', false, $tantpis); |
| 678 | 678 | $c = $_COOKIE['spip_session']; |
| 679 | 679 | |
| 680 | - return $repertoire . intval($c) . '_' . md5($c . ' ' . $GLOBALS['meta'][$alea]) . '.php'; |
|
| 680 | + return $repertoire.intval($c).'_'.md5($c.' '.$GLOBALS['meta'][$alea]).'.php'; |
|
| 681 | 681 | } |
| 682 | 682 | } |
| 683 | 683 | |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | * @return string |
| 696 | 696 | */ |
| 697 | 697 | function rejouer_session() { |
| 698 | - return '<img src="' . generer_url_action('cookie', 'change_session=oui', true) . '" width="0" height="0" alt="" />'; |
|
| 698 | + return '<img src="'.generer_url_action('cookie', 'change_session=oui', true).'" width="0" height="0" alt="" />'; |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | return $res; |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | - return $res = md5($GLOBALS['ip'] . (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '')); |
|
| 713 | + return $res = md5($GLOBALS['ip'].(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '')); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | |