@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $arg = parametre_url($url_action, 'arg'); |
| 96 | - $confirm = md5("$action:$arg:" . realpath(__FILE__)); |
|
| 96 | + $confirm = md5("$action:$arg:".realpath(__FILE__)); |
|
| 97 | 97 | if (_request('confirm_action') === $confirm) { |
| 98 | 98 | return true; |
| 99 | 99 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } else { |
| 147 | 147 | return generer_url_action( |
| 148 | 148 | $action, |
| 149 | - 'arg=' . rawurlencode($arg) . "&hash=$hash" . (!$r ? '' : "&redirect=$r"), |
|
| 149 | + 'arg='.rawurlencode($arg)."&hash=$hash".(!$r ? '' : "&redirect=$r"), |
|
| 150 | 150 | $mode, |
| 151 | 151 | $public |
| 152 | 152 | ); |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | $hash = calculer_action_auteur("$action-$arg"); |
| 158 | 158 | $att .= " style='margin: 0px; border: 0px'"; |
| 159 | 159 | if ($redirect) { |
| 160 | - $redirect = "\n\t\t<input name='redirect' type='hidden' value='" . str_replace("'", ''', $redirect) . "' />"; |
|
| 160 | + $redirect = "\n\t\t<input name='redirect' type='hidden' value='".str_replace("'", ''', $redirect)."' />"; |
|
| 161 | 161 | } |
| 162 | - $mode .= $redirect . " |
|
| 162 | + $mode .= $redirect." |
|
| 163 | 163 | <input name='hash' type='hidden' value='$hash' /> |
| 164 | 164 | <input name='arg' type='hidden' value='$arg' />"; |
| 165 | 165 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $pass = $pass ?? ''; |
| 234 | 234 | $entry = "$action:$id_auteur:$pass:$alea"; |
| 235 | 235 | if (!isset($sha[$entry])) { |
| 236 | - $sha[$entry] = hash_hmac('sha256', "$action::$id_auteur", "$pass::" . _action_get_alea($alea)); |
|
| 236 | + $sha[$entry] = hash_hmac('sha256', "$action::$id_auteur", "$pass::"._action_get_alea($alea)); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | return $sha[$entry]; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | // On nettoie l’URL de tous les var_. |
| 352 | 352 | $url = nettoyer_uri_var($url); |
| 353 | 353 | |
| 354 | - $token = _action_auteur('previsualiser-' . $url, $id_auteur, secret_du_site(), $alea); |
|
| 354 | + $token = _action_auteur('previsualiser-'.$url, $id_auteur, secret_du_site(), $alea); |
|
| 355 | 355 | return "$id_auteur-$token"; |
| 356 | 356 | } |
| 357 | 357 | |
@@ -91,17 +91,17 @@ discard block |
||
| 91 | 91 | $cles = \Spip\Chiffrer\SpipCles::instance(); |
| 92 | 92 | $secret = $cles->getSecretAuth(); |
| 93 | 93 | |
| 94 | - $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 94 | + $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login='.sql_quote($login)); |
|
| 95 | 95 | if ($id_auteur !== null) { |
| 96 | 96 | // c'est un auteur connu : si on a pas de secret il faut absolument qu'il se reconnecte avec le meme mot de passe |
| 97 | 97 | // pour restaurer la copie des cles |
| 98 | 98 | if (!$secret and !auth_spip_initialiser_secret()) { |
| 99 | - $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 99 | + $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur='.intval($id_auteur)); |
|
| 100 | 100 | if (empty($row['backup_cles']) or !$cles->restore($row['backup_cles'], $pass, $row['pass'], $id_auteur)) { |
| 101 | 101 | $echec = _T('avis_connexion_erreur_fichier_cle_manquant_1'); |
| 102 | 102 | echouer_etape_3b($echec); |
| 103 | 103 | } |
| 104 | - spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth' . _LOG_INFO_IMPORTANTE); |
|
| 104 | + spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth'._LOG_INFO_IMPORTANTE); |
|
| 105 | 105 | $cles->save(); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | 'email' => $email, |
| 111 | 111 | 'login' => $login, |
| 112 | 112 | 'statut' => '0minirezo' |
| 113 | - ], 'id_auteur=' . intval($id_auteur)); |
|
| 113 | + ], 'id_auteur='.intval($id_auteur)); |
|
| 114 | 114 | // le passer webmestre separement du reste, au cas ou l'alter n'aurait pas fonctionne |
| 115 | 115 | @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
| 116 | 116 | if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | !$auteur = auth_identifier_login($login, $pass) |
| 153 | 153 | or !auth_loger($auteur) |
| 154 | 154 | ) { |
| 155 | - spip_log("login automatique impossible $auth_spip $session" . (is_countable($row) ? count($row) : 0)); |
|
| 155 | + spip_log("login automatique impossible $auth_spip $session".(is_countable($row) ? count($row) : 0)); |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | function echouer_etape_3b($echec) { |
| 175 | 175 | echo minipres( |
| 176 | 176 | 'AUTO', |
| 177 | - info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 178 | - "<div class='error'><h3>$echec</h3>\n" . |
|
| 179 | - '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 177 | + info_progression_etape(3, 'etape_', 'install/', true). |
|
| 178 | + "<div class='error'><h3>$echec</h3>\n". |
|
| 179 | + '<p>'._T('avis_connexion_echec_2').'</p>'. |
|
| 180 | 180 | '</div>' |
| 181 | 181 | ); |
| 182 | 182 | exit; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $pass_poivre = hash_hmac('sha256', $password_clair, $key); |
| 38 | 38 | return password_verify($pass_poivre, $password_hash); |
| 39 | 39 | } |
| 40 | - spip_log('Aucune clé pour vérifier le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 40 | + spip_log('Aucune clé pour vérifier le mot de passe', 'chiffrer'._LOG_INFO_IMPORTANTE); |
|
| 41 | 41 | return false; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $pass_poivre = hash_hmac('sha256', $password_clair, $key); |
| 60 | 60 | return password_hash($pass_poivre, PASSWORD_DEFAULT); |
| 61 | 61 | } |
| 62 | - spip_log('Aucune clé pour chiffrer le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 62 | + spip_log('Aucune clé pour chiffrer le mot de passe', 'chiffrer'._LOG_INFO_IMPORTANTE); |
|
| 63 | 63 | return null; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | public function generate(string $name): string { |
| 31 | 31 | $key = Chiffrement::keygen(); |
| 32 | 32 | $this->keys[$name] = $key; |
| 33 | - spip_log("Création de la cle $name", 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 33 | + spip_log("Création de la cle $name", 'chiffrer'._LOG_INFO_IMPORTANTE); |
|
| 34 | 34 | return $key; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $result = sql_select( |
| 44 | 44 | 'id_rubrique, id_parent, titre, descriptif, lang', |
| 45 | 45 | 'spip_rubriques', |
| 46 | - 'id_parent=' . intval($collection), |
|
| 46 | + 'id_parent='.intval($collection), |
|
| 47 | 47 | '', |
| 48 | 48 | '0+titre,titre', |
| 49 | 49 | $debut == -1 ? '' : "$debut,$limite" |
@@ -74,19 +74,18 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : |
|
| 78 | - http_img_pack( |
|
| 77 | + $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : http_img_pack( |
|
| 79 | 78 | 'auteur-0minirezo-16.png', |
| 80 | 79 | '', |
| 81 | 80 | " width='16' height='16'", |
| 82 | 81 | _T('image_administrer_rubrique') |
| 83 | - )) . |
|
| 84 | - " <a class='titremlien' dir='$lang_dir'" . |
|
| 85 | - ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='" . $row['lang'] . "'" : '') . |
|
| 86 | - " href='" . |
|
| 87 | - generer_objet_url($id_rubrique, 'rubrique') . |
|
| 88 | - "'><span class='titre'>" . |
|
| 89 | - $rang . $titre |
|
| 82 | + )). |
|
| 83 | + " <a class='titremlien' dir='$lang_dir'". |
|
| 84 | + ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='".$row['lang']."'" : ''). |
|
| 85 | + " href='". |
|
| 86 | + generer_objet_url($id_rubrique, 'rubrique'). |
|
| 87 | + "'><span class='titre'>". |
|
| 88 | + $rang.$titre |
|
| 90 | 89 | . '</span>' |
| 91 | 90 | . (is_string($logo) ? $logo : '') |
| 92 | 91 | . '</a>'; |
@@ -96,8 +95,8 @@ discard block |
||
| 96 | 95 | ; |
| 97 | 96 | |
| 98 | 97 | $res[] = |
| 99 | - debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre) . |
|
| 100 | - $les_sous_enfants . |
|
| 98 | + debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre). |
|
| 99 | + $les_sous_enfants. |
|
| 101 | 100 | fin_cadre_sous_rub(); |
| 102 | 101 | } |
| 103 | 102 | } |
@@ -116,7 +115,7 @@ discard block |
||
| 116 | 115 | * Le contenu du bloc dépliable |
| 117 | 116 | */ |
| 118 | 117 | function sous_enfant_rub($collection2) { |
| 119 | - $nb = sql_countsel('spip_rubriques', 'id_parent=' . intval($collection2)); |
|
| 118 | + $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($collection2)); |
|
| 120 | 119 | |
| 121 | 120 | $retour = ''; |
| 122 | 121 | $pagination = ''; |
@@ -128,23 +127,23 @@ discard block |
||
| 128 | 127 | * Si > 500 on affiche une pagination |
| 129 | 128 | */ |
| 130 | 129 | if ($nb > $limite) { |
| 131 | - $debut = _request('debut_rubrique' . $collection2) ?: $debut; |
|
| 130 | + $debut = _request('debut_rubrique'.$collection2) ?: $debut; |
|
| 132 | 131 | $pagination = chercher_filtre('pagination'); |
| 133 | - $pagination = '<nav class="pagination">' . $pagination( |
|
| 132 | + $pagination = '<nav class="pagination">'.$pagination( |
|
| 134 | 133 | $nb, |
| 135 | - '_rubrique' . $collection2, |
|
| 134 | + '_rubrique'.$collection2, |
|
| 136 | 135 | $debut, |
| 137 | 136 | $limite, |
| 138 | 137 | true, |
| 139 | 138 | 'prive' |
| 140 | - ) . '</nav>'; |
|
| 139 | + ).'</nav>'; |
|
| 141 | 140 | $limite = $debut + $limite; |
| 142 | 141 | } |
| 143 | 142 | |
| 144 | 143 | $result = sql_select( |
| 145 | 144 | 'id_rubrique, id_parent, titre, lang', |
| 146 | 145 | 'spip_rubriques', |
| 147 | - 'id_parent=' . intval($collection2), |
|
| 146 | + 'id_parent='.intval($collection2), |
|
| 148 | 147 | '', |
| 149 | 148 | '0+titre,titre', |
| 150 | 149 | $debut == -1 ? '' : "$debut,$limite" |
@@ -164,14 +163,14 @@ discard block |
||
| 164 | 163 | changer_typo($row['lang']); |
| 165 | 164 | $lang_dir = lang_dir($row['lang']); |
| 166 | 165 | if (autoriser('voir', 'rubrique', $id_rubrique2)) { |
| 167 | - $retour .= "\n<li class='item' dir='$lang_dir'><a href='" . generer_objet_url( |
|
| 166 | + $retour .= "\n<li class='item' dir='$lang_dir'><a href='".generer_objet_url( |
|
| 168 | 167 | $id_rubrique2, |
| 169 | 168 | 'rubrique' |
| 170 | - ) . "'>" . $rang2 . $titre2 . "</a></li>\n"; |
|
| 169 | + )."'>".$rang2.$titre2."</a></li>\n"; |
|
| 171 | 170 | } |
| 172 | 171 | } |
| 173 | 172 | |
| 174 | - $retour = $pagination . $retour . $pagination; |
|
| 173 | + $retour = $pagination.$retour.$pagination; |
|
| 175 | 174 | |
| 176 | 175 | if (!$retour) { |
| 177 | 176 | return ''; |
@@ -180,7 +179,7 @@ discard block |
||
| 180 | 179 | return debut_block_depliable($debut > 0 ? true : false, "enfants$collection2") |
| 181 | 180 | . "\n<ul class='liste-items sous-sous-rub'>\n" |
| 182 | 181 | . $retour |
| 183 | - . "</ul>\n" . fin_block() . "\n\n"; |
|
| 182 | + . "</ul>\n".fin_block()."\n\n"; |
|
| 184 | 183 | } |
| 185 | 184 | |
| 186 | 185 | /** |
@@ -199,13 +198,13 @@ discard block |
||
| 199 | 198 | $debut = 0; |
| 200 | 199 | $limite = 500; |
| 201 | 200 | |
| 202 | - $nb = sql_countsel('spip_rubriques', 'id_parent=' . intval($id_rubrique)); |
|
| 201 | + $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($id_rubrique)); |
|
| 203 | 202 | |
| 204 | 203 | if ($nb > $limite) { |
| 205 | - $debut = _request('debut_rubrique' . $id_rubrique) ?: $debut; |
|
| 204 | + $debut = _request('debut_rubrique'.$id_rubrique) ?: $debut; |
|
| 206 | 205 | $pagination = chercher_filtre('pagination'); |
| 207 | - $pagination = '<br class="nettoyeur"><nav class="pagination">' . |
|
| 208 | - $pagination($nb, '_rubrique' . $id_rubrique, $debut, $limite, true, 'prive') . |
|
| 206 | + $pagination = '<br class="nettoyeur"><nav class="pagination">'. |
|
| 207 | + $pagination($nb, '_rubrique'.$id_rubrique, $debut, $limite, true, 'prive'). |
|
| 209 | 208 | '</nav>'; |
| 210 | 209 | } |
| 211 | 210 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $type .= ($struct->type_requete ?: $struct->table_optionnelle); |
| 30 | 30 | |
| 31 | 31 | if ($struct->jointures_explicites) { |
| 32 | - $type .= ' ' . $struct->jointures_explicites; |
|
| 32 | + $type .= ' '.$struct->jointures_explicites; |
|
| 33 | 33 | } |
| 34 | 34 | if ($struct->table_optionnelle) { |
| 35 | 35 | $type .= '?'; |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $crit = $struct->param; |
| 40 | 40 | if ($crit and !is_array($crit[0])) { |
| 41 | - $type = strtolower($type) . array_shift($crit); |
|
| 41 | + $type = strtolower($type).array_shift($crit); |
|
| 42 | 42 | } |
| 43 | 43 | $crit = decompiler_criteres($struct, $fmt, $prof); |
| 44 | 44 | |
| 45 | - $f = 'format_boucle_' . $fmt; |
|
| 45 | + $f = 'format_boucle_'.$fmt; |
|
| 46 | 46 | |
| 47 | 47 | return $f($preaff, $avant, $nom, $type, $crit, $milieu, $apres, $altern, $postaff, $prof); |
| 48 | 48 | } |
@@ -55,21 +55,20 @@ discard block |
||
| 55 | 55 | $res[] = decompiler_($v, $fmt, $prof); |
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | - $file = is_string($struct->texte) ? $struct->texte : |
|
| 59 | - decompiler_($struct->texte, $fmt, $prof); |
|
| 60 | - $f = 'format_inclure_' . $fmt; |
|
| 58 | + $file = is_string($struct->texte) ? $struct->texte : decompiler_($struct->texte, $fmt, $prof); |
|
| 59 | + $f = 'format_inclure_'.$fmt; |
|
| 61 | 60 | |
| 62 | 61 | return $f($file, $res, $prof); |
| 63 | 62 | } |
| 64 | 63 | |
| 65 | 64 | function decompiler_texte($struct, $fmt = '', $prof = 0) { |
| 66 | - $f = 'format_texte_' . $fmt; |
|
| 65 | + $f = 'format_texte_'.$fmt; |
|
| 67 | 66 | |
| 68 | 67 | return strlen($struct->texte) ? $f($struct->texte, $prof) : ''; |
| 69 | 68 | } |
| 70 | 69 | |
| 71 | 70 | function decompiler_polyglotte($struct, $fmt = '', $prof = 0) { |
| 72 | - $f = 'format_polyglotte_' . $fmt; |
|
| 71 | + $f = 'format_polyglotte_'.$fmt; |
|
| 73 | 72 | |
| 74 | 73 | return $f($struct->traductions, $prof); |
| 75 | 74 | } |
@@ -82,7 +81,7 @@ discard block |
||
| 82 | 81 | |
| 83 | 82 | $filtres = decompiler_liste($struct->param, $fmt, $prof); |
| 84 | 83 | |
| 85 | - $f = 'format_idiome_' . $fmt; |
|
| 84 | + $f = 'format_idiome_'.$fmt; |
|
| 86 | 85 | |
| 87 | 86 | return $f($struct->nom_champ, $struct->module, $args, $filtres, $prof); |
| 88 | 87 | } |
@@ -97,7 +96,7 @@ discard block |
||
| 97 | 96 | } |
| 98 | 97 | $filtres = decompiler_liste($p, $fmt, $prof); |
| 99 | 98 | } |
| 100 | - $f = 'format_champ_' . $fmt; |
|
| 99 | + $f = 'format_champ_'.$fmt; |
|
| 101 | 100 | |
| 102 | 101 | return $f($struct->nom_champ, $struct->nom_boucle, $struct->etoile, $avant, $apres, $args, $filtres, $prof); |
| 103 | 102 | } |
@@ -106,7 +105,7 @@ discard block |
||
| 106 | 105 | if (!is_array($sources)) { |
| 107 | 106 | return ''; |
| 108 | 107 | } |
| 109 | - $f = 'format_liste_' . $fmt; |
|
| 108 | + $f = 'format_liste_'.$fmt; |
|
| 110 | 109 | $res = ''; |
| 111 | 110 | foreach ($sources as $arg) { |
| 112 | 111 | if (!is_array($arg)) { |
@@ -123,7 +122,7 @@ discard block |
||
| 123 | 122 | and (strlen($v[0]->apres) == 1) |
| 124 | 123 | and $v[0]->apres == $v[0]->avant |
| 125 | 124 | ) { |
| 126 | - $args[] = $v[0]->avant . $v[0]->texte . $v[0]->apres; |
|
| 125 | + $args[] = $v[0]->avant.$v[0]->texte.$v[0]->apres; |
|
| 127 | 126 | } else { |
| 128 | 127 | $args[] = decompiler_($v, $fmt, 0 - $prof); |
| 129 | 128 | } |
@@ -146,7 +145,7 @@ discard block |
||
| 146 | 145 | return ''; |
| 147 | 146 | } |
| 148 | 147 | $res = ''; |
| 149 | - $f = 'format_critere_' . $fmt; |
|
| 148 | + $f = 'format_critere_'.$fmt; |
|
| 150 | 149 | foreach ($sources as $crit) { |
| 151 | 150 | if (!is_array($crit)) { |
| 152 | 151 | continue; |
@@ -159,13 +158,13 @@ discard block |
||
| 159 | 158 | and $v[0]->type == 'texte' |
| 160 | 159 | and $v[0]->apres |
| 161 | 160 | ) { |
| 162 | - $args[] = [['texte', ($v[0]->apres . $v[0]->texte . $v[0]->apres)]]; |
|
| 161 | + $args[] = [['texte', ($v[0]->apres.$v[0]->texte.$v[0]->apres)]]; |
|
| 163 | 162 | } else { |
| 164 | 163 | $res2 = []; |
| 165 | 164 | foreach ($v as $k => $p) { |
| 166 | 165 | if ( |
| 167 | 166 | isset($p->type) |
| 168 | - and function_exists($d = 'decompiler_' . $p->type) |
|
| 167 | + and function_exists($d = 'decompiler_'.$p->type) |
|
| 169 | 168 | ) { |
| 170 | 169 | $r = $d($p, $fmt, (0 - $prof)); |
| 171 | 170 | $res2[] = [$p->type, $r]; |
@@ -193,7 +192,7 @@ discard block |
||
| 193 | 192 | if (!isset($p->type)) { |
| 194 | 193 | continue; |
| 195 | 194 | } #?????? |
| 196 | - $d = 'decompiler_' . $p->type; |
|
| 195 | + $d = 'decompiler_'.$p->type; |
|
| 197 | 196 | $next = $liste[$k + 1] ?? false; |
| 198 | 197 | // Forcer le champ etendu si son source (pas les reecritures) |
| 199 | 198 | // contenait des args et s'il est suivi d'espaces, |
@@ -218,16 +217,16 @@ discard block |
||
| 218 | 217 | } |
| 219 | 218 | $contenu[] = [$d($p, $fmt, $prof2), $p->type]; |
| 220 | 219 | } |
| 221 | - $f = 'format_suite_' . $fmt; |
|
| 220 | + $f = 'format_suite_'.$fmt; |
|
| 222 | 221 | |
| 223 | 222 | return $f($contenu); |
| 224 | 223 | } |
| 225 | 224 | |
| 226 | 225 | function public_decompiler($liste, $fmt = '', $prof = 0, $quoi = '') { |
| 227 | - if (!include_spip('public/format_' . $fmt)) { |
|
| 226 | + if (!include_spip('public/format_'.$fmt)) { |
|
| 228 | 227 | return "'$fmt'?"; |
| 229 | 228 | } |
| 230 | - $f = 'decompiler_' . $quoi; |
|
| 229 | + $f = 'decompiler_'.$quoi; |
|
| 231 | 230 | |
| 232 | 231 | return $f($liste, $fmt, $prof); |
| 233 | 232 | } |
@@ -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 |
@@ -96,9 +96,8 @@ discard block |
||
| 96 | 96 | 'id_job', |
| 97 | 97 | 'spip_jobs', |
| 98 | 98 | $duplicate_where = |
| 99 | - $duplicate_where . 'fonction=' . sql_quote($function) |
|
| 100 | - . (($no_duplicate === 'function_only') ? '' : |
|
| 101 | - ' AND md5args=' . sql_quote($md5args) . ' AND inclure=' . sql_quote($file)) |
|
| 99 | + $duplicate_where.'fonction='.sql_quote($function) |
|
| 100 | + . (($no_duplicate === 'function_only') ? '' : ' AND md5args='.sql_quote($md5args).' AND inclure='.sql_quote($file)) |
|
| 102 | 101 | ) |
| 103 | 102 | ) { |
| 104 | 103 | return $id_job; |
@@ -111,9 +110,9 @@ discard block |
||
| 111 | 110 | if ( |
| 112 | 111 | $no_duplicate |
| 113 | 112 | and |
| 114 | - $id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<' . intval($id_job) . " AND $duplicate_where") |
|
| 113 | + $id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<'.intval($id_job)." AND $duplicate_where") |
|
| 115 | 114 | ) { |
| 116 | - sql_delete('spip_jobs', 'id_job=' . intval($id_job)); |
|
| 115 | + sql_delete('spip_jobs', 'id_job='.intval($id_job)); |
|
| 117 | 116 | |
| 118 | 117 | return $id_prev; |
| 119 | 118 | } |
@@ -125,9 +124,9 @@ discard block |
||
| 125 | 124 | // ie cas d'un char non acceptables sur certains type de champs |
| 126 | 125 | // qui coupe la valeur |
| 127 | 126 | if (defined('_JQ_INSERT_CHECK_ARGS') and $id_job) { |
| 128 | - $args = sql_getfetsel('args', 'spip_jobs', 'id_job=' . intval($id_job)); |
|
| 127 | + $args = sql_getfetsel('args', 'spip_jobs', 'id_job='.intval($id_job)); |
|
| 129 | 128 | if ($args !== $arguments) { |
| 130 | - spip_log('arguments job errones / longueur ' . strlen($args) . ' vs ' . strlen($arguments) . ' / valeur : ' . var_export( |
|
| 129 | + spip_log('arguments job errones / longueur '.strlen($args).' vs '.strlen($arguments).' / valeur : '.var_export( |
|
| 131 | 130 | $arguments, |
| 132 | 131 | true |
| 133 | 132 | ), 'queue'); |
@@ -157,7 +156,7 @@ discard block |
||
| 157 | 156 | function queue_purger() { |
| 158 | 157 | include_spip('base/abstract_sql'); |
| 159 | 158 | sql_delete('spip_jobs'); |
| 160 | - sql_delete('spip_jobs_liens', 'id_job NOT IN (' . sql_get_select('id_job', 'spip_jobs') . ')'); |
|
| 159 | + sql_delete('spip_jobs_liens', 'id_job NOT IN ('.sql_get_select('id_job', 'spip_jobs').')'); |
|
| 161 | 160 | include_spip('inc/genie'); |
| 162 | 161 | genie_queue_watch_dist(); |
| 163 | 162 | } |
@@ -173,8 +172,8 @@ discard block |
||
| 173 | 172 | include_spip('base/abstract_sql'); |
| 174 | 173 | |
| 175 | 174 | if ( |
| 176 | - $row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job=' . intval($id_job)) |
|
| 177 | - and $res = sql_delete('spip_jobs', 'id_job=' . intval($id_job)) |
|
| 175 | + $row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job='.intval($id_job)) |
|
| 176 | + and $res = sql_delete('spip_jobs', 'id_job='.intval($id_job)) |
|
| 178 | 177 | ) { |
| 179 | 178 | queue_unlink_job($id_job); |
| 180 | 179 | // est-ce une tache cron qu'il faut relancer ? |
@@ -224,7 +223,7 @@ discard block |
||
| 224 | 223 | * resultat du sql_delete |
| 225 | 224 | */ |
| 226 | 225 | function queue_unlink_job($id_job) { |
| 227 | - return sql_delete('spip_jobs_liens', 'id_job=' . intval($id_job)); |
|
| 226 | + return sql_delete('spip_jobs_liens', 'id_job='.intval($id_job)); |
|
| 228 | 227 | } |
| 229 | 228 | |
| 230 | 229 | /** |
@@ -240,7 +239,7 @@ discard block |
||
| 240 | 239 | // deserialiser les arguments |
| 241 | 240 | $args = unserialize($row['args']); |
| 242 | 241 | if (!is_array($args)) { |
| 243 | - spip_log('arguments job errones ' . var_export($row, true), 'queue'); |
|
| 242 | + spip_log('arguments job errones '.var_export($row, true), 'queue'); |
|
| 244 | 243 | $args = []; |
| 245 | 244 | } |
| 246 | 245 | |
@@ -257,14 +256,14 @@ discard block |
||
| 257 | 256 | } |
| 258 | 257 | |
| 259 | 258 | if (!function_exists($fonction)) { |
| 260 | - spip_log("fonction $fonction ($inclure) inexistante " . var_export($row, true), 'queue'); |
|
| 259 | + spip_log("fonction $fonction ($inclure) inexistante ".var_export($row, true), 'queue'); |
|
| 261 | 260 | |
| 262 | 261 | return false; |
| 263 | 262 | } |
| 264 | 263 | |
| 265 | - spip_log('queue [' . $row['id_job'] . "]: $fonction() start", 'queue'); |
|
| 264 | + spip_log('queue ['.$row['id_job']."]: $fonction() start", 'queue'); |
|
| 266 | 265 | $res = $fonction(...$args); |
| 267 | - spip_log('queue [' . $row['id_job'] . "]: $fonction() end", 'queue'); |
|
| 266 | + spip_log('queue ['.$row['id_job']."]: $fonction() end", 'queue'); |
|
| 268 | 267 | |
| 269 | 268 | return $res; |
| 270 | 269 | } |
@@ -295,14 +294,14 @@ discard block |
||
| 295 | 294 | function queue_schedule($force_jobs = null) { |
| 296 | 295 | $time = time(); |
| 297 | 296 | if (defined('_DEBUG_BLOCK_QUEUE')) { |
| 298 | - spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq' . _LOG_DEBUG); |
|
| 297 | + spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq'._LOG_DEBUG); |
|
| 299 | 298 | |
| 300 | 299 | return; |
| 301 | 300 | } |
| 302 | 301 | |
| 303 | 302 | // rien a faire si le prochain job est encore dans le futur |
| 304 | 303 | if (queue_sleep_time_to_next_job() > 0 and (!$force_jobs or !count($force_jobs))) { |
| 305 | - spip_log('queue_sleep_time_to_next_job', 'jq' . _LOG_DEBUG); |
|
| 304 | + spip_log('queue_sleep_time_to_next_job', 'jq'._LOG_DEBUG); |
|
| 306 | 305 | |
| 307 | 306 | return; |
| 308 | 307 | } |
@@ -323,7 +322,7 @@ discard block |
||
| 323 | 322 | } |
| 324 | 323 | $end_time = $time + _JQ_MAX_JOBS_TIME_TO_EXECUTE; |
| 325 | 324 | |
| 326 | - spip_log("JQ schedule $time / $end_time", 'jq' . _LOG_DEBUG); |
|
| 325 | + spip_log("JQ schedule $time / $end_time", 'jq'._LOG_DEBUG); |
|
| 327 | 326 | |
| 328 | 327 | if (!defined('_JQ_MAX_JOBS_EXECUTE')) { |
| 329 | 328 | define('_JQ_MAX_JOBS_EXECUTE', 200); |
@@ -337,19 +336,19 @@ discard block |
||
| 337 | 336 | // lorsqu'un job cron n'a pas fini, sa priorite est descendue |
| 338 | 337 | // pour qu'il ne bloque pas les autres jobs en attente |
| 339 | 338 | if (is_array($force_jobs) and count($force_jobs)) { |
| 340 | - $cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND ' . sql_in('id_job', $force_jobs); |
|
| 339 | + $cond = 'status='.intval(_JQ_SCHEDULED).' AND '.sql_in('id_job', $force_jobs); |
|
| 341 | 340 | } else { |
| 342 | 341 | $now = date('Y-m-d H:i:s', $time); |
| 343 | - $cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND date<=' . sql_quote($now); |
|
| 342 | + $cond = 'status='.intval(_JQ_SCHEDULED).' AND date<='.sql_quote($now); |
|
| 344 | 343 | } |
| 345 | 344 | |
| 346 | 345 | register_shutdown_function('queue_error_handler'); // recuperer les erreurs auant que possible |
| 347 | - $res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,' . (_JQ_MAX_JOBS_EXECUTE + 1)); |
|
| 346 | + $res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,'.(_JQ_MAX_JOBS_EXECUTE + 1)); |
|
| 348 | 347 | do { |
| 349 | 348 | if ($row = array_shift($res)) { |
| 350 | 349 | $nbj++; |
| 351 | 350 | // il faut un verrou, a base de sql_delete |
| 352 | - if (sql_delete('spip_jobs', 'id_job=' . intval($row['id_job']) . ' AND status=' . intval(_JQ_SCHEDULED))) { |
|
| 351 | + if (sql_delete('spip_jobs', 'id_job='.intval($row['id_job']).' AND status='.intval(_JQ_SCHEDULED))) { |
|
| 353 | 352 | #spip_log("JQ schedule job ".$nbj." OK",'jq'); |
| 354 | 353 | // on reinsert dans la base aussitot avec un status=_JQ_PENDING |
| 355 | 354 | $row['status'] = _JQ_PENDING; |
@@ -364,13 +363,13 @@ discard block |
||
| 364 | 363 | queue_close_job($row, $time, $result); |
| 365 | 364 | } |
| 366 | 365 | } |
| 367 | - spip_log('JQ schedule job end time ' . $time, 'jq' . _LOG_DEBUG); |
|
| 366 | + spip_log('JQ schedule job end time '.$time, 'jq'._LOG_DEBUG); |
|
| 368 | 367 | } while ($nbj < _JQ_MAX_JOBS_EXECUTE and $row and $time < $end_time); |
| 369 | - spip_log('JQ schedule end time ' . time(), 'jq' . _LOG_DEBUG); |
|
| 368 | + spip_log('JQ schedule end time '.time(), 'jq'._LOG_DEBUG); |
|
| 370 | 369 | |
| 371 | 370 | if ($row = array_shift($res)) { |
| 372 | 371 | queue_update_next_job_time(0); // on sait qu'il y a encore des jobs a lancer ASAP |
| 373 | - spip_log('JQ encore !', 'jq' . _LOG_DEBUG); |
|
| 372 | + spip_log('JQ encore !', 'jq'._LOG_DEBUG); |
|
| 374 | 373 | } else { |
| 375 | 374 | queue_update_next_job_time(); |
| 376 | 375 | } |
@@ -405,9 +404,9 @@ discard block |
||
| 405 | 404 | } |
| 406 | 405 | } |
| 407 | 406 | // purger ses liens eventuels avec des objets |
| 408 | - sql_delete('spip_jobs_liens', 'id_job=' . intval($row['id_job'])); |
|
| 407 | + sql_delete('spip_jobs_liens', 'id_job='.intval($row['id_job'])); |
|
| 409 | 408 | // supprimer le job fini |
| 410 | - sql_delete('spip_jobs', 'id_job=' . intval($row['id_job'])); |
|
| 409 | + sql_delete('spip_jobs', 'id_job='.intval($row['id_job'])); |
|
| 411 | 410 | } |
| 412 | 411 | |
| 413 | 412 | /** |
@@ -480,18 +479,18 @@ discard block |
||
| 480 | 479 | $res = sql_allfetsel( |
| 481 | 480 | '*', |
| 482 | 481 | 'spip_jobs', |
| 483 | - 'status=' . intval(_JQ_PENDING) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time - 180)) |
|
| 482 | + 'status='.intval(_JQ_PENDING).' AND date<'.sql_quote(date('Y-m-d H:i:s', $time - 180)) |
|
| 484 | 483 | ); |
| 485 | 484 | if (is_array($res)) { |
| 486 | 485 | foreach ($res as $row) { |
| 487 | 486 | queue_close_job($row, $time); |
| 488 | - spip_log('queue_close_job car _JQ_PENDING depuis +180s : ' . print_r($row, 1), 'job_mort' . _LOG_ERREUR); |
|
| 487 | + spip_log('queue_close_job car _JQ_PENDING depuis +180s : '.print_r($row, 1), 'job_mort'._LOG_ERREUR); |
|
| 489 | 488 | } |
| 490 | 489 | } |
| 491 | 490 | |
| 492 | 491 | // chercher la date du prochain job si pas connu |
| 493 | 492 | if (is_null($next) or is_null(queue_sleep_time_to_next_job())) { |
| 494 | - $date = sql_getfetsel('date', 'spip_jobs', 'status=' . intval(_JQ_SCHEDULED), '', 'date', '0,1'); |
|
| 493 | + $date = sql_getfetsel('date', 'spip_jobs', 'status='.intval(_JQ_SCHEDULED), '', 'date', '0,1'); |
|
| 495 | 494 | $next = strtotime($date); |
| 496 | 495 | } |
| 497 | 496 | if (!is_null($next_time)) { |
@@ -504,7 +503,7 @@ discard block |
||
| 504 | 503 | if (is_null($nb_jobs_scheduled)) { |
| 505 | 504 | $nb_jobs_scheduled = sql_countsel( |
| 506 | 505 | 'spip_jobs', |
| 507 | - 'status=' . intval(_JQ_SCHEDULED) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time)) |
|
| 506 | + 'status='.intval(_JQ_SCHEDULED).' AND date<'.sql_quote(date('Y-m-d H:i:s', $time)) |
|
| 508 | 507 | ); |
| 509 | 508 | } elseif ($next <= $time) { |
| 510 | 509 | $nb_jobs_scheduled++; |
@@ -573,7 +572,7 @@ discard block |
||
| 573 | 572 | } |
| 574 | 573 | |
| 575 | 574 | // ne pas relancer si on vient de lancer dans la meme seconde par un hit concurent |
| 576 | - if (file_exists($lock = _DIR_TMP . 'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) { |
|
| 575 | + if (file_exists($lock = _DIR_TMP.'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) { |
|
| 577 | 576 | return $texte; |
| 578 | 577 | } |
| 579 | 578 | |
@@ -645,7 +644,7 @@ discard block |
||
| 645 | 644 | $port = 80; |
| 646 | 645 | } |
| 647 | 646 | $fp = @fsockopen( |
| 648 | - $scheme . $parts['host'], |
|
| 647 | + $scheme.$parts['host'], |
|
| 649 | 648 | $parts['port'] ?? $port, |
| 650 | 649 | $errno, |
| 651 | 650 | $errstr, |
@@ -655,13 +654,13 @@ discard block |
||
| 655 | 654 | if ($fp) { |
| 656 | 655 | $host_sent = $parts['host']; |
| 657 | 656 | if (isset($parts['port']) and $parts['port'] !== $port) { |
| 658 | - $host_sent .= ':' . $parts['port']; |
|
| 657 | + $host_sent .= ':'.$parts['port']; |
|
| 659 | 658 | } |
| 660 | 659 | $timeout = 200; // ms |
| 661 | 660 | stream_set_timeout($fp, 0, $timeout * 1000); |
| 662 | - $query = $parts['path'] . ($parts['query'] ? '?' . $parts['query'] : ''); |
|
| 663 | - $out = 'GET ' . $query . " HTTP/1.1\r\n"; |
|
| 664 | - $out .= 'Host: ' . $host_sent . "\r\n"; |
|
| 661 | + $query = $parts['path'].($parts['query'] ? '?'.$parts['query'] : ''); |
|
| 662 | + $out = 'GET '.$query." HTTP/1.1\r\n"; |
|
| 663 | + $out .= 'Host: '.$host_sent."\r\n"; |
|
| 665 | 664 | $out .= "Connection: Close\r\n\r\n"; |
| 666 | 665 | fwrite($fp, $out); |
| 667 | 666 | spip_timer('read'); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | // in fine renommer le prefixe si besoin |
| 107 | 107 | if (strpos($name, 'spip_') === 0) { |
| 108 | - $name = $GLOBALS['cookie_prefix'] . '_' . substr($name, 5); |
|
| 108 | + $name = $GLOBALS['cookie_prefix'].'_'.substr($name, 5); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | #spip_log("cookie('$name', '$value', " . json_encode($options, true) . ")", "cookies"); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | foreach ($_COOKIE as $name => $value) { |
| 165 | 165 | if (substr($name, 0, $prefix_long) == $cookie_prefix) { |
| 166 | - $spipname = preg_replace('/^' . $cookie_prefix . '_/', 'spip_', $name); |
|
| 166 | + $spipname = preg_replace('/^'.$cookie_prefix.'_/', 'spip_', $name); |
|
| 167 | 167 | $_COOKIE[$spipname] = $value; |
| 168 | 168 | $GLOBALS[$spipname] = $value; |
| 169 | 169 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $id_rubrique, |
| 151 | 151 | [ |
| 152 | 152 | 'data' => $set, |
| 153 | - 'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique] |
|
| 153 | + 'nonvide' => ['titre' => _T('titre_nouvelle_rubrique').' '._T('info_numero_abbreviation').$id_rubrique] |
|
| 154 | 154 | ], |
| 155 | 155 | $c |
| 156 | 156 | ) |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | ) |
| 255 | 255 | ) { |
| 256 | 256 | if ($s['statut'] != 'prepa') { |
| 257 | - spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']); |
|
| 257 | + spip_log("deplacement de $id_rubrique vers $id_parent refuse a ".$GLOBALS['visiteur_session']['id_auteur'].' '.$GLOBALS['visiteur_session']['statut']); |
|
| 258 | 258 | } |
| 259 | 259 | } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
| 260 | 260 | $statut_ancien = $s['statut']; |