@@ -21,7 +21,7 @@ |
||
| 21 | 21 | trigger_deprecation( |
| 22 | 22 | 'spip', |
| 23 | 23 | '5.0', |
| 24 | - 'La fonction inc_log_dist() est déprécée.' . |
|
| 24 | + 'La fonction inc_log_dist() est déprécée.'. |
|
| 25 | 25 | ' Utilisez spip_logger() à la place.' |
| 26 | 26 | ); |
| 27 | 27 | static $pre = [ |
@@ -81,12 +81,12 @@ discard block |
||
| 81 | 81 | spip_logger('session')->info("supprimer sessions auteur $id_auteur"); |
| 82 | 82 | if ($toutes || $id_auteur !== $GLOBALS['visiteur_session']['id_auteur']) { |
| 83 | 83 | if ($dir = opendir(_DIR_SESSIONS)) { |
| 84 | - $t = $_SERVER['REQUEST_TIME'] - (4 * _RENOUVELLE_ALEA); // 48h par defaut |
|
| 85 | - $t_short = $_SERVER['REQUEST_TIME'] - max(_RENOUVELLE_ALEA / 4, 3 * 3600); // 3h par defaut |
|
| 84 | + $t = $_SERVER['REQUEST_TIME'] - (4 * _RENOUVELLE_ALEA); // 48h par defaut |
|
| 85 | + $t_short = $_SERVER['REQUEST_TIME'] - max(_RENOUVELLE_ALEA / 4, 3 * 3600); // 3h par defaut |
|
| 86 | 86 | while (($f = readdir($dir)) !== false) { |
| 87 | 87 | $nb_files++; |
| 88 | 88 | if (preg_match(',^[^\d-]*(-?\d+)_\w{32}\.php[3]?$,', $f, $regs)) { |
| 89 | - $f = _DIR_SESSIONS . $f; |
|
| 89 | + $f = _DIR_SESSIONS.$f; |
|
| 90 | 90 | if ($actives && $regs[1] == $id_auteur || $t > filemtime($f)) { |
| 91 | 91 | spip_unlink($f); |
| 92 | 92 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | (!$cookie = lire_cookie_session()) |
| 174 | 174 | || intval($cookie) !== $id_auteur |
| 175 | 175 | ) { |
| 176 | - $cookie = $id_auteur . '_' . md5(uniqid(random_int(0, mt_getrandmax()), true)); |
|
| 176 | + $cookie = $id_auteur.'_'.md5(uniqid(random_int(0, mt_getrandmax()), true)); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // Maintenant on sait qu'on a des choses à écrire |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | } else { |
| 207 | 207 | $fichier_session = chemin_fichier_session('alea_ephemere', $cookie); |
| 208 | 208 | if (!ecrire_fichier_session($fichier_session, $auteur)) { |
| 209 | - spip_logger('session')->emergency('Echec ecriture fichier session ' . $fichier_session); |
|
| 209 | + spip_logger('session')->emergency('Echec ecriture fichier session '.$fichier_session); |
|
| 210 | 210 | include_spip('inc/minipres'); |
| 211 | 211 | echo minipres(); |
| 212 | 212 | exit; |
@@ -229,9 +229,9 @@ discard block |
||
| 229 | 229 | if (autoriser('ecrire', '', '', $auteur) && _DUREE_COOKIE_ADMIN) { |
| 230 | 230 | spip_setcookie( |
| 231 | 231 | 'spip_admin', |
| 232 | - '@' . ($auteur['email'] ?: $auteur['login']), |
|
| 232 | + '@'.($auteur['email'] ?: $auteur['login']), |
|
| 233 | 233 | time() + max(_DUREE_COOKIE_ADMIN, $duree), |
| 234 | - httponly: true |
|
| 234 | + httponly : true |
|
| 235 | 235 | ); |
| 236 | 236 | } else { |
| 237 | 237 | // sinon le supprimer ... |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $coef = 20; |
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | - return (int)(_RENOUVELLE_ALEA * $coef); |
|
| 272 | + return (int) (_RENOUVELLE_ALEA * $coef); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | |
| 382 | 382 | // Renouveler la session avec l'alea courant |
| 383 | 383 | include($fichier_session); |
| 384 | - spip_logger('session')->info('renouvelle session ' . $GLOBALS['visiteur_session']['id_auteur']); |
|
| 384 | + spip_logger('session')->info('renouvelle session '.$GLOBALS['visiteur_session']['id_auteur']); |
|
| 385 | 385 | spip_unlink($fichier_session); |
| 386 | 386 | ajouter_session($GLOBALS['visiteur_session']); |
| 387 | 387 | } |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | // liste des sessions |
| 633 | - $sessions = preg_files(_DIR_SESSIONS, '/' . $id_auteur . '_.*\.php$'); |
|
| 633 | + $sessions = preg_files(_DIR_SESSIONS, '/'.$id_auteur.'_.*\.php$'); |
|
| 634 | 634 | |
| 635 | 635 | // si on en a plus que la limite, supprimer les plus vieilles |
| 636 | 636 | // si ce ne sont pas des sessions anonymes car elles sont alors chacune differentes |
@@ -708,12 +708,12 @@ discard block |
||
| 708 | 708 | $auteur = preparer_ecriture_session($auteur); |
| 709 | 709 | |
| 710 | 710 | // enregistrer les autres donnees du visiteur |
| 711 | - $texte = '<' . "?php\n"; |
|
| 711 | + $texte = '<'."?php\n"; |
|
| 712 | 712 | foreach ($auteur as $var => $val) { |
| 713 | - $texte .= '$GLOBALS[\'visiteur_session\'][' . var_export($var, true) . '] = ' |
|
| 714 | - . var_export($val, true) . ";\n"; |
|
| 713 | + $texte .= '$GLOBALS[\'visiteur_session\']['.var_export($var, true).'] = ' |
|
| 714 | + . var_export($val, true).";\n"; |
|
| 715 | 715 | } |
| 716 | - $texte .= '?' . ">\n"; |
|
| 716 | + $texte .= '?'.">\n"; |
|
| 717 | 717 | |
| 718 | 718 | return ecrire_fichier($fichier, $texte); |
| 719 | 719 | } |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | |
| 738 | 738 | $repertoire = sous_repertoire(_DIR_SESSIONS, '', false, $tantpis); |
| 739 | 739 | $id_auteur = intval($cookie_session); |
| 740 | - return $repertoire . $id_auteur . '_' . md5($cookie_session . ' ' . $GLOBALS['meta'][$alea]) . '.php'; |
|
| 740 | + return $repertoire.$id_auteur.'_'.md5($cookie_session.' '.$GLOBALS['meta'][$alea]).'.php'; |
|
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | /** |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | * @return string |
| 766 | 766 | */ |
| 767 | 767 | function rejouer_session() { |
| 768 | - return '<img src="' . generer_url_action('cookie', 'change_session=oui', true) . '" width="0" height="0" alt="" />'; |
|
| 768 | + return '<img src="'.generer_url_action('cookie', 'change_session=oui', true).'" width="0" height="0" alt="" />'; |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | return $res; |
| 781 | 781 | } |
| 782 | 782 | |
| 783 | - return $res = md5($GLOBALS['ip'] . ($_SERVER['HTTP_USER_AGENT'] ?? '')); |
|
| 783 | + return $res = md5($GLOBALS['ip'].($_SERVER['HTTP_USER_AGENT'] ?? '')); |
|
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | // mais apres la fonction autoriser() |
| 120 | 120 | if ($f = find_in_path('mes_fonctions.php')) { |
| 121 | 121 | global $dossier_squelettes; |
| 122 | - include_once(_ROOT_CWD . $f); |
|
| 122 | + include_once(_ROOT_CWD.$f); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $qui = $GLOBALS['visiteur_session'] ?: []; |
| 161 | 161 | $qui = array_merge(['statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'], $qui); |
| 162 | 162 | } elseif (is_numeric($qui)) { |
| 163 | - $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui); |
|
| 163 | + $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur='.$qui); |
|
| 164 | 164 | if (!$qui) { |
| 165 | 165 | return false; |
| 166 | 166 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $logger = spip_logger('autoriser'); |
| 176 | 176 | $logger->debug( |
| 177 | - "autoriser $faire $type $id (" . ($qui['nom'] ?? '') . ') ?', |
|
| 177 | + "autoriser $faire $type $id (".($qui['nom'] ?? '').') ?', |
|
| 178 | 178 | ); |
| 179 | 179 | |
| 180 | 180 | $type = autoriser_type($type); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) |
| 185 | 185 | && autoriser_exception($faire, $type, $id, 'verifier') || isset($GLOBALS['autoriser_exception'][$faire][$type]['*']) && autoriser_exception($faire, $type, '*', 'verifier') |
| 186 | 186 | ) { |
| 187 | - $logger->debug("autoriser ($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : OK Exception'); |
|
| 187 | + $logger->debug("autoriser ($faire, $type, $id, ".($qui['nom'] ?? '').') : OK Exception'); |
|
| 188 | 188 | return true; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -193,18 +193,18 @@ discard block |
||
| 193 | 193 | // autoriser_faire[_dist], autoriser_defaut[_dist] |
| 194 | 194 | $fonctions = $type |
| 195 | 195 | ? [ |
| 196 | - 'autoriser_' . $type . '_' . $faire, |
|
| 197 | - 'autoriser_' . $type . '_' . $faire . '_dist', |
|
| 198 | - 'autoriser_' . $type, |
|
| 199 | - 'autoriser_' . $type . '_dist', |
|
| 200 | - 'autoriser_' . $faire, |
|
| 201 | - 'autoriser_' . $faire . '_dist', |
|
| 196 | + 'autoriser_'.$type.'_'.$faire, |
|
| 197 | + 'autoriser_'.$type.'_'.$faire.'_dist', |
|
| 198 | + 'autoriser_'.$type, |
|
| 199 | + 'autoriser_'.$type.'_dist', |
|
| 200 | + 'autoriser_'.$faire, |
|
| 201 | + 'autoriser_'.$faire.'_dist', |
|
| 202 | 202 | 'autoriser_defaut', |
| 203 | 203 | 'autoriser_defaut_dist' |
| 204 | 204 | ] |
| 205 | 205 | : [ |
| 206 | - 'autoriser_' . $faire, |
|
| 207 | - 'autoriser_' . $faire . '_dist', |
|
| 206 | + 'autoriser_'.$faire, |
|
| 207 | + 'autoriser_'.$faire.'_dist', |
|
| 208 | 208 | 'autoriser_defaut', |
| 209 | 209 | 'autoriser_defaut_dist' |
| 210 | 210 | ]; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $logger->debug( |
| 221 | - "$f($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : ' . ($a ? 'OK' : 'niet'), |
|
| 221 | + "$f($faire, $type, $id, ".($qui['nom'] ?? '').') : '.($a ? 'OK' : 'niet'), |
|
| 222 | 222 | ); |
| 223 | 223 | |
| 224 | 224 | if (!is_bool($a)) { |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | function autoriser_previsualiser_dist(string $faire, string $type, $id, array $qui, array $opt): bool { |
| 385 | 385 | |
| 386 | 386 | // Le visiteur a-t-il un statut prevu par la config ? |
| 387 | - if (str_contains((string) $GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',')) { |
|
| 387 | + if (str_contains((string) $GLOBALS['meta']['preview'], ','.$qui['statut'].',')) { |
|
| 388 | 388 | return test_previsualiser_objet_champ($type, $id, $qui, $opt); |
| 389 | 389 | } |
| 390 | 390 | |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | } // pas de champ passe a la demande => NIET |
| 439 | 439 | $previsu = explode(',', (string) $c['previsu']); |
| 440 | 440 | // regarder si ce statut est autorise pour l'auteur |
| 441 | - if (in_array($opt[$champ] . '/auteur', $previsu)) { |
|
| 441 | + if (in_array($opt[$champ].'/auteur', $previsu)) { |
|
| 442 | 442 | // retrouver l’id_auteur qui a filé un lien de prévisu éventuellement, |
| 443 | 443 | // sinon l’auteur en session |
| 444 | 444 | include_spip('inc/securiser_action'); |
@@ -452,12 +452,12 @@ discard block |
||
| 452 | 452 | |
| 453 | 453 | if (!$id_auteur) { |
| 454 | 454 | return false; |
| 455 | - } elseif (autoriser('previsualiser' . $opt[$champ], $type, 0, $id_auteur)) { |
|
| 455 | + } elseif (autoriser('previsualiser'.$opt[$champ], $type, 0, $id_auteur)) { |
|
| 456 | 456 | // dans ce cas (admin en general), pas de filtrage sur ce statut |
| 457 | 457 | } elseif ( |
| 458 | 458 | !sql_countsel( |
| 459 | 459 | 'spip_auteurs_liens', |
| 460 | - 'id_auteur=' . (int) $id_auteur . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . (int) $id |
|
| 460 | + 'id_auteur='.(int) $id_auteur.' AND objet='.sql_quote($type).' AND id_objet='.(int) $id |
|
| 461 | 461 | ) |
| 462 | 462 | ) { |
| 463 | 463 | return false; |
@@ -502,14 +502,14 @@ discard block |
||
| 502 | 502 | // multilinguisme par secteur et objet rattaché à une rubrique |
| 503 | 503 | $primary = id_table_objet($type); |
| 504 | 504 | $id_rubrique = $table != 'spip_rubriques' |
| 505 | - ? sql_getfetsel('id_rubrique', "$table", "$primary=" . (int) $id) |
|
| 505 | + ? sql_getfetsel('id_rubrique', "$table", "$primary=".(int) $id) |
|
| 506 | 506 | : $id; |
| 507 | - $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . (int) $id_rubrique); |
|
| 507 | + $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.(int) $id_rubrique); |
|
| 508 | 508 | if (!$id_secteur > 0) { |
| 509 | 509 | $id_secteur = $id_rubrique; |
| 510 | 510 | } |
| 511 | - $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . (int) $id_secteur); |
|
| 512 | - $langue_objet = sql_getfetsel('lang', "$table", "$primary=" . (int) $id); |
|
| 511 | + $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique='.(int) $id_secteur); |
|
| 512 | + $langue_objet = sql_getfetsel('lang', "$table", "$primary=".(int) $id); |
|
| 513 | 513 | if ($langue_secteur != $langue_objet) { |
| 514 | 514 | // configuration incohérente, on laisse l'utilisateur corriger la situation |
| 515 | 515 | return true; |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques |
| 518 | 518 | return false; |
| 519 | 519 | } else { |
| 520 | - $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . (int) $id); |
|
| 520 | + $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique='.(int) $id); |
|
| 521 | 521 | if ($id_parent != 0) { |
| 522 | 522 | // sous-rubriques : pas de choix de langue |
| 523 | 523 | return false; |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | |
| 570 | 570 | if (!isset($opt['statut'])) { |
| 571 | 571 | if (isset($desc['field']['statut'])) { |
| 572 | - $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . (int) $id); |
|
| 572 | + $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type).'='.(int) $id); |
|
| 573 | 573 | } else { |
| 574 | 574 | $statut = 'publie'; |
| 575 | 575 | } // pas de statut => publie |
@@ -734,11 +734,11 @@ discard block |
||
| 734 | 734 | return false; |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | - if (sql_countsel('spip_rubriques', 'id_parent=' . (int) $id)) { |
|
| 737 | + if (sql_countsel('spip_rubriques', 'id_parent='.(int) $id)) { |
|
| 738 | 738 | return false; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - if (sql_countsel('spip_articles', 'id_rubrique=' . (int) $id . " AND (statut<>'poubelle')")) { |
|
| 741 | + if (sql_countsel('spip_articles', 'id_rubrique='.(int) $id." AND (statut<>'poubelle')")) { |
|
| 742 | 742 | return false; |
| 743 | 743 | } |
| 744 | 744 | |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | if (!$id) { |
| 776 | 776 | return false; |
| 777 | 777 | } |
| 778 | - $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id)); |
|
| 778 | + $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article='.sql_quote($id)); |
|
| 779 | 779 | |
| 780 | 780 | return $r && ( |
| 781 | 781 | autoriser('publierdans', 'rubrique', $r['id_rubrique'], $qui, $opt) |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | (!isset($opt['statut']) || !in_array($opt['statut'], ['publie', 'refuse'], true)) |
| 784 | 784 | && in_array($qui['statut'], ['0minirezo', '1comite']) |
| 785 | 785 | && in_array($r['statut'], ['prop', 'prepa', 'poubelle']) |
| 786 | - && auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']) |
|
| 786 | + && auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur']) |
|
| 787 | 787 | ) |
| 788 | 788 | ); |
| 789 | 789 | } |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | if (!$id) { |
| 842 | 842 | return false; |
| 843 | 843 | } |
| 844 | - $statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . (int) $id); |
|
| 844 | + $statut = sql_getfetsel('statut', 'spip_articles', 'id_article='.(int) $id); |
|
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | return |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | in_array($statut, ['prop', 'publie']) |
| 851 | 851 | // sinon si on est auteur, on a le droit de le voir, evidemment ! |
| 852 | 852 | |
| 853 | - || $id && $qui['id_auteur'] && auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']); |
|
| 853 | + || $id && $qui['id_auteur'] && auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur']); |
|
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | |
@@ -871,8 +871,8 @@ discard block |
||
| 871 | 871 | function autoriser_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool { |
| 872 | 872 | # securite, mais on aurait pas du arriver ici ! |
| 873 | 873 | if ( |
| 874 | - function_exists($f = 'autoriser_' . $type . '_voir') |
|
| 875 | - || function_exists($f = 'autoriser_' . $type . '_voir_dist') |
|
| 874 | + function_exists($f = 'autoriser_'.$type.'_voir') |
|
| 875 | + || function_exists($f = 'autoriser_'.$type.'_voir_dist') |
|
| 876 | 876 | ) { |
| 877 | 877 | return $f($faire, $type, $id, $qui, $opt); |
| 878 | 878 | } |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | $n = sql_fetsel( |
| 998 | 998 | 'A.id_article', |
| 999 | 999 | 'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)', |
| 1000 | - "A.statut='publie' AND L.id_auteur=" . sql_quote($id) |
|
| 1000 | + "A.statut='publie' AND L.id_auteur=".sql_quote($id) |
|
| 1001 | 1001 | ); |
| 1002 | 1002 | |
| 1003 | 1003 | return (bool) $n; |
@@ -1195,7 +1195,7 @@ discard block |
||
| 1195 | 1195 | && ($r = sql_allfetsel( |
| 1196 | 1196 | 'id_objet', |
| 1197 | 1197 | 'spip_auteurs_liens', |
| 1198 | - 'id_auteur=' . (int) $id_auteur . " AND objet='rubrique' AND id_objet!=0" |
|
| 1198 | + 'id_auteur='.(int) $id_auteur." AND objet='rubrique' AND id_objet!=0" |
|
| 1199 | 1199 | )) |
| 1200 | 1200 | && (is_countable($r) ? count($r) : 0) |
| 1201 | 1201 | ) { |
@@ -1872,8 +1872,8 @@ discard block |
||
| 1872 | 1872 | function auteurs_objet($objet, $id_objet, $cond = '') { |
| 1873 | 1873 | $objet = objet_type($objet); |
| 1874 | 1874 | $where = [ |
| 1875 | - 'objet=' . sql_quote($objet), |
|
| 1876 | - 'id_objet=' . (int) $id_objet |
|
| 1875 | + 'objet='.sql_quote($objet), |
|
| 1876 | + 'id_objet='.(int) $id_objet |
|
| 1877 | 1877 | ]; |
| 1878 | 1878 | if (!empty($cond)) { |
| 1879 | 1879 | if (is_array($cond)) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @return void |
| 43 | 43 | **/ |
| 44 | 44 | function install_fichier_connexion($nom, $texte) { |
| 45 | - $texte = '<' . "?php\n" |
|
| 45 | + $texte = '<'."?php\n" |
|
| 46 | 46 | . "if (!defined(\"_ECRIRE_INC_VERSION\")) return;\n" |
| 47 | 47 | . $texte; |
| 48 | 48 | |
@@ -114,10 +114,10 @@ discard block |
||
| 114 | 114 | return $regs; |
| 115 | 115 | } else { |
| 116 | 116 | $ar = '\s*\'([^\']*)\''; |
| 117 | - $r = '\s*,' . $ar; |
|
| 117 | + $r = '\s*,'.$ar; |
|
| 118 | 118 | $r = "#spip_connect_db[(]$ar$r$r$r$r(?:$r(?:$r(?:$r(?:$r)?)?)?)?#"; |
| 119 | 119 | if (preg_match($r, $s, $regs)) { |
| 120 | - $regs[2] = $regs[1] . ($regs[2] ? ':' . $regs[2] . ';' : ''); |
|
| 120 | + $regs[2] = $regs[1].($regs[2] ? ':'.$regs[2].';' : ''); |
|
| 121 | 121 | array_shift($regs); |
| 122 | 122 | array_shift($regs); |
| 123 | 123 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | // Si on n'a pas la bonne version de PHP, c'est la fin |
| 183 | 183 | if ($err) { |
| 184 | 184 | die("<div class='error'>" |
| 185 | - . '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>" |
|
| 185 | + . '<h3>'._T('avis_attention').'</h3><p>'._T('install_echec_annonce')."</p><ul class='spip'>" |
|
| 186 | 186 | . "<li><strong>{$err[0]}</strong></li>\n</ul></div>"); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | if ($err) { |
| 198 | 198 | echo "<div class='error'>" |
| 199 | - . '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>"; |
|
| 199 | + . '<h3>'._T('avis_attention').'</h3><p>'._T('install_echec_annonce')."</p><ul class='spip'>"; |
|
| 200 | 200 | foreach ($err as $e) { |
| 201 | 201 | echo "<li><strong>$e</strong></li>\n"; |
| 202 | 202 | } |
@@ -209,8 +209,8 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | |
| 211 | 211 | function info_etape($titre, $complement = '') { |
| 212 | - return '<h2>' . $titre . "</h2>\n" . |
|
| 213 | - ($complement ? '' . $complement . "\n" : ''); |
|
| 212 | + return '<h2>'.$titre."</h2>\n". |
|
| 213 | + ($complement ? ''.$complement."\n" : ''); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -224,18 +224,18 @@ discard block |
||
| 224 | 224 | $code = _T('bouton_suivant'); |
| 225 | 225 | } |
| 226 | 226 | static $suivant = 0; |
| 227 | - $id = 'suivant' . (($suivant > 0) ? (string) $suivant : ''); |
|
| 227 | + $id = 'suivant'.(($suivant > 0) ? (string) $suivant : ''); |
|
| 228 | 228 | $suivant += 1; |
| 229 | 229 | |
| 230 | - return "\n<p class='boutons suivant'><input id='" . $id . "' type='submit'\nvalue=\"" . |
|
| 231 | - $code . |
|
| 230 | + return "\n<p class='boutons suivant'><input id='".$id."' type='submit'\nvalue=\"". |
|
| 231 | + $code. |
|
| 232 | 232 | " >>\" /></p>\n"; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | function info_progression_etape($en_cours, $phase, $dir, $erreur = false) { |
| 236 | 236 | $intitule_etat = []; |
| 237 | 237 | |
| 238 | - $liste = find_all_in_path($dir, $phase . '(([0-9])+|fin)[.]php$'); |
|
| 238 | + $liste = find_all_in_path($dir, $phase.'(([0-9])+|fin)[.]php$'); |
|
| 239 | 239 | $debut = 1; |
| 240 | 240 | $last = is_countable($liste) ? count($liste) : 0; |
| 241 | 241 | |
@@ -266,23 +266,23 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | $aff_etapes .= "<li class='$class'><div class='fond'>"; |
| 269 | - $aff_etapes .= '<em>' . _T('etape') . " </em><span class='numero_etape'>$debut</span><em> : </em>"; |
|
| 270 | - $aff_etapes .= '<' . (($debut == $en_cours) ? 'strong' : 'span') . ' class="label_etape">' . $intitule_etat["$phase"][$debut] . '</' . (($debut == $en_cours) ? 'strong' : 'span') . '>'; |
|
| 269 | + $aff_etapes .= '<em>'._T('etape')." </em><span class='numero_etape'>$debut</span><em> : </em>"; |
|
| 270 | + $aff_etapes .= '<'.(($debut == $en_cours) ? 'strong' : 'span').' class="label_etape">'.$intitule_etat["$phase"][$debut].'</'.(($debut == $en_cours) ? 'strong' : 'span').'>'; |
|
| 271 | 271 | $aff_etapes .= '</div></li>'; |
| 272 | 272 | } |
| 273 | 273 | $debut++; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - return $aff_etapes . '</ul>'; |
|
| 276 | + return $aff_etapes.'</ul>'; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | |
| 280 | 280 | function fieldset($legend, $champs = [], $apres = '', $avant = '') { |
| 281 | - return "<fieldset>\n" . |
|
| 282 | - $avant . |
|
| 283 | - ($legend ? '<legend>' . $legend . "</legend>\n" : '') . |
|
| 284 | - fieldset_champs($champs) . |
|
| 285 | - $apres . |
|
| 281 | + return "<fieldset>\n". |
|
| 282 | + $avant. |
|
| 283 | + ($legend ? '<legend>'.$legend."</legend>\n" : ''). |
|
| 284 | + fieldset_champs($champs). |
|
| 285 | + $apres. |
|
| 286 | 286 | "</fieldset>\n"; |
| 287 | 287 | } |
| 288 | 288 | |
@@ -292,18 +292,18 @@ discard block |
||
| 292 | 292 | $type = isset($contenu['hidden']) ? 'hidden' : (preg_match(',^pass,', (string) $nom) ? 'password' : 'text'); |
| 293 | 293 | $class = isset($contenu['hidden']) ? '' : "class='formo' size='40' "; |
| 294 | 294 | if (isset($contenu['alternatives'])) { |
| 295 | - $fieldset .= $contenu['label'] . "\n"; |
|
| 295 | + $fieldset .= $contenu['label']."\n"; |
|
| 296 | 296 | foreach ($contenu['alternatives'] as $valeur => $label) { |
| 297 | - $fieldset .= "<input type='radio' name='" . $nom . |
|
| 297 | + $fieldset .= "<input type='radio' name='".$nom. |
|
| 298 | 298 | "' id='$nom-$valeur' value='$valeur'" |
| 299 | 299 | . (($valeur == $contenu['valeur']) ? "\nchecked='checked'" : '') |
| 300 | 300 | . "/>\n"; |
| 301 | - $fieldset .= "<label for='$nom-$valeur'>" . $label . "</label>\n"; |
|
| 301 | + $fieldset .= "<label for='$nom-$valeur'>".$label."</label>\n"; |
|
| 302 | 302 | } |
| 303 | 303 | $fieldset .= "<br />\n"; |
| 304 | 304 | } else { |
| 305 | - $fieldset .= "<label for='" . $nom . "'>" . $contenu['label'] . "</label>\n"; |
|
| 306 | - $fieldset .= '<input ' . $class . "type='" . $type . "' id='" . $nom . "' name='" . $nom . "'\nvalue='" . $contenu['valeur'] . "'" |
|
| 305 | + $fieldset .= "<label for='".$nom."'>".$contenu['label']."</label>\n"; |
|
| 306 | + $fieldset .= '<input '.$class."type='".$type."' id='".$nom."' name='".$nom."'\nvalue='".$contenu['valeur']."'" |
|
| 307 | 307 | . (preg_match(',^(pass|login),', (string) $nom) ? " autocomplete='off'" : '') |
| 308 | 308 | . ((isset($contenu['required']) && $contenu['required']) ? " required='required'" : '') |
| 309 | 309 | . " />\n"; |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | function install_select_serveur() { |
| 317 | 317 | $options = []; |
| 318 | - $dir = _DIR_RESTREINT . 'req/'; |
|
| 318 | + $dir = _DIR_RESTREINT.'req/'; |
|
| 319 | 319 | $d = opendir($dir); |
| 320 | 320 | if (!$d) { |
| 321 | 321 | return []; |
@@ -323,17 +323,17 @@ discard block |
||
| 323 | 323 | while (($f = readdir($d)) !== false) { |
| 324 | 324 | if ( |
| 325 | 325 | preg_match('/^(.*)[.]php$/', $f, $s) |
| 326 | - && is_readable($f = $dir . $f) |
|
| 326 | + && is_readable($f = $dir.$f) |
|
| 327 | 327 | ) { |
| 328 | 328 | require_once($f); |
| 329 | 329 | $s = $s[1]; |
| 330 | - $v = 'spip_versions_' . $s; |
|
| 330 | + $v = 'spip_versions_'.$s; |
|
| 331 | 331 | if (function_exists($v) && $v()) { |
| 332 | 332 | $titre = _T("install_select_type_$s"); |
| 333 | 333 | // proposer mysql par defaut si dispo |
| 334 | 334 | $checked = ($s == 'mysql' ? " checked='checked'" : ''); |
| 335 | 335 | $options[$s] = "<li><input type='radio' id='$s' value='$s' name='server_db'$checked>" |
| 336 | - . "<label for='$s'>" . ($titre ?: $s) . '</label></li>'; |
|
| 336 | + . "<label for='$s'>".($titre ?: $s).'</label></li>'; |
|
| 337 | 337 | } else { |
| 338 | 338 | spip_logger()->info("$s: portage indisponible"); |
| 339 | 339 | } |
@@ -351,8 +351,8 @@ discard block |
||
| 351 | 351 | "\n<input type='hidden' name='etape' value='$etape' />" |
| 352 | 352 | . $hidden |
| 353 | 353 | . (_request('echec') ? |
| 354 | - ('<p><b>' . _T('avis_connexion_echec_1') . |
|
| 355 | - '</b></p><p>' . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . '</p>') |
|
| 354 | + ('<p><b>'._T('avis_connexion_echec_1'). |
|
| 355 | + '</b></p><p>'._T('avis_connexion_echec_2')."</p><p style='font-size: small;'>"._T('avis_connexion_echec_3').'</p>') |
|
| 356 | 356 | : '') |
| 357 | 357 | |
| 358 | 358 | . ($jquery ? http_script('', 'jquery.js') : '') |
@@ -390,9 +390,9 @@ discard block |
||
| 390 | 390 | });') |
| 391 | 391 | |
| 392 | 392 | . ($server_db |
| 393 | - ? '<input type="hidden" name="server_db" value="' . $server_db . '" />' |
|
| 393 | + ? '<input type="hidden" name="server_db" value="'.$server_db.'" />' |
|
| 394 | 394 | . (($predef[0]) |
| 395 | - ? ('<h3>' . _T('install_serveur_hebergeur') . '</h3>') |
|
| 395 | + ? ('<h3>'._T('install_serveur_hebergeur').'</h3>') |
|
| 396 | 396 | : '') |
| 397 | 397 | : ('<fieldset><legend>' |
| 398 | 398 | . _T('install_select_type_db') |
@@ -407,9 +407,9 @@ discard block |
||
| 407 | 407 | . "\n</ul>\n</div></fieldset>") |
| 408 | 408 | ) |
| 409 | 409 | . '<div id="install_adresse_base_hebergeur">' |
| 410 | - . '<p>' . _T('texte_connexion_mysql') . '</p>' |
|
| 410 | + . '<p>'._T('texte_connexion_mysql').'</p>' |
|
| 411 | 411 | . ($predef[1] |
| 412 | - ? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>' |
|
| 412 | + ? '<h3>'._T('install_adresse_base_hebergeur').'</h3>' |
|
| 413 | 413 | : fieldset( |
| 414 | 414 | _T('entree_base_donnee_1'), |
| 415 | 415 | [ |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | . '<div id="install_login_base_hebergeur">' |
| 426 | 426 | . ($predef[2] |
| 427 | - ? '<h3>' . _T('install_login_base_hebergeur') . '</h3>' |
|
| 427 | + ? '<h3>'._T('install_login_base_hebergeur').'</h3>' |
|
| 428 | 428 | : fieldset( |
| 429 | 429 | _T('entree_login_connexion_1'), |
| 430 | 430 | [ |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | . '<div id="install_pass_base_hebergeur">' |
| 441 | 441 | . ($predef[3] |
| 442 | - ? '<h3>' . _T('install_pass_base_hebergeur') . '</h3>' |
|
| 442 | + ? '<h3>'._T('install_pass_base_hebergeur').'</h3>' |
|
| 443 | 443 | : fieldset( |
| 444 | 444 | _T('entree_mot_passe_1'), |
| 445 | 445 | [ |
@@ -461,20 +461,20 @@ discard block |
||
| 461 | 461 | function predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db) { |
| 462 | 462 | return ((defined('_INSTALL_HOST_DB')) |
| 463 | 463 | ? '' |
| 464 | - : "\n<input type='hidden' name='adresse_db' value=\"" . spip_htmlspecialchars($adresse_db) . '" />' |
|
| 464 | + : "\n<input type='hidden' name='adresse_db' value=\"".spip_htmlspecialchars($adresse_db).'" />' |
|
| 465 | 465 | ) |
| 466 | 466 | . ((defined('_INSTALL_USER_DB')) |
| 467 | 467 | ? '' |
| 468 | - : "\n<input type='hidden' name='login_db' value=\"" . spip_htmlspecialchars($login_db) . '" />' |
|
| 468 | + : "\n<input type='hidden' name='login_db' value=\"".spip_htmlspecialchars($login_db).'" />' |
|
| 469 | 469 | ) |
| 470 | 470 | . ((defined('_INSTALL_PASS_DB')) |
| 471 | 471 | ? '' |
| 472 | - : "\n<input type='hidden' name='pass_db' value=\"" . spip_htmlspecialchars($pass_db) . '" />' |
|
| 472 | + : "\n<input type='hidden' name='pass_db' value=\"".spip_htmlspecialchars($pass_db).'" />' |
|
| 473 | 473 | ) |
| 474 | 474 | |
| 475 | 475 | . ((defined('_INSTALL_SERVER_DB')) |
| 476 | 476 | ? '' |
| 477 | - : "\n<input type='hidden' name='server_db' value=\"" . spip_htmlspecialchars($server_db) . '" />' |
|
| 477 | + : "\n<input type='hidden' name='server_db' value=\"".spip_htmlspecialchars($server_db).'" />' |
|
| 478 | 478 | ); |
| 479 | 479 | } |
| 480 | 480 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | static $dirs = []; |
| 43 | 43 | $liste = []; |
| 44 | 44 | foreach (creer_chemin() as $dir) { |
| 45 | - if (!isset($dirs[$a = $dir . $dirname])) { |
|
| 45 | + if (!isset($dirs[$a = $dir.$dirname])) { |
|
| 46 | 46 | $dirs[$a] = (is_dir($a) || !$a); |
| 47 | 47 | } |
| 48 | 48 | if ($dirs[$a] && is_readable($a .= $file)) { |
@@ -66,21 +66,21 @@ discard block |
||
| 66 | 66 | **/ |
| 67 | 67 | function chercher_module_lang($module, $lang = '') { |
| 68 | 68 | if ($lang) { |
| 69 | - $lang = '_' . $lang; |
|
| 69 | + $lang = '_'.$lang; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // 1) dans un repertoire nomme lang/ se trouvant sur le chemin |
| 73 | 73 | if ( |
| 74 | 74 | $f = ($module == 'local' |
| 75 | - ? find_in_path($module . $lang . '.php', 'lang/') |
|
| 76 | - : find_langs_in_path($module . $lang . '.php', 'lang/')) |
|
| 75 | + ? find_in_path($module.$lang.'.php', 'lang/') |
|
| 76 | + : find_langs_in_path($module.$lang.'.php', 'lang/')) |
|
| 77 | 77 | ) { |
| 78 | 78 | return is_array($f) ? $f : [$f]; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // 2) directement dans le chemin (old style, uniquement pour local) |
| 82 | 82 | return ($module == 'local' || strpos($module, '/')) |
| 83 | - ? (($f = find_in_path($module . $lang . '.php')) ? [$f] : false) |
|
| 83 | + ? (($f = find_in_path($module.$lang.'.php')) ? [$f] : false) |
|
| 84 | 84 | : false; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | **/ |
| 105 | 105 | function charger_langue($lang, $module = 'spip') { |
| 106 | 106 | static $langs = []; |
| 107 | - $var = 'i18n_' . $module . '_' . $lang; |
|
| 107 | + $var = 'i18n_'.$module.'_'.$lang; |
|
| 108 | 108 | if (!isset($langs[$lang])) { |
| 109 | 109 | $langs[$lang] = []; |
| 110 | 110 | if ($lang) { |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | foreach ($langs[$lang] as $l) { |
| 121 | 121 | if ($fichiers_lang = chercher_module_lang($module, $l)) { |
| 122 | - $GLOBALS['idx_lang'] = 'i18n_' . $module . '_' . $l; |
|
| 122 | + $GLOBALS['idx_lang'] = 'i18n_'.$module.'_'.$l; |
|
| 123 | 123 | $GLOBALS[$GLOBALS['idx_lang']] = lire_fichier_langue(array_shift($fichiers_lang)); |
| 124 | 124 | surcharger_langue($fichiers_lang); |
| 125 | 125 | if ($l !== $lang) { |
| 126 | - $GLOBALS[$var] = &$GLOBALS['i18n_' . $module . '_' . $l]; |
|
| 126 | + $GLOBALS[$var] = &$GLOBALS['i18n_'.$module.'_'.$l]; |
|
| 127 | 127 | } |
| 128 | - $GLOBALS['lang_' . $var] = $l; |
|
| 128 | + $GLOBALS['lang_'.$var] = $l; |
|
| 129 | 129 | #spip_logger('traduire')->info("module de langue : {$module}_$l.php"); |
| 130 | 130 | break; |
| 131 | 131 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | function lire_fichier_langue(string $fichier): array { |
| 145 | 145 | $idx_lang_before = $GLOBALS['idx_lang'] ?? null; |
| 146 | - $idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang') . '@temporaire'; |
|
| 146 | + $idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang').'@temporaire'; |
|
| 147 | 147 | $GLOBALS['idx_lang'] = $idx_lang_tmp; |
| 148 | 148 | $idx_lang = include $fichier; |
| 149 | 149 | $GLOBALS['idx_lang'] = $idx_lang_before; |
@@ -255,27 +255,27 @@ discard block |
||
| 255 | 255 | } else { |
| 256 | 256 | $modules = ['spip', 'ecrire']; |
| 257 | 257 | $code = $ori; |
| 258 | - $ori_complet = implode('|', $modules) . ':' . $ori; |
|
| 258 | + $ori_complet = implode('|', $modules).':'.$ori; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | $desc = new Description(); |
| 262 | 262 | |
| 263 | 263 | // parcourir tous les modules jusqu'a ce qu'on trouve |
| 264 | 264 | foreach ($modules as $module) { |
| 265 | - $var = 'i18n_' . $module . '_' . $lang; |
|
| 265 | + $var = 'i18n_'.$module.'_'.$lang; |
|
| 266 | 266 | |
| 267 | 267 | if (empty($GLOBALS[$var])) { |
| 268 | 268 | charger_langue($lang, $module); |
| 269 | 269 | // surcharges persos -- on cherche |
| 270 | 270 | // (lang/)local_xx.php et/ou (lang/)local.php ... |
| 271 | - if (!isset($local['local_' . $lang])) { |
|
| 271 | + if (!isset($local['local_'.$lang])) { |
|
| 272 | 272 | // redéfinir la langue en cours pour les surcharges (chercher_langue a pu le changer) |
| 273 | 273 | $GLOBALS['idx_lang'] = $var; |
| 274 | 274 | // ... (lang/)local_xx.php |
| 275 | - $local['local_' . $lang] = chercher_module_lang('local', $lang); |
|
| 275 | + $local['local_'.$lang] = chercher_module_lang('local', $lang); |
|
| 276 | 276 | } |
| 277 | - if ($local['local_' . $lang]) { |
|
| 278 | - surcharger_langue($local['local_' . $lang]); |
|
| 277 | + if ($local['local_'.$lang]) { |
|
| 278 | + surcharger_langue($local['local_'.$lang]); |
|
| 279 | 279 | } |
| 280 | 280 | // ... puis (lang/)local.php |
| 281 | 281 | if (!isset($local['local'])) { |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | if (isset($GLOBALS[$var][$code])) { |
| 290 | 290 | $desc->code = $code; |
| 291 | 291 | $desc->module = $module; |
| 292 | - $desc->langue = $GLOBALS['lang_' . $var] ?? $lang; |
|
| 292 | + $desc->langue = $GLOBALS['lang_'.$var] ?? $lang; |
|
| 293 | 293 | $desc->texte = $GLOBALS[$var][$code]; |
| 294 | 294 | break; |
| 295 | 295 | } |
@@ -347,13 +347,13 @@ discard block |
||
| 347 | 347 | if (!$desc->mode && $desc->texte) { |
| 348 | 348 | // ne pas modifier 2 fois l'affichage |
| 349 | 349 | $desc->mode = 'traduction'; |
| 350 | - $classe = 'debug-traduction' . ($desc->module == 'ecrire' ? '-prive' : ''); |
|
| 350 | + $classe = 'debug-traduction'.($desc->module == 'ecrire' ? '-prive' : ''); |
|
| 351 | 351 | $desc->texte = '<span ' |
| 352 | - . 'lang=' . $desc->langue |
|
| 353 | - . ' class=' . $classe |
|
| 354 | - . ' data-module=' . $desc->module |
|
| 355 | - . ' data-code=' . $desc->code |
|
| 356 | - . ' title=' . $modules . '(' . $desc->langue . ')>' |
|
| 352 | + . 'lang='.$desc->langue |
|
| 353 | + . ' class='.$classe |
|
| 354 | + . ' data-module='.$desc->module |
|
| 355 | + . ' data-code='.$desc->code |
|
| 356 | + . ' title='.$modules.'('.$desc->langue.')>' |
|
| 357 | 357 | . $desc->texte |
| 358 | 358 | . '</span>'; |
| 359 | 359 | $desc->texte = str_replace( |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * Mot de passe |
| 31 | 31 | **/ |
| 32 | 32 | function creer_pass_aleatoire($longueur = 16, $sel = '') { |
| 33 | - $seed = (int)round(((float)microtime() + 1) * time()); |
|
| 33 | + $seed = (int) round(((float) microtime() + 1) * time()); |
|
| 34 | 34 | |
| 35 | 35 | mt_srand($seed); |
| 36 | 36 | $s = ''; |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | if (!$s) { |
| 42 | 42 | $s = random_int(0, mt_getrandmax()); |
| 43 | 43 | } |
| 44 | - $s = substr(md5(uniqid($s) . $sel), 0, 16); |
|
| 44 | + $s = substr(md5(uniqid($s).$sel), 0, 16); |
|
| 45 | 45 | } |
| 46 | - $r = unpack('Cr', pack('H2', $s . $s)); |
|
| 46 | + $r = unpack('Cr', pack('H2', $s.$s)); |
|
| 47 | 47 | $x = $r['r'] & 63; |
| 48 | 48 | if ($x < 10) { |
| 49 | 49 | $x = chr($x + 48); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | static $seeded; |
| 77 | 77 | |
| 78 | 78 | if (!$seeded) { |
| 79 | - $seed = (int)round(((float)microtime() + 1) * time()); |
|
| 79 | + $seed = (int) round(((float) microtime() + 1) * time()); |
|
| 80 | 80 | mt_srand($seed); |
| 81 | 81 | $seeded = true; |
| 82 | 82 | } |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | ecrire_meta('low_sec', $low_sec = creer_pass_aleatoire()); |
| 163 | 163 | } |
| 164 | 164 | } else { |
| 165 | - $low_sec = sql_getfetsel('low_sec', 'spip_auteurs', 'id_auteur = ' . (int) $id_auteur); |
|
| 165 | + $low_sec = sql_getfetsel('low_sec', 'spip_auteurs', 'id_auteur = '.(int) $id_auteur); |
|
| 166 | 166 | if (!$low_sec) { |
| 167 | 167 | $low_sec = creer_pass_aleatoire(); |
| 168 | - sql_updateq('spip_auteurs', ['low_sec' => $low_sec], 'id_auteur = ' . (int) $id_auteur); |
|
| 168 | + sql_updateq('spip_auteurs', ['low_sec' => $low_sec], 'id_auteur = '.(int) $id_auteur); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | function generer_url_api_low_sec(string $script, string $format, string $fond, string $path, string $args, bool $no_entities = false, ?bool $public = null) { |
| 217 | 217 | $id_auteur = $GLOBALS['visiteur_session']['id_auteur'] ?? 0; |
| 218 | 218 | $cle = afficher_low_sec($id_auteur, "$script/$format $fond $args"); |
| 219 | - $path = "$id_auteur/$cle/$format/$fond" . ($path ? "/$path" : ''); |
|
| 219 | + $path = "$id_auteur/$cle/$format/$fond".($path ? "/$path" : ''); |
|
| 220 | 220 | |
| 221 | 221 | return generer_url_api($script, $path, $args, $no_entities, $public); |
| 222 | 222 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * Clé |
| 235 | 235 | **/ |
| 236 | 236 | function afficher_low_sec($id_auteur, $action = '') { |
| 237 | - return substr(md5($action . low_sec($id_auteur)), 0, 8); |
|
| 237 | + return substr(md5($action.low_sec($id_auteur)), 0, 8); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | if (!$id_auteur = (int) $id_auteur) { |
| 266 | 266 | return; |
| 267 | 267 | } // jamais trop prudent ;) |
| 268 | - sql_updateq('spip_auteurs', ['low_sec' => ''], 'id_auteur = ' . (int) $id_auteur); |
|
| 268 | + sql_updateq('spip_auteurs', ['low_sec' => ''], 'id_auteur = '.(int) $id_auteur); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | |
@@ -283,8 +283,8 @@ discard block |
||
| 283 | 283 | * - void sinon. |
| 284 | 284 | **/ |
| 285 | 285 | function ecrire_acces() { |
| 286 | - $htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME; |
|
| 287 | - $htpasswd = _DIR_TMP . _AUTH_USER_FILE; |
|
| 286 | + $htaccess = _DIR_RESTREINT._ACCESS_FILE_NAME; |
|
| 287 | + $htpasswd = _DIR_TMP._AUTH_USER_FILE; |
|
| 288 | 288 | |
| 289 | 289 | // Cette variable de configuration peut etre posee par un plugin |
| 290 | 290 | // par exemple acces_restreint ; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | (!isset($GLOBALS['meta']['creer_htpasswd']) || $GLOBALS['meta']['creer_htpasswd'] != 'oui') && !@file_exists($htaccess) |
| 294 | 294 | ) { |
| 295 | 295 | spip_unlink($htpasswd); |
| 296 | - spip_unlink($htpasswd . '-admin'); |
|
| 296 | + spip_unlink($htpasswd.'-admin'); |
|
| 297 | 297 | return; |
| 298 | 298 | } |
| 299 | 299 | |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | $pwd_all = ''; // login:htpass pour tous |
| 322 | 322 | $pwd_admin = ''; // login:htpass pour les admins |
| 323 | 323 | |
| 324 | - $res = sql_select('login, htpass, statut', 'spip_auteurs', "htpass!='' AND login!='' AND " . sql_in('statut', ['1comite', '0minirezo', 'nouveau'])); |
|
| 324 | + $res = sql_select('login, htpass, statut', 'spip_auteurs', "htpass!='' AND login!='' AND ".sql_in('statut', ['1comite', '0minirezo', 'nouveau'])); |
|
| 325 | 325 | while ($row = sql_fetch($res)) { |
| 326 | 326 | if (strlen((string) $row['login']) && strlen((string) $row['htpass'])) { |
| 327 | - $ligne = $row['login'] . ':' . $row['htpass'] . "\n"; |
|
| 327 | + $ligne = $row['login'].':'.$row['htpass']."\n"; |
|
| 328 | 328 | $pwd_all .= $ligne; |
| 329 | 329 | if ($row['statut'] == '0minirezo') { |
| 330 | 330 | $pwd_admin .= $ligne; |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | * @return boolean |
| 368 | 368 | */ |
| 369 | 369 | function verifier_htaccess($rep, $force = false) { |
| 370 | - $htaccess = rtrim($rep, '/') . '/' . _ACCESS_FILE_NAME; |
|
| 370 | + $htaccess = rtrim($rep, '/').'/'._ACCESS_FILE_NAME; |
|
| 371 | 371 | if ((@file_exists($htaccess) || defined('_TEST_DIRS')) && !$force) { |
| 372 | 372 | return true; |
| 373 | 373 | } |
@@ -394,17 +394,17 @@ discard block |
||
| 394 | 394 | fwrite($ht, $deny); |
| 395 | 395 | fclose($ht); |
| 396 | 396 | @chmod($htaccess, _SPIP_CHMOD & 0666); |
| 397 | - $t = rtrim($rep, '/') . '/.ok'; |
|
| 397 | + $t = rtrim($rep, '/').'/.ok'; |
|
| 398 | 398 | if ($ht = @fopen($t, 'w')) { |
| 399 | 399 | @fclose($ht); |
| 400 | 400 | include_spip('inc/distant'); |
| 401 | 401 | $t = substr($t, strlen(_DIR_RACINE)); |
| 402 | - $t = url_de_base() . $t; |
|
| 402 | + $t = url_de_base().$t; |
|
| 403 | 403 | $ht = recuperer_url($t, ['methode' => 'HEAD', 'taille_max' => 0, 'follow_location' => false]); |
| 404 | 404 | $ht = ($ht['status'] ?? null) === 403; |
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | - spip_logger()->info("Creation de $htaccess " . ($ht ? ' reussie' : ' manquee')); |
|
| 407 | + spip_logger()->info("Creation de $htaccess ".($ht ? ' reussie' : ' manquee')); |
|
| 408 | 408 | |
| 409 | 409 | return $ht; |
| 410 | 410 | } |
@@ -430,11 +430,11 @@ discard block |
||
| 430 | 430 | $dirs = sql_allfetsel('extension', 'spip_types_documents'); |
| 431 | 431 | $dirs[] = ['extension' => 'distant']; |
| 432 | 432 | foreach ($dirs as $e) { |
| 433 | - if (is_dir($dir = _DIR_IMG . $e['extension'])) { |
|
| 433 | + if (is_dir($dir = _DIR_IMG.$e['extension'])) { |
|
| 434 | 434 | if ($f) { |
| 435 | 435 | verifier_htaccess($dir); |
| 436 | 436 | } else { |
| 437 | - spip_unlink($dir . '/' . _ACCESS_FILE_NAME); |
|
| 437 | + spip_unlink($dir.'/'._ACCESS_FILE_NAME); |
|
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | 440 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | if (str_starts_with($recherche, '/') && str_ends_with($recherche, '/') && strlen($recherche) > 2) { |
| 99 | 99 | // c'est une preg |
| 100 | 100 | $recherche_trans = translitteration($recherche); |
| 101 | - $preg = $recherche_trans . $options['preg_flags']; |
|
| 101 | + $preg = $recherche_trans.$options['preg_flags']; |
|
| 102 | 102 | $is_preg = true; |
| 103 | 103 | } else { |
| 104 | 104 | // s'il y a plusieurs mots il faut les chercher tous : oblige REGEXP, |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if (preg_match(',\s+,' . $u, $recherche_mod)) { |
|
| 121 | + if (preg_match(',\s+,'.$u, $recherche_mod)) { |
|
| 122 | 122 | $is_preg = true; |
| 123 | 123 | |
| 124 | 124 | $recherche_inter = '|'; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | foreach ($recherche_mots as $mot) { |
| 129 | 129 | if (strlen($mot) >= $min_long) { |
| 130 | 130 | // echapper les caracteres de regexp qui sont eventuellement dans la recherche |
| 131 | - $recherche_inter .= preg_quote($mot) . ' '; |
|
| 131 | + $recherche_inter .= preg_quote($mot).' '; |
|
| 132 | 132 | $petits_mots = false; |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -136,14 +136,14 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | // mais on cherche quand même l'expression complète, même si elle |
| 138 | 138 | // comporte des mots de moins de quatre lettres |
| 139 | - $recherche = trim(preg_replace(',\s+,' . $u, '|', $recherche_inter), '|'); |
|
| 139 | + $recherche = trim(preg_replace(',\s+,'.$u, '|', $recherche_inter), '|'); |
|
| 140 | 140 | if (!$recherche || $petits_mots) { |
| 141 | 141 | $recherche = preg_quote($recherche_org); |
| 142 | 142 | } |
| 143 | 143 | $recherche_trans = translitteration($recherche); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - $preg = '/' . str_replace('/', '\\/', (string) $recherche_trans) . '/' . $options['preg_flags']; |
|
| 146 | + $preg = '/'.str_replace('/', '\\/', (string) $recherche_trans).'/'.$options['preg_flags']; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // Si la chaine est inactive, on va utiliser LIKE pour aller plus vite |
@@ -180,11 +180,11 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | $q = sql_quote( |
| 182 | 182 | '%' |
| 183 | - . preg_replace(',\s+,' . $u, '%', $q) |
|
| 183 | + . preg_replace(',\s+,'.$u, '%', $q) |
|
| 184 | 184 | . '%' |
| 185 | 185 | ); |
| 186 | 186 | |
| 187 | - $preg = '/' . preg_replace(',\s+,' . $u, '.+', trim((string) $recherche_mod)) . '/' . $options['preg_flags']; |
|
| 187 | + $preg = '/'.preg_replace(',\s+,'.$u, '.+', trim((string) $recherche_mod)).'/'.$options['preg_flags']; |
|
| 188 | 188 | } else { |
| 189 | 189 | $methode = 'REGEXP'; |
| 190 | 190 | $q = sql_quote(trim($recherche, '/')); |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | foreach ($tables as $table => $champs) { |
| 304 | 304 | # lock via memoization, si dispo |
| 305 | 305 | if (function_exists('cache_lock')) { |
| 306 | - cache_lock($lock = _RECHERCHE_LOCK_KEY . ' ' . $table . ' ' . $recherche); |
|
| 306 | + cache_lock($lock = _RECHERCHE_LOCK_KEY.' '.$table.' '.$recherche); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | spip_timer('rech'); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | |
| 320 | 320 | spip_logger('recherche')->info( |
| 321 | - "recherche $table ($recherche) : " . (is_countable($results[$table]) ? count($results[$table]) : 0) . ' resultats ' . spip_timer('rech'), |
|
| 321 | + "recherche $table ($recherche) : ".(is_countable($results[$table]) ? count($results[$table]) : 0).' resultats '.spip_timer('rech'), |
|
| 322 | 322 | ); |
| 323 | 323 | |
| 324 | 324 | if (isset($lock)) { |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | $results = recherche_en_base($recherche, $tables, $options); |
| 353 | 353 | |
| 354 | - $preg = '/' . str_replace('/', '\\/', (string) $recherche) . '/' . $options['preg_flags']; |
|
| 354 | + $preg = '/'.str_replace('/', '\\/', (string) $recherche).'/'.$options['preg_flags']; |
|
| 355 | 355 | |
| 356 | 356 | foreach ($results as $table => $r) { |
| 357 | 357 | $_id_table = id_table_objet($table); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | $n = (int) sql_errno(); |
| 61 | - spip_logger()->info("Erreur base de donnees $n " . sql_error()); |
|
| 61 | + spip_logger()->info("Erreur base de donnees $n ".sql_error()); |
|
| 62 | 62 | |
| 63 | 63 | return $n ?: 1; |
| 64 | 64 | } |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | // erreur SQL a afficher |
| 102 | 102 | $raison = minipres( |
| 103 | 103 | _T('info_travaux_titre'), |
| 104 | - _T('titre_probleme_technique') . '<p><tt>' . sql_errno() . ' ' . sql_error() . '</tt></p>' |
|
| 104 | + _T('titre_probleme_technique').'<p><tt>'.sql_errno().' '.sql_error().'</tt></p>' |
|
| 105 | 105 | ); |
| 106 | 106 | } elseif (@$raison['statut']) { |
| 107 | 107 | // un simple visiteur n'a pas acces a l'espace prive |
| 108 | - spip_logger()->info('connexion refusee a ' . @$raison['id_auteur']); |
|
| 108 | + spip_logger()->info('connexion refusee a '.@$raison['id_auteur']); |
|
| 109 | 109 | $est_connecte = (!empty($GLOBALS['visiteur_session']['login']) && !empty($GLOBALS['visiteur_session']['statut'])); // idem test balise #URL_LOGOUT |
| 110 | 110 | $raison = minipres( |
| 111 | 111 | _T('avis_erreur_connexion'), |
| 112 | 112 | _T('avis_erreur_visiteur') |
| 113 | 113 | // Lien vers le site public |
| 114 | - . '<br /><a href="' . url_de_base() . '">' . _T('login_retour_public') . '</a>' |
|
| 114 | + . '<br /><a href="'.url_de_base().'">'._T('login_retour_public').'</a>' |
|
| 115 | 115 | // Si la personne est connectée, lien de déconnexion ramenant vers la page de login |
| 116 | - . ($est_connecte ? ' | <a href="' . generer_url_public('', 'action=logout&logout=prive') . '">' . _T('icone_deconnecter') . '</a>' : '') |
|
| 116 | + . ($est_connecte ? ' | <a href="'.generer_url_public('', 'action=logout&logout=prive').'">'._T('icone_deconnecter').'</a>' : '') |
|
| 117 | 117 | ); |
| 118 | 118 | } else { |
| 119 | 119 | // auteur en fin de droits ... |
@@ -201,8 +201,7 @@ discard block |
||
| 201 | 201 | $where = (is_numeric($id_auteur) |
| 202 | 202 | /*AND $id_auteur>0*/ // reprise lors des restaurations |
| 203 | 203 | ) ? |
| 204 | - "id_auteur=$id_auteur" : |
|
| 205 | - (strlen((string) $GLOBALS['connect_login']) ? 'login=' . sql_quote($GLOBALS['connect_login'], '', 'text') : ''); |
|
| 204 | + "id_auteur=$id_auteur" : (strlen((string) $GLOBALS['connect_login']) ? 'login='.sql_quote($GLOBALS['connect_login'], '', 'text') : ''); |
|
| 206 | 205 | |
| 207 | 206 | if (!$where) { |
| 208 | 207 | return ''; |
@@ -327,7 +326,7 @@ discard block |
||
| 327 | 326 | * @return string |
| 328 | 327 | */ |
| 329 | 328 | function auth_a_loger() { |
| 330 | - $redirect = generer_url_public('login', 'url=' . rawurlencode((string) self('&', true)), true); |
|
| 329 | + $redirect = generer_url_public('login', 'url='.rawurlencode((string) self('&', true)), true); |
|
| 331 | 330 | |
| 332 | 331 | // un echec au "bonjour" (login initial) quand le statut est |
| 333 | 332 | // inconnu signale sans doute un probleme de cookies |
@@ -363,7 +362,7 @@ discard block |
||
| 363 | 362 | $date ??= date('Y-m-d H:i:s'); |
| 364 | 363 | |
| 365 | 364 | if (abs(strtotime($date) - $connect_quand) >= 60) { |
| 366 | - sql_updateq('spip_auteurs', ['en_ligne' => $date], 'id_auteur=' . (int) $row['id_auteur']); |
|
| 365 | + sql_updateq('spip_auteurs', ['en_ligne' => $date], 'id_auteur='.(int) $row['id_auteur']); |
|
| 367 | 366 | $row['en_ligne'] = $date; |
| 368 | 367 | } |
| 369 | 368 | |
@@ -471,7 +470,7 @@ discard block |
||
| 471 | 470 | if ( |
| 472 | 471 | !$login |
| 473 | 472 | || !($login_base = auth_retrouver_login($login, $serveur)) |
| 474 | - || !($row = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur)) |
|
| 473 | + || !($row = sql_fetsel('*', 'spip_auteurs', 'login='.sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur)) |
|
| 475 | 474 | ) { |
| 476 | 475 | // generer de fausses infos, mais credibles, pour eviter une attaque |
| 477 | 476 | // https://core.spip.net/issues/1758 + https://core.spip.net/issues/3691 |
@@ -581,7 +580,7 @@ discard block |
||
| 581 | 580 | sql_updateq( |
| 582 | 581 | 'spip_auteurs', |
| 583 | 582 | ['prefs' => serialize($p)], |
| 584 | - 'id_auteur=' . (int) $auteur['id_auteur'] |
|
| 583 | + 'id_auteur='.(int) $auteur['id_auteur'] |
|
| 585 | 584 | ); |
| 586 | 585 | |
| 587 | 586 | // bloquer ici le visiteur qui tente d'abuser de ses droits |
@@ -745,7 +744,7 @@ discard block |
||
| 745 | 744 | return false; |
| 746 | 745 | } |
| 747 | 746 | |
| 748 | - $row = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur); |
|
| 747 | + $row = sql_fetsel('*', 'spip_auteurs', 'login='.sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur); |
|
| 749 | 748 | |
| 750 | 749 | if (!$row) { |
| 751 | 750 | if ( |
@@ -801,11 +800,11 @@ discard block |
||
| 801 | 800 | $retour = $retour ?: _T('icone_retour'); |
| 802 | 801 | $corps .= "<p>$raison</p>[<a href='$public'>$retour</a>] "; |
| 803 | 802 | if ($url) { |
| 804 | - $corps .= "[<a href='" . generer_url_action('cookie', "essai_auth_http=oui&$url") . "'>$re</a>]"; |
|
| 803 | + $corps .= "[<a href='".generer_url_action('cookie', "essai_auth_http=oui&$url")."'>$re</a>]"; |
|
| 805 | 804 | } |
| 806 | 805 | |
| 807 | 806 | if ($lien) { |
| 808 | - $corps .= " [<a href='$ecrire'>" . _T('login_espace_prive') . '</a>]'; |
|
| 807 | + $corps .= " [<a href='$ecrire'>"._T('login_espace_prive').'</a>]'; |
|
| 809 | 808 | } |
| 810 | 809 | include_spip('inc/minipres'); |
| 811 | 810 | echo minipres($pb, $corps); |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | if ($opt) { |
| 30 | - $phrase .= ' :: ' . str_replace("\n", ' ', implode(', ', $opt)); |
|
| 30 | + $phrase .= ' :: '.str_replace("\n", ' ', implode(', ', $opt)); |
|
| 31 | 31 | } |
| 32 | 32 | spip_logger('journal')->info($phrase); |
| 33 | 33 | } |