@@ -362,9 +362,11 @@ discard block |
||
| 362 | 362 | if (!preg_match('/^(.*)(<\?.*\?>)(.*)$/s', $v[0], $r)) { |
| 363 | 363 | $y = substr_count($v[0], "\n"); |
| 364 | 364 | } else { |
| 365 | - if ($v[1][0] == '#') // balise dynamique |
|
| 365 | + if ($v[1][0] == '#') { |
|
| 366 | + // balise dynamique |
|
| 366 | 367 | { |
| 367 | 368 | $incl = $GLOBALS['debug_objets']['resultat'][$v[2]]; |
| 369 | + } |
|
| 368 | 370 | } else // inclusion |
| 369 | 371 | { |
| 370 | 372 | $incl = $GLOBALS['debug_objets']['squelette'][trouve_squelette_inclus($v[0])]; |
@@ -397,12 +399,14 @@ discard block |
||
| 397 | 399 | preg_match('/include\(.(.*).php3?.\);/', $script, $reg); |
| 398 | 400 | // si le script X.php n'est pas ecrire/public.php |
| 399 | 401 | // on suppose qu'il prend le squelette X.html (pas sur, mais y a pas mieux) |
| 400 | - if ($reg[1] == 'ecrire/public') // si c'est bien ecrire/public on cherche le param 'fond' |
|
| 402 | + if ($reg[1] == 'ecrire/public') { |
|
| 403 | + // si c'est bien ecrire/public on cherche le param 'fond' |
|
| 401 | 404 | { |
| 402 | 405 | if (!preg_match("/'fond' => '([^']*)'/", $script, $reg)) // a defaut on cherche le param 'page' |
| 403 | 406 | { |
| 404 | 407 | if (!preg_match("/'param' => '([^']*)'/", $script, $reg)) { |
| 405 | 408 | $reg[1] = "inconnu"; |
| 409 | + } |
|
| 406 | 410 | } |
| 407 | 411 | } |
| 408 | 412 | } |
@@ -432,6 +432,10 @@ discard block |
||
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | // https://code.spip.net/@reference_boucle_debug |
| 435 | +/** |
|
| 436 | + * @param string $nom |
|
| 437 | + * @param string $self |
|
| 438 | + */ |
|
| 435 | 439 | function reference_boucle_debug($n, $nom, $self) { |
| 436 | 440 | list($skel, $boucle, $ligne) = trouve_boucle_debug($n, $nom); |
| 437 | 441 | |
@@ -820,6 +824,9 @@ discard block |
||
| 820 | 824 | } |
| 821 | 825 | |
| 822 | 826 | // https://code.spip.net/@debusquer_entete |
| 827 | +/** |
|
| 828 | + * @param string $corps |
|
| 829 | + */ |
|
| 823 | 830 | function debusquer_entete($titre, $corps) { |
| 824 | 831 | |
| 825 | 832 | include_spip('balise/formulaire_admin'); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('public/decompiler'); |
@@ -66,135 +66,135 @@ discard block |
||
| 66 | 66 | * - string si $message à false. |
| 67 | 67 | **/ |
| 68 | 68 | function public_debusquer_dist($message = '', $lieu = '', $opt = array()) { |
| 69 | - static $tableau_des_erreurs = array(); |
|
| 70 | - |
|
| 71 | - // Pour des tests unitaires, pouvoir récupérer les erreurs générées |
|
| 72 | - if (isset($opt['erreurs'])) { |
|
| 73 | - if ($opt['erreurs'] == 'get') { |
|
| 74 | - return $tableau_des_erreurs; |
|
| 75 | - } |
|
| 76 | - if ($opt['erreurs'] == 'reset') { |
|
| 77 | - $tableau_des_erreurs = array(); |
|
| 78 | - |
|
| 79 | - return true; |
|
| 80 | - } |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - // Erreur ou appel final ? |
|
| 84 | - if ($message) { |
|
| 85 | - $message = debusquer_compose_message($message); |
|
| 86 | - $tableau_des_erreurs[] = array($message, $lieu); |
|
| 87 | - set_request('var_mode', 'debug'); |
|
| 88 | - $GLOBALS['bouton_admin_debug'] = true; |
|
| 89 | - // Permettre a la compil de continuer |
|
| 90 | - if (is_object($lieu) and (!isset($lieu->code) or !$lieu->code)) { |
|
| 91 | - $lieu->code = "''"; |
|
| 92 | - } |
|
| 93 | - // forcer l'appel au debusqueur en cas de boucles infernales |
|
| 94 | - $urgence = (_DEBUG_MAX_SQUELETTE_ERREURS and count($tableau_des_erreurs) > _DEBUG_MAX_SQUELETTE_ERREURS); |
|
| 95 | - if (!$urgence) { |
|
| 96 | - return; |
|
| 97 | - } |
|
| 98 | - } |
|
| 99 | - if (empty($GLOBALS['debug_objets']['principal'])) { |
|
| 100 | - // espace public ? |
|
| 101 | - if (isset($GLOBALS['fond'])) { |
|
| 102 | - $GLOBALS['debug_objets']['principal'] = $GLOBALS['fond']; |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - include_spip('inc/autoriser'); |
|
| 107 | - if (!autoriser('debug')) { |
|
| 108 | - return; |
|
| 109 | - } |
|
| 110 | - include_spip('inc/headers'); |
|
| 111 | - include_spip('inc/filtres'); |
|
| 112 | - |
|
| 113 | - // en cas de squelette inclus, virer le code de l'incluant: |
|
| 114 | - // - il contient souvent une Div restreignant la largeur a 3 fois rien |
|
| 115 | - // - ca fait 2 headers ! |
|
| 116 | - // sauf si l'on se trouve deja dans un flux compresse (plugin compresseur |
|
| 117 | - // actif par exemple) |
|
| 118 | - if (ob_get_length() |
|
| 119 | - and |
|
| 120 | - !in_array('ob_gzhandler', ob_get_status()) |
|
| 121 | - ) { |
|
| 122 | - ob_end_clean(); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - lang_select($GLOBALS['visiteur_session']['lang']); |
|
| 126 | - $fonc = _request('var_mode_objet'); |
|
| 127 | - $mode = _request('var_mode_affiche'); |
|
| 128 | - $self = str_replace("\\'", ''', self()); |
|
| 129 | - $self = parametre_url($self, 'var_mode', 'debug'); |
|
| 130 | - |
|
| 131 | - $res = debusquer_bandeau($tableau_des_erreurs) |
|
| 132 | - . '<br />' |
|
| 133 | - . debusquer_squelette($fonc, $mode, $self); |
|
| 134 | - |
|
| 135 | - if (!_DIR_RESTREINT or headers_sent()) { |
|
| 136 | - return $res; |
|
| 137 | - } |
|
| 138 | - if ($tableau_des_erreurs) { |
|
| 139 | - http_status(503); |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - http_no_cache(); |
|
| 143 | - if (isset($_GET['var_profile'])) { |
|
| 144 | - $titre = parametre_url($GLOBALS['REQUEST_URI'], 'var_profile', ''); |
|
| 145 | - $titre = parametre_url($titre, 'var_mode', ''); |
|
| 146 | - } else { |
|
| 147 | - if (!$fonc) { |
|
| 148 | - $fonc = $GLOBALS['debug_objets']['principal']; |
|
| 149 | - } |
|
| 150 | - $titre = !$mode ? $fonc : ($mode . (isset($GLOBALS['debug_objets']['sourcefile'][$fonc]) ? " " . $GLOBALS['debug_objets']['sourcefile'][$fonc] : "")); |
|
| 151 | - } |
|
| 152 | - if ($message === false) { |
|
| 153 | - lang_select(); |
|
| 154 | - |
|
| 155 | - return debusquer_entete($titre, $res); |
|
| 156 | - } else { |
|
| 157 | - echo debusquer_entete($titre, $res); |
|
| 158 | - } |
|
| 159 | - exit; |
|
| 69 | + static $tableau_des_erreurs = array(); |
|
| 70 | + |
|
| 71 | + // Pour des tests unitaires, pouvoir récupérer les erreurs générées |
|
| 72 | + if (isset($opt['erreurs'])) { |
|
| 73 | + if ($opt['erreurs'] == 'get') { |
|
| 74 | + return $tableau_des_erreurs; |
|
| 75 | + } |
|
| 76 | + if ($opt['erreurs'] == 'reset') { |
|
| 77 | + $tableau_des_erreurs = array(); |
|
| 78 | + |
|
| 79 | + return true; |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + // Erreur ou appel final ? |
|
| 84 | + if ($message) { |
|
| 85 | + $message = debusquer_compose_message($message); |
|
| 86 | + $tableau_des_erreurs[] = array($message, $lieu); |
|
| 87 | + set_request('var_mode', 'debug'); |
|
| 88 | + $GLOBALS['bouton_admin_debug'] = true; |
|
| 89 | + // Permettre a la compil de continuer |
|
| 90 | + if (is_object($lieu) and (!isset($lieu->code) or !$lieu->code)) { |
|
| 91 | + $lieu->code = "''"; |
|
| 92 | + } |
|
| 93 | + // forcer l'appel au debusqueur en cas de boucles infernales |
|
| 94 | + $urgence = (_DEBUG_MAX_SQUELETTE_ERREURS and count($tableau_des_erreurs) > _DEBUG_MAX_SQUELETTE_ERREURS); |
|
| 95 | + if (!$urgence) { |
|
| 96 | + return; |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | + if (empty($GLOBALS['debug_objets']['principal'])) { |
|
| 100 | + // espace public ? |
|
| 101 | + if (isset($GLOBALS['fond'])) { |
|
| 102 | + $GLOBALS['debug_objets']['principal'] = $GLOBALS['fond']; |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + include_spip('inc/autoriser'); |
|
| 107 | + if (!autoriser('debug')) { |
|
| 108 | + return; |
|
| 109 | + } |
|
| 110 | + include_spip('inc/headers'); |
|
| 111 | + include_spip('inc/filtres'); |
|
| 112 | + |
|
| 113 | + // en cas de squelette inclus, virer le code de l'incluant: |
|
| 114 | + // - il contient souvent une Div restreignant la largeur a 3 fois rien |
|
| 115 | + // - ca fait 2 headers ! |
|
| 116 | + // sauf si l'on se trouve deja dans un flux compresse (plugin compresseur |
|
| 117 | + // actif par exemple) |
|
| 118 | + if (ob_get_length() |
|
| 119 | + and |
|
| 120 | + !in_array('ob_gzhandler', ob_get_status()) |
|
| 121 | + ) { |
|
| 122 | + ob_end_clean(); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + lang_select($GLOBALS['visiteur_session']['lang']); |
|
| 126 | + $fonc = _request('var_mode_objet'); |
|
| 127 | + $mode = _request('var_mode_affiche'); |
|
| 128 | + $self = str_replace("\\'", ''', self()); |
|
| 129 | + $self = parametre_url($self, 'var_mode', 'debug'); |
|
| 130 | + |
|
| 131 | + $res = debusquer_bandeau($tableau_des_erreurs) |
|
| 132 | + . '<br />' |
|
| 133 | + . debusquer_squelette($fonc, $mode, $self); |
|
| 134 | + |
|
| 135 | + if (!_DIR_RESTREINT or headers_sent()) { |
|
| 136 | + return $res; |
|
| 137 | + } |
|
| 138 | + if ($tableau_des_erreurs) { |
|
| 139 | + http_status(503); |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + http_no_cache(); |
|
| 143 | + if (isset($_GET['var_profile'])) { |
|
| 144 | + $titre = parametre_url($GLOBALS['REQUEST_URI'], 'var_profile', ''); |
|
| 145 | + $titre = parametre_url($titre, 'var_mode', ''); |
|
| 146 | + } else { |
|
| 147 | + if (!$fonc) { |
|
| 148 | + $fonc = $GLOBALS['debug_objets']['principal']; |
|
| 149 | + } |
|
| 150 | + $titre = !$mode ? $fonc : ($mode . (isset($GLOBALS['debug_objets']['sourcefile'][$fonc]) ? " " . $GLOBALS['debug_objets']['sourcefile'][$fonc] : "")); |
|
| 151 | + } |
|
| 152 | + if ($message === false) { |
|
| 153 | + lang_select(); |
|
| 154 | + |
|
| 155 | + return debusquer_entete($titre, $res); |
|
| 156 | + } else { |
|
| 157 | + echo debusquer_entete($titre, $res); |
|
| 158 | + } |
|
| 159 | + exit; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | function debusquer_compose_message($msg) { |
| 163 | - if (is_array($msg)) { |
|
| 164 | - // si c'est un texte, c'est une traduction a faire, mais |
|
| 165 | - // sqlite renvoit aussi des erreurs alpha num (mais avec 3 arguments) |
|
| 166 | - if (!is_numeric($msg[0]) and count($msg) == 2) { |
|
| 167 | - // message avec argument: instancier |
|
| 168 | - $msg = _T($msg[0], $msg[1], 'spip-debug-arg'); |
|
| 169 | - } else { |
|
| 170 | - // message SQL: interpreter |
|
| 171 | - $msg = debusquer_requete($msg); |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - // FIXME: le fond n'est pas la si on n'est pas dans un squelette |
|
| 175 | - // cela dit, ca serait bien d'indiquer tout de meme d'ou vient l'erreur |
|
| 176 | - $fond = isset($GLOBALS['fond']) ? $GLOBALS['fond'] : ""; |
|
| 177 | - // une erreur critique sort $message en array |
|
| 178 | - $debug = is_array($msg) ? $msg[1] : $msg; |
|
| 179 | - spip_log("Debug: " . $debug . " (" . $fond . ")"); |
|
| 180 | - |
|
| 181 | - return $msg; |
|
| 163 | + if (is_array($msg)) { |
|
| 164 | + // si c'est un texte, c'est une traduction a faire, mais |
|
| 165 | + // sqlite renvoit aussi des erreurs alpha num (mais avec 3 arguments) |
|
| 166 | + if (!is_numeric($msg[0]) and count($msg) == 2) { |
|
| 167 | + // message avec argument: instancier |
|
| 168 | + $msg = _T($msg[0], $msg[1], 'spip-debug-arg'); |
|
| 169 | + } else { |
|
| 170 | + // message SQL: interpreter |
|
| 171 | + $msg = debusquer_requete($msg); |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + // FIXME: le fond n'est pas la si on n'est pas dans un squelette |
|
| 175 | + // cela dit, ca serait bien d'indiquer tout de meme d'ou vient l'erreur |
|
| 176 | + $fond = isset($GLOBALS['fond']) ? $GLOBALS['fond'] : ""; |
|
| 177 | + // une erreur critique sort $message en array |
|
| 178 | + $debug = is_array($msg) ? $msg[1] : $msg; |
|
| 179 | + spip_log("Debug: " . $debug . " (" . $fond . ")"); |
|
| 180 | + |
|
| 181 | + return $msg; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | function debusquer_bandeau($erreurs) { |
| 185 | 185 | |
| 186 | - if (!empty($erreurs)) { |
|
| 187 | - $n = array(count($erreurs) . ' ' . _T('zbug_erreur_squelette')); |
|
| 186 | + if (!empty($erreurs)) { |
|
| 187 | + $n = array(count($erreurs) . ' ' . _T('zbug_erreur_squelette')); |
|
| 188 | 188 | |
| 189 | - return debusquer_navigation($erreurs, $n); |
|
| 190 | - } elseif (!empty($GLOBALS['tableau_des_temps'])) { |
|
| 191 | - include_spip('public/tracer'); |
|
| 192 | - list($temps, $nav) = chrono_requete($GLOBALS['tableau_des_temps']); |
|
| 189 | + return debusquer_navigation($erreurs, $n); |
|
| 190 | + } elseif (!empty($GLOBALS['tableau_des_temps'])) { |
|
| 191 | + include_spip('public/tracer'); |
|
| 192 | + list($temps, $nav) = chrono_requete($GLOBALS['tableau_des_temps']); |
|
| 193 | 193 | |
| 194 | - return debusquer_navigation($temps, $nav, 'debug-profile'); |
|
| 195 | - } else { |
|
| 196 | - return ''; |
|
| 197 | - } |
|
| 194 | + return debusquer_navigation($temps, $nav, 'debug-profile'); |
|
| 195 | + } else { |
|
| 196 | + return ''; |
|
| 197 | + } |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -204,42 +204,42 @@ discard block |
||
| 204 | 204 | * @return string Code HTML |
| 205 | 205 | **/ |
| 206 | 206 | function debusquer_contexte($env) { |
| 207 | - if (is_string($env) and is_array($env_tab = @unserialize($env))) { |
|
| 208 | - $env = $env_tab; |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - if (!$env) { |
|
| 212 | - return ''; |
|
| 213 | - } |
|
| 214 | - $res = ""; |
|
| 215 | - foreach ($env as $nom => $valeur) { |
|
| 216 | - if (is_array($valeur)) { |
|
| 217 | - $valeur_simple = array(); |
|
| 218 | - foreach ($valeur as $v) { |
|
| 219 | - if (is_array($v)) { |
|
| 220 | - $valeur_simple[] = 'array:' . count($v); |
|
| 221 | - } elseif (is_object($v)) { |
|
| 222 | - $valeur_simple[] = get_class($v); |
|
| 223 | - } elseif (is_string($v)) { |
|
| 224 | - $valeur_simple[] = "'" . $v . "'"; |
|
| 225 | - } else { |
|
| 226 | - $valeur_simple[] = $v; |
|
| 227 | - } |
|
| 228 | - } |
|
| 229 | - $n = count($valeur); |
|
| 230 | - $valeur = (($n > 3) ? 'array:' . $n . ' ' : ''); |
|
| 231 | - $valeur .= '[' . join(', ', $valeur_simple) . ']'; |
|
| 232 | - } elseif (is_object($valeur)) { |
|
| 233 | - $valeur = get_class($valeur); |
|
| 234 | - } elseif (is_string($valeur)) { |
|
| 235 | - $valeur = "'" . $valeur . "'"; |
|
| 236 | - } |
|
| 237 | - $res .= "\n<tr><td><strong>" . nl2br(entites_html($nom)) |
|
| 238 | - . "</strong></td><td>: " . nl2br(entites_html($valeur)) |
|
| 239 | - . "</td></tr>\n"; |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - return "<div class='spip-env'><fieldset><legend onclick=\"this.parentElement.classList.toggle('expanded');\">#ENV</legend>\n<div><table>$res</table></div></fieldset></div>\n"; |
|
| 207 | + if (is_string($env) and is_array($env_tab = @unserialize($env))) { |
|
| 208 | + $env = $env_tab; |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + if (!$env) { |
|
| 212 | + return ''; |
|
| 213 | + } |
|
| 214 | + $res = ""; |
|
| 215 | + foreach ($env as $nom => $valeur) { |
|
| 216 | + if (is_array($valeur)) { |
|
| 217 | + $valeur_simple = array(); |
|
| 218 | + foreach ($valeur as $v) { |
|
| 219 | + if (is_array($v)) { |
|
| 220 | + $valeur_simple[] = 'array:' . count($v); |
|
| 221 | + } elseif (is_object($v)) { |
|
| 222 | + $valeur_simple[] = get_class($v); |
|
| 223 | + } elseif (is_string($v)) { |
|
| 224 | + $valeur_simple[] = "'" . $v . "'"; |
|
| 225 | + } else { |
|
| 226 | + $valeur_simple[] = $v; |
|
| 227 | + } |
|
| 228 | + } |
|
| 229 | + $n = count($valeur); |
|
| 230 | + $valeur = (($n > 3) ? 'array:' . $n . ' ' : ''); |
|
| 231 | + $valeur .= '[' . join(', ', $valeur_simple) . ']'; |
|
| 232 | + } elseif (is_object($valeur)) { |
|
| 233 | + $valeur = get_class($valeur); |
|
| 234 | + } elseif (is_string($valeur)) { |
|
| 235 | + $valeur = "'" . $valeur . "'"; |
|
| 236 | + } |
|
| 237 | + $res .= "\n<tr><td><strong>" . nl2br(entites_html($nom)) |
|
| 238 | + . "</strong></td><td>: " . nl2br(entites_html($valeur)) |
|
| 239 | + . "</td></tr>\n"; |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + return "<div class='spip-env'><fieldset><legend onclick=\"this.parentElement.classList.toggle('expanded');\">#ENV</legend>\n<div><table>$res</table></div></fieldset></div>\n"; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | // Affichage du tableau des erreurs ou des temps de calcul |
@@ -247,67 +247,67 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | function debusquer_navigation($tableau, $caption = array(), $id = 'debug-nav') { |
| 249 | 249 | |
| 250 | - if (_request('exec') == 'valider_xml') { |
|
| 251 | - return ''; |
|
| 252 | - } |
|
| 253 | - $GLOBALS['bouton_admin_debug'] = true; |
|
| 254 | - $res = ''; |
|
| 255 | - $href = quote_amp(parametre_url($GLOBALS['REQUEST_URI'], 'var_mode', 'debug')); |
|
| 256 | - foreach ($tableau as $i => $err) { |
|
| 257 | - $boucle = $ligne = $skel = ''; |
|
| 258 | - list($msg, $lieu) = $err; |
|
| 259 | - if (is_object($lieu)) { |
|
| 260 | - $ligne = $lieu->ligne; |
|
| 261 | - $boucle = $lieu->id_boucle ? $lieu->id_boucle : ''; |
|
| 262 | - if (isset($lieu->descr['nom'])) { |
|
| 263 | - $nom_code = $lieu->descr['nom']; |
|
| 264 | - $skel = $lieu->descr['sourcefile']; |
|
| 265 | - $h2 = parametre_url($href, 'var_mode_objet', $nom_code); |
|
| 266 | - $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette') . '#L' . $ligne; |
|
| 267 | - $skel = "<a href='$h3'><b>$skel</b></a>"; |
|
| 268 | - if ($boucle) { |
|
| 269 | - $h3 = parametre_url($h2 . $boucle, 'var_mode_affiche', 'boucle'); |
|
| 270 | - $boucle = "<a href='$h3'><b>$boucle</b></a>"; |
|
| 271 | - } |
|
| 272 | - } |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - $j = ($i + 1); |
|
| 276 | - $res .= "<tr id='req$j'><td style='text-align: right'>" |
|
| 277 | - . $j |
|
| 278 | - . " </td><td style='text-align: left'>" |
|
| 279 | - . (is_array($msg) ? implode('', $msg) : $msg) |
|
| 280 | - . "</td><td style='text-align: left'>" |
|
| 281 | - . ($skel ? $skel : " / ") |
|
| 282 | - . "</td><td class='spip-debug-arg' style='text-align: left'>" |
|
| 283 | - . ($boucle ? $boucle : " / ") |
|
| 284 | - . "</td><td style='text-align: right'>" |
|
| 285 | - . $ligne |
|
| 286 | - . "</td></tr>\n"; |
|
| 287 | - |
|
| 288 | - } |
|
| 289 | - |
|
| 290 | - return "\n<table id='$id'>" |
|
| 291 | - . "<caption onclick=\"x = document.getElementById('$id'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\">" |
|
| 292 | - . $caption[0] |
|
| 250 | + if (_request('exec') == 'valider_xml') { |
|
| 251 | + return ''; |
|
| 252 | + } |
|
| 253 | + $GLOBALS['bouton_admin_debug'] = true; |
|
| 254 | + $res = ''; |
|
| 255 | + $href = quote_amp(parametre_url($GLOBALS['REQUEST_URI'], 'var_mode', 'debug')); |
|
| 256 | + foreach ($tableau as $i => $err) { |
|
| 257 | + $boucle = $ligne = $skel = ''; |
|
| 258 | + list($msg, $lieu) = $err; |
|
| 259 | + if (is_object($lieu)) { |
|
| 260 | + $ligne = $lieu->ligne; |
|
| 261 | + $boucle = $lieu->id_boucle ? $lieu->id_boucle : ''; |
|
| 262 | + if (isset($lieu->descr['nom'])) { |
|
| 263 | + $nom_code = $lieu->descr['nom']; |
|
| 264 | + $skel = $lieu->descr['sourcefile']; |
|
| 265 | + $h2 = parametre_url($href, 'var_mode_objet', $nom_code); |
|
| 266 | + $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette') . '#L' . $ligne; |
|
| 267 | + $skel = "<a href='$h3'><b>$skel</b></a>"; |
|
| 268 | + if ($boucle) { |
|
| 269 | + $h3 = parametre_url($h2 . $boucle, 'var_mode_affiche', 'boucle'); |
|
| 270 | + $boucle = "<a href='$h3'><b>$boucle</b></a>"; |
|
| 271 | + } |
|
| 272 | + } |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + $j = ($i + 1); |
|
| 276 | + $res .= "<tr id='req$j'><td style='text-align: right'>" |
|
| 277 | + . $j |
|
| 278 | + . " </td><td style='text-align: left'>" |
|
| 279 | + . (is_array($msg) ? implode('', $msg) : $msg) |
|
| 280 | + . "</td><td style='text-align: left'>" |
|
| 281 | + . ($skel ? $skel : " / ") |
|
| 282 | + . "</td><td class='spip-debug-arg' style='text-align: left'>" |
|
| 283 | + . ($boucle ? $boucle : " / ") |
|
| 284 | + . "</td><td style='text-align: right'>" |
|
| 285 | + . $ligne |
|
| 286 | + . "</td></tr>\n"; |
|
| 287 | + |
|
| 288 | + } |
|
| 289 | + |
|
| 290 | + return "\n<table id='$id'>" |
|
| 291 | + . "<caption onclick=\"x = document.getElementById('$id'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\">" |
|
| 292 | + . $caption[0] |
|
| 293 | 293 | ## aide locale courte a ecrire, avec lien vers une grosse page de documentation |
| 294 | 294 | # aider('erreur_compilation'), |
| 295 | - . "</caption>" |
|
| 296 | - // fausse caption du chrono (mais vraie nav) |
|
| 297 | - . (!empty($caption[1]) ? $caption[1] : '') |
|
| 298 | - . "<tr><th>" |
|
| 299 | - . _T('numero') |
|
| 300 | - . "</th><th>" |
|
| 301 | - . _T('public:message') |
|
| 302 | - . "</th><th>" |
|
| 303 | - . _T('squelette') |
|
| 304 | - . "</th><th>" |
|
| 305 | - . _T('zbug_boucle') |
|
| 306 | - . "</th><th>" |
|
| 307 | - . _T('ligne') |
|
| 308 | - . "</th></tr>" |
|
| 309 | - . $res |
|
| 310 | - . "</table>"; |
|
| 295 | + . "</caption>" |
|
| 296 | + // fausse caption du chrono (mais vraie nav) |
|
| 297 | + . (!empty($caption[1]) ? $caption[1] : '') |
|
| 298 | + . "<tr><th>" |
|
| 299 | + . _T('numero') |
|
| 300 | + . "</th><th>" |
|
| 301 | + . _T('public:message') |
|
| 302 | + . "</th><th>" |
|
| 303 | + . _T('squelette') |
|
| 304 | + . "</th><th>" |
|
| 305 | + . _T('zbug_boucle') |
|
| 306 | + . "</th><th>" |
|
| 307 | + . _T('ligne') |
|
| 308 | + . "</th></tr>" |
|
| 309 | + . $res |
|
| 310 | + . "</table>"; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | |
@@ -327,125 +327,125 @@ discard block |
||
| 327 | 327 | * ou un tableau si l'erreur est critique |
| 328 | 328 | **/ |
| 329 | 329 | function debusquer_requete($message) { |
| 330 | - list($errno, $msg, $query) = $message; |
|
| 331 | - |
|
| 332 | - // FIXME: ces écritures mélangent divers syntaxe des moteurs SQL |
|
| 333 | - // il serait plus prudent certainement d'avoir une fonction d'analyse par moteur |
|
| 334 | - if (preg_match(',err(no|code):?[[:space:]]*([0-9]+),i', $msg, $regs)) { |
|
| 335 | - $errno = $regs[2]; |
|
| 336 | - } elseif (is_numeric($errno) and ($errno == 1030 or $errno <= 1026) |
|
| 337 | - and preg_match(',[^[:alnum:]]([0-9]+)[^[:alnum:]],', $msg, $regs) |
|
| 338 | - ) { |
|
| 339 | - $errno = $regs[1]; |
|
| 340 | - } |
|
| 341 | - |
|
| 342 | - // Erreur systeme |
|
| 343 | - if (is_numeric($errno) and $errno > 0 and $errno < 200) { |
|
| 344 | - $retour = "<tt><br /><br /><blink>" |
|
| 345 | - . _T('info_erreur_systeme', array('errsys' => $errno)) |
|
| 346 | - . "</blink><br />\n<b>" |
|
| 347 | - . _T('info_erreur_systeme2', |
|
| 348 | - array('script' => generer_url_ecrire('base_repair'))) |
|
| 349 | - . '</b><br />'; |
|
| 350 | - spip_log("Erreur systeme $errno"); |
|
| 351 | - |
|
| 352 | - return array($retour, ''); |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - // Requete erronee |
|
| 356 | - $err = "<b>" . _T('avis_erreur_mysql') . " $errno</b><br /><tt>\n" |
|
| 357 | - . spip_htmlspecialchars($msg) |
|
| 358 | - . "\n<br /><span style='color: red'><b>" |
|
| 359 | - . spip_htmlspecialchars($query) |
|
| 360 | - . "</b></span></tt><br />"; |
|
| 361 | - |
|
| 362 | - //. aider('erreur_mysql'); |
|
| 363 | - |
|
| 364 | - return $err; |
|
| 330 | + list($errno, $msg, $query) = $message; |
|
| 331 | + |
|
| 332 | + // FIXME: ces écritures mélangent divers syntaxe des moteurs SQL |
|
| 333 | + // il serait plus prudent certainement d'avoir une fonction d'analyse par moteur |
|
| 334 | + if (preg_match(',err(no|code):?[[:space:]]*([0-9]+),i', $msg, $regs)) { |
|
| 335 | + $errno = $regs[2]; |
|
| 336 | + } elseif (is_numeric($errno) and ($errno == 1030 or $errno <= 1026) |
|
| 337 | + and preg_match(',[^[:alnum:]]([0-9]+)[^[:alnum:]],', $msg, $regs) |
|
| 338 | + ) { |
|
| 339 | + $errno = $regs[1]; |
|
| 340 | + } |
|
| 341 | + |
|
| 342 | + // Erreur systeme |
|
| 343 | + if (is_numeric($errno) and $errno > 0 and $errno < 200) { |
|
| 344 | + $retour = "<tt><br /><br /><blink>" |
|
| 345 | + . _T('info_erreur_systeme', array('errsys' => $errno)) |
|
| 346 | + . "</blink><br />\n<b>" |
|
| 347 | + . _T('info_erreur_systeme2', |
|
| 348 | + array('script' => generer_url_ecrire('base_repair'))) |
|
| 349 | + . '</b><br />'; |
|
| 350 | + spip_log("Erreur systeme $errno"); |
|
| 351 | + |
|
| 352 | + return array($retour, ''); |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + // Requete erronee |
|
| 356 | + $err = "<b>" . _T('avis_erreur_mysql') . " $errno</b><br /><tt>\n" |
|
| 357 | + . spip_htmlspecialchars($msg) |
|
| 358 | + . "\n<br /><span style='color: red'><b>" |
|
| 359 | + . spip_htmlspecialchars($query) |
|
| 360 | + . "</b></span></tt><br />"; |
|
| 361 | + |
|
| 362 | + //. aider('erreur_mysql'); |
|
| 363 | + |
|
| 364 | + return $err; |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | |
| 368 | 368 | // https://code.spip.net/@trouve_boucle_debug |
| 369 | 369 | function trouve_boucle_debug($n, $nom, $debut = 0, $boucle = "") { |
| 370 | 370 | |
| 371 | - $id = $nom . $boucle; |
|
| 372 | - if (is_array($GLOBALS['debug_objets']['sequence'][$id])) { |
|
| 373 | - foreach ($GLOBALS['debug_objets']['sequence'][$id] as $v) { |
|
| 374 | - |
|
| 375 | - if (!preg_match('/^(.*)(<\?.*\?>)(.*)$/s', $v[0], $r)) { |
|
| 376 | - $y = substr_count($v[0], "\n"); |
|
| 377 | - } else { |
|
| 378 | - if ($v[1][0] == '#') // balise dynamique |
|
| 379 | - { |
|
| 380 | - $incl = $GLOBALS['debug_objets']['resultat'][$v[2]]; |
|
| 381 | - } else // inclusion |
|
| 382 | - { |
|
| 383 | - $incl = $GLOBALS['debug_objets']['squelette'][trouve_squelette_inclus($v[0])]; |
|
| 384 | - } |
|
| 385 | - $y = substr_count($incl, "\n") |
|
| 386 | - + substr_count($r[1], "\n") |
|
| 387 | - + substr_count($r[3], "\n"); |
|
| 388 | - } |
|
| 389 | - if ($n <= ($y + $debut)) { |
|
| 390 | - if ($v[1][0] == '?') { |
|
| 391 | - return trouve_boucle_debug($n, $nom, $debut, substr($v[1], 1)); |
|
| 392 | - } elseif ($v[1][0] == '!') { |
|
| 393 | - if ($incl = trouve_squelette_inclus($v[1])) { |
|
| 394 | - return trouve_boucle_debug($n, $incl, $debut); |
|
| 395 | - } |
|
| 396 | - } |
|
| 397 | - |
|
| 398 | - return array($nom, $boucle, $v[2] - 1 + $n - $debut); |
|
| 399 | - } |
|
| 400 | - $debut += $y; |
|
| 401 | - } |
|
| 402 | - } |
|
| 403 | - |
|
| 404 | - return array($nom, $boucle, $n - $debut); |
|
| 371 | + $id = $nom . $boucle; |
|
| 372 | + if (is_array($GLOBALS['debug_objets']['sequence'][$id])) { |
|
| 373 | + foreach ($GLOBALS['debug_objets']['sequence'][$id] as $v) { |
|
| 374 | + |
|
| 375 | + if (!preg_match('/^(.*)(<\?.*\?>)(.*)$/s', $v[0], $r)) { |
|
| 376 | + $y = substr_count($v[0], "\n"); |
|
| 377 | + } else { |
|
| 378 | + if ($v[1][0] == '#') // balise dynamique |
|
| 379 | + { |
|
| 380 | + $incl = $GLOBALS['debug_objets']['resultat'][$v[2]]; |
|
| 381 | + } else // inclusion |
|
| 382 | + { |
|
| 383 | + $incl = $GLOBALS['debug_objets']['squelette'][trouve_squelette_inclus($v[0])]; |
|
| 384 | + } |
|
| 385 | + $y = substr_count($incl, "\n") |
|
| 386 | + + substr_count($r[1], "\n") |
|
| 387 | + + substr_count($r[3], "\n"); |
|
| 388 | + } |
|
| 389 | + if ($n <= ($y + $debut)) { |
|
| 390 | + if ($v[1][0] == '?') { |
|
| 391 | + return trouve_boucle_debug($n, $nom, $debut, substr($v[1], 1)); |
|
| 392 | + } elseif ($v[1][0] == '!') { |
|
| 393 | + if ($incl = trouve_squelette_inclus($v[1])) { |
|
| 394 | + return trouve_boucle_debug($n, $incl, $debut); |
|
| 395 | + } |
|
| 396 | + } |
|
| 397 | + |
|
| 398 | + return array($nom, $boucle, $v[2] - 1 + $n - $debut); |
|
| 399 | + } |
|
| 400 | + $debut += $y; |
|
| 401 | + } |
|
| 402 | + } |
|
| 403 | + |
|
| 404 | + return array($nom, $boucle, $n - $debut); |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | // https://code.spip.net/@trouve_squelette_inclus |
| 408 | 408 | function trouve_squelette_inclus($script) { |
| 409 | 409 | |
| 410 | - preg_match('/include\(.(.*).php3?.\);/', $script, $reg); |
|
| 411 | - // si le script X.php n'est pas ecrire/public.php |
|
| 412 | - // on suppose qu'il prend le squelette X.html (pas sur, mais y a pas mieux) |
|
| 413 | - if ($reg[1] == 'ecrire/public') // si c'est bien ecrire/public on cherche le param 'fond' |
|
| 414 | - { |
|
| 415 | - if (!preg_match("/'fond' => '([^']*)'/", $script, $reg)) // a defaut on cherche le param 'page' |
|
| 416 | - { |
|
| 417 | - if (!preg_match("/'param' => '([^']*)'/", $script, $reg)) { |
|
| 418 | - $reg[1] = "inconnu"; |
|
| 419 | - } |
|
| 420 | - } |
|
| 421 | - } |
|
| 422 | - $incl = ',' . $reg[1] . '[.]\w$,'; |
|
| 423 | - |
|
| 424 | - foreach ($GLOBALS['debug_objets']['sourcefile'] as $k => $v) { |
|
| 425 | - if (preg_match($incl, $v)) { |
|
| 426 | - return $k; |
|
| 427 | - } |
|
| 428 | - } |
|
| 429 | - |
|
| 430 | - return ""; |
|
| 410 | + preg_match('/include\(.(.*).php3?.\);/', $script, $reg); |
|
| 411 | + // si le script X.php n'est pas ecrire/public.php |
|
| 412 | + // on suppose qu'il prend le squelette X.html (pas sur, mais y a pas mieux) |
|
| 413 | + if ($reg[1] == 'ecrire/public') // si c'est bien ecrire/public on cherche le param 'fond' |
|
| 414 | + { |
|
| 415 | + if (!preg_match("/'fond' => '([^']*)'/", $script, $reg)) // a defaut on cherche le param 'page' |
|
| 416 | + { |
|
| 417 | + if (!preg_match("/'param' => '([^']*)'/", $script, $reg)) { |
|
| 418 | + $reg[1] = "inconnu"; |
|
| 419 | + } |
|
| 420 | + } |
|
| 421 | + } |
|
| 422 | + $incl = ',' . $reg[1] . '[.]\w$,'; |
|
| 423 | + |
|
| 424 | + foreach ($GLOBALS['debug_objets']['sourcefile'] as $k => $v) { |
|
| 425 | + if (preg_match($incl, $v)) { |
|
| 426 | + return $k; |
|
| 427 | + } |
|
| 428 | + } |
|
| 429 | + |
|
| 430 | + return ""; |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | // https://code.spip.net/@reference_boucle_debug |
| 434 | 434 | function reference_boucle_debug($n, $nom, $self) { |
| 435 | - list($skel, $boucle, $ligne) = trouve_boucle_debug($n, $nom); |
|
| 436 | - |
|
| 437 | - if (!$boucle) { |
|
| 438 | - return !$ligne ? "" : |
|
| 439 | - (" (" . |
|
| 440 | - (($nom != $skel) ? _T('squelette_inclus_ligne') : |
|
| 441 | - _T('squelette_ligne')) . |
|
| 442 | - " <a href='$self&var_mode_objet=$skel&var_mode_affiche=squelette&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"); |
|
| 443 | - } else { |
|
| 444 | - $self .= "&var_mode_objet=$skel$boucle&var_mode_affiche=boucle"; |
|
| 445 | - |
|
| 446 | - return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : |
|
| 447 | - " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 448 | - } |
|
| 435 | + list($skel, $boucle, $ligne) = trouve_boucle_debug($n, $nom); |
|
| 436 | + |
|
| 437 | + if (!$boucle) { |
|
| 438 | + return !$ligne ? "" : |
|
| 439 | + (" (" . |
|
| 440 | + (($nom != $skel) ? _T('squelette_inclus_ligne') : |
|
| 441 | + _T('squelette_ligne')) . |
|
| 442 | + " <a href='$self&var_mode_objet=$skel&var_mode_affiche=squelette&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"); |
|
| 443 | + } else { |
|
| 444 | + $self .= "&var_mode_objet=$skel$boucle&var_mode_affiche=boucle"; |
|
| 445 | + |
|
| 446 | + return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : |
|
| 447 | + " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 448 | + } |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | // affiche un texte avec numero de ligne et ancre. |
@@ -453,395 +453,395 @@ discard block |
||
| 453 | 453 | // https://code.spip.net/@ancre_texte |
| 454 | 454 | function ancre_texte($texte, $fautifs = array(), $nocpt = false) { |
| 455 | 455 | |
| 456 | - $var_mode_ligne = _request('var_mode_ligne'); |
|
| 457 | - if ($var_mode_ligne) { |
|
| 458 | - $fautifs[] = array($var_mode_ligne); |
|
| 459 | - } |
|
| 460 | - $res = ''; |
|
| 461 | - |
|
| 462 | - $s = highlight_string($texte, true); |
|
| 463 | - if (substr($s, 0, 6) == '<code>') { |
|
| 464 | - $s = substr($s, 6); |
|
| 465 | - $res = '<code>'; |
|
| 466 | - } |
|
| 467 | - |
|
| 468 | - $s = preg_replace(',<(\w[^<>]*)>([^<]*)<br />([^<]*)</\1>,', |
|
| 469 | - '<\1>\2</\1><br />' . "\n" . '<\1>\3</\1>', |
|
| 470 | - $s); |
|
| 471 | - |
|
| 472 | - |
|
| 473 | - $tableau = explode("<br />", $s); |
|
| 474 | - |
|
| 475 | - $format = "<span style='float:left;display:block;width:50px;height:1px'><a id='L%d' style='background-color: white; visibility: " . ($nocpt ? 'hidden' : 'visible') . ";%s' href='#T%s' title=\"%s\">%0" . strval(@strlen(count($tableau))) . "d</a></span> %s<br />\n"; |
|
| 476 | - |
|
| 477 | - $format10 = str_replace('white', 'lightgrey', $format); |
|
| 478 | - $formaterr = "color: red;"; |
|
| 479 | - $i = 1; |
|
| 480 | - $flignes = array(); |
|
| 481 | - $loc = array(0, 0); |
|
| 482 | - foreach ($fautifs as $lc) { |
|
| 483 | - if (is_array($lc)) { |
|
| 484 | - $l = array_shift($lc); |
|
| 485 | - $flignes[$l] = $lc; |
|
| 486 | - } else { |
|
| 487 | - $flignes[$lc] = $loc; |
|
| 488 | - } |
|
| 489 | - } |
|
| 490 | - |
|
| 491 | - $ancre = md5($texte); |
|
| 492 | - foreach ($tableau as $ligne) { |
|
| 493 | - if (isset($flignes[$i])) { |
|
| 494 | - $ligne = str_replace(' ', ' ', $ligne); |
|
| 495 | - $indexmesg = $flignes[$i][1]; |
|
| 496 | - $err = textebrut($flignes[$i][2]); |
|
| 497 | - // tentative de pointer sur la colonne fautive; |
|
| 498 | - // marche pas car highlight_string rajoute des entites. A revoir. |
|
| 499 | - // $m = $flignes[$i][0]; |
|
| 500 | - // $ligne = substr($ligne, 0, $m-1) . |
|
| 501 | - // sprintf($formaterr, substr($ligne,$m)); |
|
| 502 | - $bg = $formaterr; |
|
| 503 | - } else { |
|
| 504 | - $indexmesg = $ancre; |
|
| 505 | - $err = $bg = ''; |
|
| 506 | - } |
|
| 507 | - $res .= sprintf((($i % 10) ? $format : $format10), $i, $bg, $indexmesg, $err, $i, $ligne); |
|
| 508 | - $i++; |
|
| 509 | - } |
|
| 510 | - |
|
| 511 | - return "<div id='T$ancre'>" |
|
| 512 | - . '<div onclick="' |
|
| 513 | - . "jQuery(this).parent().find('a').toggle();" |
|
| 514 | - . '" title="' |
|
| 515 | - . _T('masquer_colonne') |
|
| 516 | - . '" style="cursor: pointer;">' |
|
| 517 | - . ($nocpt ? '' : _T('info_numero_abbreviation')) |
|
| 518 | - . "</div> |
|
| 456 | + $var_mode_ligne = _request('var_mode_ligne'); |
|
| 457 | + if ($var_mode_ligne) { |
|
| 458 | + $fautifs[] = array($var_mode_ligne); |
|
| 459 | + } |
|
| 460 | + $res = ''; |
|
| 461 | + |
|
| 462 | + $s = highlight_string($texte, true); |
|
| 463 | + if (substr($s, 0, 6) == '<code>') { |
|
| 464 | + $s = substr($s, 6); |
|
| 465 | + $res = '<code>'; |
|
| 466 | + } |
|
| 467 | + |
|
| 468 | + $s = preg_replace(',<(\w[^<>]*)>([^<]*)<br />([^<]*)</\1>,', |
|
| 469 | + '<\1>\2</\1><br />' . "\n" . '<\1>\3</\1>', |
|
| 470 | + $s); |
|
| 471 | + |
|
| 472 | + |
|
| 473 | + $tableau = explode("<br />", $s); |
|
| 474 | + |
|
| 475 | + $format = "<span style='float:left;display:block;width:50px;height:1px'><a id='L%d' style='background-color: white; visibility: " . ($nocpt ? 'hidden' : 'visible') . ";%s' href='#T%s' title=\"%s\">%0" . strval(@strlen(count($tableau))) . "d</a></span> %s<br />\n"; |
|
| 476 | + |
|
| 477 | + $format10 = str_replace('white', 'lightgrey', $format); |
|
| 478 | + $formaterr = "color: red;"; |
|
| 479 | + $i = 1; |
|
| 480 | + $flignes = array(); |
|
| 481 | + $loc = array(0, 0); |
|
| 482 | + foreach ($fautifs as $lc) { |
|
| 483 | + if (is_array($lc)) { |
|
| 484 | + $l = array_shift($lc); |
|
| 485 | + $flignes[$l] = $lc; |
|
| 486 | + } else { |
|
| 487 | + $flignes[$lc] = $loc; |
|
| 488 | + } |
|
| 489 | + } |
|
| 490 | + |
|
| 491 | + $ancre = md5($texte); |
|
| 492 | + foreach ($tableau as $ligne) { |
|
| 493 | + if (isset($flignes[$i])) { |
|
| 494 | + $ligne = str_replace(' ', ' ', $ligne); |
|
| 495 | + $indexmesg = $flignes[$i][1]; |
|
| 496 | + $err = textebrut($flignes[$i][2]); |
|
| 497 | + // tentative de pointer sur la colonne fautive; |
|
| 498 | + // marche pas car highlight_string rajoute des entites. A revoir. |
|
| 499 | + // $m = $flignes[$i][0]; |
|
| 500 | + // $ligne = substr($ligne, 0, $m-1) . |
|
| 501 | + // sprintf($formaterr, substr($ligne,$m)); |
|
| 502 | + $bg = $formaterr; |
|
| 503 | + } else { |
|
| 504 | + $indexmesg = $ancre; |
|
| 505 | + $err = $bg = ''; |
|
| 506 | + } |
|
| 507 | + $res .= sprintf((($i % 10) ? $format : $format10), $i, $bg, $indexmesg, $err, $i, $ligne); |
|
| 508 | + $i++; |
|
| 509 | + } |
|
| 510 | + |
|
| 511 | + return "<div id='T$ancre'>" |
|
| 512 | + . '<div onclick="' |
|
| 513 | + . "jQuery(this).parent().find('a').toggle();" |
|
| 514 | + . '" title="' |
|
| 515 | + . _T('masquer_colonne') |
|
| 516 | + . '" style="cursor: pointer;">' |
|
| 517 | + . ($nocpt ? '' : _T('info_numero_abbreviation')) |
|
| 518 | + . "</div> |
|
| 519 | 519 | " . $res . "</div>\n"; |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // l'environnement graphique du debuggueur |
| 523 | 523 | |
| 524 | 524 | function debusquer_squelette($fonc, $mode, $self) { |
| 525 | - $texte = ''; |
|
| 526 | - |
|
| 527 | - if ($mode !== 'validation') { |
|
| 528 | - if (isset($GLOBALS['debug_objets']['sourcefile']) and $GLOBALS['debug_objets']['sourcefile']) { |
|
| 529 | - $res = "<div id='spip-boucles'>\n" |
|
| 530 | - . debusquer_navigation_squelettes($self) |
|
| 531 | - . "</div>"; |
|
| 532 | - } else { |
|
| 533 | - $res = ''; |
|
| 534 | - } |
|
| 535 | - if ($fonc) { |
|
| 536 | - $id = " id='$fonc'"; |
|
| 537 | - if (!empty($GLOBALS['debug_objets'][$mode][$fonc])) { |
|
| 538 | - list($legend, $texte, $res2) = debusquer_source($fonc, $mode); |
|
| 539 | - $texte .= $res2; |
|
| 540 | - } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc . 'tout'])) { |
|
| 541 | - $legend = _T('zbug_' . $mode); |
|
| 542 | - $texte = $GLOBALS['debug_objets'][$mode][$fonc . 'tout']; |
|
| 543 | - $texte = ancre_texte($texte, array('', '')); |
|
| 544 | - } |
|
| 545 | - } else { |
|
| 546 | - if (strlen(trim($res))) { |
|
| 547 | - return "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res</div>"; |
|
| 548 | - } else { |
|
| 549 | - // cas de l'appel sur erreur: montre la page |
|
| 550 | - return isset($GLOBALS['debug_objets']['resultat']['tout']) |
|
| 551 | - ? $GLOBALS['debug_objets']['resultat']['tout'] |
|
| 552 | - : ''; |
|
| 553 | - } |
|
| 554 | - } |
|
| 555 | - } else { |
|
| 556 | - $valider = charger_fonction('valider', 'xml'); |
|
| 557 | - $val = $valider($GLOBALS['debug_objets']['validation'][$fonc . 'tout']); |
|
| 558 | - // Si erreur, signaler leur nombre dans le formulaire admin |
|
| 559 | - $GLOBALS['debug_objets']['validation'] = $val->err ? count($val->err) : ''; |
|
| 560 | - list($texte, $err) = emboite_texte($val, $fonc, $self); |
|
| 561 | - if ($err === false) { |
|
| 562 | - $err = _T('impossible'); |
|
| 563 | - } elseif ($err === true) { |
|
| 564 | - $err = _T('correcte'); |
|
| 565 | - } else { |
|
| 566 | - $err = ": $err"; |
|
| 567 | - } |
|
| 568 | - $legend = _T('validation') . ' ' . $err; |
|
| 569 | - $res = $id = ''; |
|
| 570 | - } |
|
| 571 | - |
|
| 572 | - return !trim($texte) ? '' : ( |
|
| 573 | - "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res" |
|
| 574 | - . "<div id='debug_boucle'><fieldset$id><legend>" |
|
| 575 | - . "<a href='" . $self . "#f_" . substr($fonc, 0, 37) . "'> ↑ " |
|
| 576 | - . ($legend ? $legend : $mode) |
|
| 577 | - . "</a></legend>" |
|
| 578 | - . $texte |
|
| 579 | - . "</fieldset></div>" |
|
| 580 | - . "</div>"); |
|
| 525 | + $texte = ''; |
|
| 526 | + |
|
| 527 | + if ($mode !== 'validation') { |
|
| 528 | + if (isset($GLOBALS['debug_objets']['sourcefile']) and $GLOBALS['debug_objets']['sourcefile']) { |
|
| 529 | + $res = "<div id='spip-boucles'>\n" |
|
| 530 | + . debusquer_navigation_squelettes($self) |
|
| 531 | + . "</div>"; |
|
| 532 | + } else { |
|
| 533 | + $res = ''; |
|
| 534 | + } |
|
| 535 | + if ($fonc) { |
|
| 536 | + $id = " id='$fonc'"; |
|
| 537 | + if (!empty($GLOBALS['debug_objets'][$mode][$fonc])) { |
|
| 538 | + list($legend, $texte, $res2) = debusquer_source($fonc, $mode); |
|
| 539 | + $texte .= $res2; |
|
| 540 | + } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc . 'tout'])) { |
|
| 541 | + $legend = _T('zbug_' . $mode); |
|
| 542 | + $texte = $GLOBALS['debug_objets'][$mode][$fonc . 'tout']; |
|
| 543 | + $texte = ancre_texte($texte, array('', '')); |
|
| 544 | + } |
|
| 545 | + } else { |
|
| 546 | + if (strlen(trim($res))) { |
|
| 547 | + return "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res</div>"; |
|
| 548 | + } else { |
|
| 549 | + // cas de l'appel sur erreur: montre la page |
|
| 550 | + return isset($GLOBALS['debug_objets']['resultat']['tout']) |
|
| 551 | + ? $GLOBALS['debug_objets']['resultat']['tout'] |
|
| 552 | + : ''; |
|
| 553 | + } |
|
| 554 | + } |
|
| 555 | + } else { |
|
| 556 | + $valider = charger_fonction('valider', 'xml'); |
|
| 557 | + $val = $valider($GLOBALS['debug_objets']['validation'][$fonc . 'tout']); |
|
| 558 | + // Si erreur, signaler leur nombre dans le formulaire admin |
|
| 559 | + $GLOBALS['debug_objets']['validation'] = $val->err ? count($val->err) : ''; |
|
| 560 | + list($texte, $err) = emboite_texte($val, $fonc, $self); |
|
| 561 | + if ($err === false) { |
|
| 562 | + $err = _T('impossible'); |
|
| 563 | + } elseif ($err === true) { |
|
| 564 | + $err = _T('correcte'); |
|
| 565 | + } else { |
|
| 566 | + $err = ": $err"; |
|
| 567 | + } |
|
| 568 | + $legend = _T('validation') . ' ' . $err; |
|
| 569 | + $res = $id = ''; |
|
| 570 | + } |
|
| 571 | + |
|
| 572 | + return !trim($texte) ? '' : ( |
|
| 573 | + "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res" |
|
| 574 | + . "<div id='debug_boucle'><fieldset$id><legend>" |
|
| 575 | + . "<a href='" . $self . "#f_" . substr($fonc, 0, 37) . "'> ↑ " |
|
| 576 | + . ($legend ? $legend : $mode) |
|
| 577 | + . "</a></legend>" |
|
| 578 | + . $texte |
|
| 579 | + . "</fieldset></div>" |
|
| 580 | + . "</div>"); |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | |
| 584 | 584 | // https://code.spip.net/@emboite_texte |
| 585 | 585 | function emboite_texte($res, $fonc = '', $self = '') { |
| 586 | - $errs = $res->err; |
|
| 587 | - $texte = $res->entete . ($errs ? '' : $res->page); |
|
| 588 | - |
|
| 589 | - if (!$texte and !$errs) { |
|
| 590 | - return array(ancre_texte('', array('', '')), false); |
|
| 591 | - } |
|
| 592 | - if (!$errs) { |
|
| 593 | - return array(ancre_texte($texte, array('', '')), true); |
|
| 594 | - } |
|
| 595 | - |
|
| 596 | - if (!isset($GLOBALS['debug_objets'])) { |
|
| 597 | - |
|
| 598 | - $colors = array('#e0e0f0', '#f8f8ff'); |
|
| 599 | - $encore = count_occ($errs); |
|
| 600 | - $encore2 = array(); |
|
| 601 | - $fautifs = array(); |
|
| 602 | - |
|
| 603 | - $err = '<tr><th>' |
|
| 604 | - . _T('numero') |
|
| 605 | - . "</th><th>" |
|
| 606 | - . _T('occurence') |
|
| 607 | - . "</th><th>" |
|
| 608 | - . _T('ligne') |
|
| 609 | - . "</th><th>" |
|
| 610 | - . _T('colonne') |
|
| 611 | - . "</th><th>" |
|
| 612 | - . _T('erreur') |
|
| 613 | - . "</th></tr>"; |
|
| 614 | - |
|
| 615 | - $i = 0; |
|
| 616 | - $style = "style='text-align: right; padding-right: 5px'"; |
|
| 617 | - foreach ($errs as $r) { |
|
| 618 | - $i++; |
|
| 619 | - list($msg, $ligne, $col) = $r; |
|
| 620 | - #spip_log("$r = list($msg, $ligne, $col"); |
|
| 621 | - if (isset($encore2[$msg])) { |
|
| 622 | - $ref = ++$encore2[$msg]; |
|
| 623 | - } else { |
|
| 624 | - $encore2[$msg] = $ref = 1; |
|
| 625 | - } |
|
| 626 | - $err .= "<tr style='background-color: " |
|
| 627 | - . $colors[$i % 2] |
|
| 628 | - . "'><td $style><a href='#debut_err'>" |
|
| 629 | - . $i |
|
| 630 | - . "</a></td><td $style>" |
|
| 631 | - . "$ref/$encore[$msg]</td>" |
|
| 632 | - . "<td $style><a href='#L" |
|
| 633 | - . $ligne |
|
| 634 | - . "' id='T$i'>" |
|
| 635 | - . $ligne |
|
| 636 | - . "</a></td><td $style>" |
|
| 637 | - . $col |
|
| 638 | - . "</td><td>$msg</td></tr>\n"; |
|
| 639 | - $fautifs[] = array($ligne, $col, $i, $msg); |
|
| 640 | - } |
|
| 641 | - $err = "<h2 style='text-align: center'>" |
|
| 642 | - . $i |
|
| 643 | - . "<a href='#fin_err'>" |
|
| 644 | - . " " . _T('erreur_texte') |
|
| 645 | - . "</a></h2><table id='debut_err' style='width: 100%'>" |
|
| 646 | - . $err |
|
| 647 | - . " </table><a id='fin_err'></a>"; |
|
| 648 | - |
|
| 649 | - return array(ancre_texte($texte, $fautifs), $err); |
|
| 650 | - } else { |
|
| 651 | - list($msg, $fermant, $ouvrant) = $errs[0]; |
|
| 652 | - $rf = reference_boucle_debug($fermant, $fonc, $self); |
|
| 653 | - $ro = reference_boucle_debug($ouvrant, $fonc, $self); |
|
| 654 | - $err = $msg . |
|
| 655 | - "<a href='#L" . $fermant . "'>$fermant</a>$rf<br />" . |
|
| 656 | - "<a href='#L" . $ouvrant . "'>$ouvrant</a>$ro"; |
|
| 657 | - |
|
| 658 | - return array(ancre_texte($texte, array(array($ouvrant), array($fermant))), $err); |
|
| 659 | - } |
|
| 586 | + $errs = $res->err; |
|
| 587 | + $texte = $res->entete . ($errs ? '' : $res->page); |
|
| 588 | + |
|
| 589 | + if (!$texte and !$errs) { |
|
| 590 | + return array(ancre_texte('', array('', '')), false); |
|
| 591 | + } |
|
| 592 | + if (!$errs) { |
|
| 593 | + return array(ancre_texte($texte, array('', '')), true); |
|
| 594 | + } |
|
| 595 | + |
|
| 596 | + if (!isset($GLOBALS['debug_objets'])) { |
|
| 597 | + |
|
| 598 | + $colors = array('#e0e0f0', '#f8f8ff'); |
|
| 599 | + $encore = count_occ($errs); |
|
| 600 | + $encore2 = array(); |
|
| 601 | + $fautifs = array(); |
|
| 602 | + |
|
| 603 | + $err = '<tr><th>' |
|
| 604 | + . _T('numero') |
|
| 605 | + . "</th><th>" |
|
| 606 | + . _T('occurence') |
|
| 607 | + . "</th><th>" |
|
| 608 | + . _T('ligne') |
|
| 609 | + . "</th><th>" |
|
| 610 | + . _T('colonne') |
|
| 611 | + . "</th><th>" |
|
| 612 | + . _T('erreur') |
|
| 613 | + . "</th></tr>"; |
|
| 614 | + |
|
| 615 | + $i = 0; |
|
| 616 | + $style = "style='text-align: right; padding-right: 5px'"; |
|
| 617 | + foreach ($errs as $r) { |
|
| 618 | + $i++; |
|
| 619 | + list($msg, $ligne, $col) = $r; |
|
| 620 | + #spip_log("$r = list($msg, $ligne, $col"); |
|
| 621 | + if (isset($encore2[$msg])) { |
|
| 622 | + $ref = ++$encore2[$msg]; |
|
| 623 | + } else { |
|
| 624 | + $encore2[$msg] = $ref = 1; |
|
| 625 | + } |
|
| 626 | + $err .= "<tr style='background-color: " |
|
| 627 | + . $colors[$i % 2] |
|
| 628 | + . "'><td $style><a href='#debut_err'>" |
|
| 629 | + . $i |
|
| 630 | + . "</a></td><td $style>" |
|
| 631 | + . "$ref/$encore[$msg]</td>" |
|
| 632 | + . "<td $style><a href='#L" |
|
| 633 | + . $ligne |
|
| 634 | + . "' id='T$i'>" |
|
| 635 | + . $ligne |
|
| 636 | + . "</a></td><td $style>" |
|
| 637 | + . $col |
|
| 638 | + . "</td><td>$msg</td></tr>\n"; |
|
| 639 | + $fautifs[] = array($ligne, $col, $i, $msg); |
|
| 640 | + } |
|
| 641 | + $err = "<h2 style='text-align: center'>" |
|
| 642 | + . $i |
|
| 643 | + . "<a href='#fin_err'>" |
|
| 644 | + . " " . _T('erreur_texte') |
|
| 645 | + . "</a></h2><table id='debut_err' style='width: 100%'>" |
|
| 646 | + . $err |
|
| 647 | + . " </table><a id='fin_err'></a>"; |
|
| 648 | + |
|
| 649 | + return array(ancre_texte($texte, $fautifs), $err); |
|
| 650 | + } else { |
|
| 651 | + list($msg, $fermant, $ouvrant) = $errs[0]; |
|
| 652 | + $rf = reference_boucle_debug($fermant, $fonc, $self); |
|
| 653 | + $ro = reference_boucle_debug($ouvrant, $fonc, $self); |
|
| 654 | + $err = $msg . |
|
| 655 | + "<a href='#L" . $fermant . "'>$fermant</a>$rf<br />" . |
|
| 656 | + "<a href='#L" . $ouvrant . "'>$ouvrant</a>$ro"; |
|
| 657 | + |
|
| 658 | + return array(ancre_texte($texte, array(array($ouvrant), array($fermant))), $err); |
|
| 659 | + } |
|
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | // https://code.spip.net/@count_occ |
| 663 | 663 | function count_occ($regs) { |
| 664 | - $encore = array(); |
|
| 665 | - foreach ($regs as $r) { |
|
| 666 | - if (isset($encore[$r[0]])) { |
|
| 667 | - $encore[$r[0]]++; |
|
| 668 | - } else { |
|
| 669 | - $encore[$r[0]] = 1; |
|
| 670 | - } |
|
| 671 | - } |
|
| 672 | - |
|
| 673 | - return $encore; |
|
| 664 | + $encore = array(); |
|
| 665 | + foreach ($regs as $r) { |
|
| 666 | + if (isset($encore[$r[0]])) { |
|
| 667 | + $encore[$r[0]]++; |
|
| 668 | + } else { |
|
| 669 | + $encore[$r[0]] = 1; |
|
| 670 | + } |
|
| 671 | + } |
|
| 672 | + |
|
| 673 | + return $encore; |
|
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | function debusquer_navigation_squelettes($self) { |
| 677 | 677 | |
| 678 | - $res = ''; |
|
| 679 | - $boucles = !empty($GLOBALS['debug_objets']['boucle']) ? $GLOBALS['debug_objets']['boucle'] : ''; |
|
| 680 | - $contexte = $GLOBALS['debug_objets']['contexte']; |
|
| 681 | - $t_skel = _T('squelette'); |
|
| 682 | - foreach ($GLOBALS['debug_objets']['sourcefile'] as $nom => $sourcefile) { |
|
| 683 | - $self2 = parametre_url($self, 'var_mode_objet', $nom); |
|
| 684 | - $nav = !$boucles ? '' : debusquer_navigation_boucles($boucles, $nom, $self, $sourcefile); |
|
| 685 | - $temps = !isset($GLOBALS['debug_objets']['profile'][$sourcefile]) ? '' : _T('zbug_profile', |
|
| 686 | - array('time' => $GLOBALS['debug_objets']['profile'][$sourcefile])); |
|
| 687 | - |
|
| 688 | - $res .= "<fieldset id='f_" . $nom . "'><legend>" |
|
| 689 | - . $t_skel |
|
| 690 | - . ' ' |
|
| 691 | - . $sourcefile |
|
| 692 | - . " :\n<a href='$self2&var_mode_affiche=squelette#f_$nom'>" |
|
| 693 | - . $t_skel |
|
| 694 | - . "</a>\n<a href='$self2&var_mode_affiche=resultat#f_$nom'>" |
|
| 695 | - . _T('zbug_resultat') |
|
| 696 | - . "</a>\n<a href='$self2&var_mode_affiche=code#f_$nom'>" |
|
| 697 | - . _T('zbug_code') |
|
| 698 | - . "</a>\n<a href='" |
|
| 699 | - . str_replace('var_mode=debug', 'var_profile=1&var_mode=recalcul', $self) |
|
| 700 | - . "'>" |
|
| 701 | - . _T('zbug_calcul') |
|
| 702 | - . "</a></legend>" |
|
| 703 | - . (!$temps ? '' : ("\n<span style='display:block;float:" . $GLOBALS['spip_lang_right'] . "'>$temps</span><br />")) |
|
| 704 | - . debusquer_contexte($contexte[$sourcefile]) |
|
| 705 | - . (!$nav ? '' : ("<table width='100%'>\n$nav</table>\n")) |
|
| 706 | - . "</fieldset>\n"; |
|
| 707 | - } |
|
| 708 | - |
|
| 709 | - return $res; |
|
| 678 | + $res = ''; |
|
| 679 | + $boucles = !empty($GLOBALS['debug_objets']['boucle']) ? $GLOBALS['debug_objets']['boucle'] : ''; |
|
| 680 | + $contexte = $GLOBALS['debug_objets']['contexte']; |
|
| 681 | + $t_skel = _T('squelette'); |
|
| 682 | + foreach ($GLOBALS['debug_objets']['sourcefile'] as $nom => $sourcefile) { |
|
| 683 | + $self2 = parametre_url($self, 'var_mode_objet', $nom); |
|
| 684 | + $nav = !$boucles ? '' : debusquer_navigation_boucles($boucles, $nom, $self, $sourcefile); |
|
| 685 | + $temps = !isset($GLOBALS['debug_objets']['profile'][$sourcefile]) ? '' : _T('zbug_profile', |
|
| 686 | + array('time' => $GLOBALS['debug_objets']['profile'][$sourcefile])); |
|
| 687 | + |
|
| 688 | + $res .= "<fieldset id='f_" . $nom . "'><legend>" |
|
| 689 | + . $t_skel |
|
| 690 | + . ' ' |
|
| 691 | + . $sourcefile |
|
| 692 | + . " :\n<a href='$self2&var_mode_affiche=squelette#f_$nom'>" |
|
| 693 | + . $t_skel |
|
| 694 | + . "</a>\n<a href='$self2&var_mode_affiche=resultat#f_$nom'>" |
|
| 695 | + . _T('zbug_resultat') |
|
| 696 | + . "</a>\n<a href='$self2&var_mode_affiche=code#f_$nom'>" |
|
| 697 | + . _T('zbug_code') |
|
| 698 | + . "</a>\n<a href='" |
|
| 699 | + . str_replace('var_mode=debug', 'var_profile=1&var_mode=recalcul', $self) |
|
| 700 | + . "'>" |
|
| 701 | + . _T('zbug_calcul') |
|
| 702 | + . "</a></legend>" |
|
| 703 | + . (!$temps ? '' : ("\n<span style='display:block;float:" . $GLOBALS['spip_lang_right'] . "'>$temps</span><br />")) |
|
| 704 | + . debusquer_contexte($contexte[$sourcefile]) |
|
| 705 | + . (!$nav ? '' : ("<table width='100%'>\n$nav</table>\n")) |
|
| 706 | + . "</fieldset>\n"; |
|
| 707 | + } |
|
| 708 | + |
|
| 709 | + return $res; |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | function debusquer_navigation_boucles($boucles, $nom_skel, $self, $nom_source) { |
| 713 | - $i = 0; |
|
| 714 | - $res = ''; |
|
| 715 | - $var_mode_objet = _request('var_mode_objet'); |
|
| 716 | - $gram = preg_match('/[.](\w+)$/', $nom_source, $r) ? $r[1] : ''; |
|
| 717 | - |
|
| 718 | - foreach ($boucles as $objet => $boucle) { |
|
| 719 | - if (substr($objet, 0, strlen($nom_skel)) == $nom_skel) { |
|
| 720 | - $i++; |
|
| 721 | - $nom = $boucle->id_boucle; |
|
| 722 | - $req = $boucle->type_requete; |
|
| 723 | - $crit = public_decompiler($boucle, $gram, 0, 'criteres'); |
|
| 724 | - $self2 = $self . "&var_mode_objet=" . $objet; |
|
| 725 | - |
|
| 726 | - $res .= "\n<tr style='background-color: " . |
|
| 727 | - ($i % 2 ? '#e0e0f0' : '#f8f8ff') . |
|
| 728 | - "'><td align='right'>$i</td><td>\n" . |
|
| 729 | - "<a class='debug_link_boucle' href='" . |
|
| 730 | - $self2 . |
|
| 731 | - "&var_mode_affiche=boucle#f_$nom_skel'>" . |
|
| 732 | - _T('zbug_boucle') . |
|
| 733 | - "</a></td><td>\n<a class='debug_link_boucle' href='" . |
|
| 734 | - $self2 . |
|
| 735 | - "&var_mode_affiche=resultat#f_$nom_skel'>" . |
|
| 736 | - _T('zbug_resultat') . |
|
| 737 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 738 | - $self2 . |
|
| 739 | - "&var_mode_affiche=code#f_$nom_skel'>" . |
|
| 740 | - _T('zbug_code') . |
|
| 741 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 742 | - str_replace('var_mode=', 'var_profile=', $self2) . |
|
| 743 | - "'>" . |
|
| 744 | - _T('zbug_calcul') . |
|
| 745 | - "</a></td><td>\n" . |
|
| 746 | - (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom) . |
|
| 747 | - "</td><td>\n" . |
|
| 748 | - $req . |
|
| 749 | - "</td><td>\n" . |
|
| 750 | - spip_htmlspecialchars($crit) . |
|
| 751 | - "</td></tr>"; |
|
| 752 | - } |
|
| 753 | - } |
|
| 754 | - |
|
| 755 | - return $res; |
|
| 713 | + $i = 0; |
|
| 714 | + $res = ''; |
|
| 715 | + $var_mode_objet = _request('var_mode_objet'); |
|
| 716 | + $gram = preg_match('/[.](\w+)$/', $nom_source, $r) ? $r[1] : ''; |
|
| 717 | + |
|
| 718 | + foreach ($boucles as $objet => $boucle) { |
|
| 719 | + if (substr($objet, 0, strlen($nom_skel)) == $nom_skel) { |
|
| 720 | + $i++; |
|
| 721 | + $nom = $boucle->id_boucle; |
|
| 722 | + $req = $boucle->type_requete; |
|
| 723 | + $crit = public_decompiler($boucle, $gram, 0, 'criteres'); |
|
| 724 | + $self2 = $self . "&var_mode_objet=" . $objet; |
|
| 725 | + |
|
| 726 | + $res .= "\n<tr style='background-color: " . |
|
| 727 | + ($i % 2 ? '#e0e0f0' : '#f8f8ff') . |
|
| 728 | + "'><td align='right'>$i</td><td>\n" . |
|
| 729 | + "<a class='debug_link_boucle' href='" . |
|
| 730 | + $self2 . |
|
| 731 | + "&var_mode_affiche=boucle#f_$nom_skel'>" . |
|
| 732 | + _T('zbug_boucle') . |
|
| 733 | + "</a></td><td>\n<a class='debug_link_boucle' href='" . |
|
| 734 | + $self2 . |
|
| 735 | + "&var_mode_affiche=resultat#f_$nom_skel'>" . |
|
| 736 | + _T('zbug_resultat') . |
|
| 737 | + "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 738 | + $self2 . |
|
| 739 | + "&var_mode_affiche=code#f_$nom_skel'>" . |
|
| 740 | + _T('zbug_code') . |
|
| 741 | + "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 742 | + str_replace('var_mode=', 'var_profile=', $self2) . |
|
| 743 | + "'>" . |
|
| 744 | + _T('zbug_calcul') . |
|
| 745 | + "</a></td><td>\n" . |
|
| 746 | + (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom) . |
|
| 747 | + "</td><td>\n" . |
|
| 748 | + $req . |
|
| 749 | + "</td><td>\n" . |
|
| 750 | + spip_htmlspecialchars($crit) . |
|
| 751 | + "</td></tr>"; |
|
| 752 | + } |
|
| 753 | + } |
|
| 754 | + |
|
| 755 | + return $res; |
|
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | function debusquer_source($objet, $affiche) { |
| 759 | - $quoi = $GLOBALS['debug_objets'][$affiche][$objet]; |
|
| 760 | - if (!empty($GLOBALS['debug_objets']['boucle'][$objet]->id_boucle)) { |
|
| 761 | - $nom = $GLOBALS['debug_objets']['boucle'][$objet]->id_boucle; |
|
| 762 | - } else { |
|
| 763 | - $nom = $GLOBALS['debug_objets']['sourcefile'][$objet]; |
|
| 764 | - } |
|
| 765 | - $res2 = ""; |
|
| 766 | - |
|
| 767 | - if ($affiche == 'resultat') { |
|
| 768 | - $legend = $nom; |
|
| 769 | - $req = $GLOBALS['debug_objets']['requete'][$objet]; |
|
| 770 | - if (function_exists('_mysql_traite_query')) { |
|
| 771 | - $c = strtolower(_request('connect')); |
|
| 772 | - $c = $GLOBALS['connexions'][$c ? $c : 0]['prefixe']; |
|
| 773 | - $req = _mysql_traite_query($req, '', $c); |
|
| 774 | - } |
|
| 775 | - // permettre le copier/coller facile |
|
| 776 | - // $res = ancre_texte($req, array(), true); |
|
| 777 | - $res = "<div id='T" . md5($req) . "'>\n<pre>\n" . $req . "</pre>\n</div>\n"; |
|
| 778 | - // formatage et affichage des resultats bruts de la requete |
|
| 779 | - $ress_req = spip_query($req); |
|
| 780 | - $brut_sql = ''; |
|
| 781 | - $num = 1; |
|
| 782 | - // eviter l'affichage de milliers de lignes |
|
| 783 | - // personnalisation possible dans mes_options |
|
| 784 | - $max_aff = defined('_MAX_DEBUG_AFF') ? _MAX_DEBUG_AFF : 50; |
|
| 785 | - while ($retours_sql = sql_fetch($ress_req)) { |
|
| 786 | - if ($num <= $max_aff) { |
|
| 787 | - $brut_sql .= "<h3>" . ($num == 1 ? $num . " sur " . sql_count($ress_req) : $num) . "</h3>"; |
|
| 788 | - $brut_sql .= "<p>"; |
|
| 789 | - foreach ($retours_sql as $key => $val) { |
|
| 790 | - $brut_sql .= "<strong>" . $key . "</strong> => " . spip_htmlspecialchars(couper($val, 150)) . "<br />\n"; |
|
| 791 | - } |
|
| 792 | - $brut_sql .= "</p>"; |
|
| 793 | - } |
|
| 794 | - $num++; |
|
| 795 | - } |
|
| 796 | - $res2 = interdire_scripts($brut_sql); |
|
| 797 | - foreach ($quoi as $view) { |
|
| 798 | - // ne pas afficher les $contexte_inclus |
|
| 799 | - $view = preg_replace(",<\?php.+\?[>],Uims", "", $view); |
|
| 800 | - if ($view) { |
|
| 801 | - $res2 .= "\n<br /><fieldset>" . interdire_scripts($view) . "</fieldset>"; |
|
| 802 | - } |
|
| 803 | - } |
|
| 804 | - |
|
| 805 | - } elseif ($affiche == 'code') { |
|
| 806 | - $legend = $nom; |
|
| 807 | - $res = ancre_texte("<" . "?php\n" . $quoi . "\n?" . ">"); |
|
| 808 | - } elseif ($affiche == 'boucle') { |
|
| 809 | - $legend = _T('zbug_boucle') . ' ' . $nom; |
|
| 810 | - // Le compilateur prefixe le nom des boucles par l'extension du fichier source. |
|
| 811 | - $gram = preg_match('/^([^_]+)_/', $objet, $r) ? $r[1] : ''; |
|
| 812 | - $res = ancre_texte(public_decompiler($quoi, $gram, 0, 'boucle')); |
|
| 813 | - } elseif ($affiche == 'squelette') { |
|
| 814 | - $legend = $GLOBALS['debug_objets']['sourcefile'][$objet]; |
|
| 815 | - $res = ancre_texte($GLOBALS['debug_objets']['squelette'][$objet]); |
|
| 816 | - } |
|
| 817 | - |
|
| 818 | - return array($legend, $res, $res2); |
|
| 759 | + $quoi = $GLOBALS['debug_objets'][$affiche][$objet]; |
|
| 760 | + if (!empty($GLOBALS['debug_objets']['boucle'][$objet]->id_boucle)) { |
|
| 761 | + $nom = $GLOBALS['debug_objets']['boucle'][$objet]->id_boucle; |
|
| 762 | + } else { |
|
| 763 | + $nom = $GLOBALS['debug_objets']['sourcefile'][$objet]; |
|
| 764 | + } |
|
| 765 | + $res2 = ""; |
|
| 766 | + |
|
| 767 | + if ($affiche == 'resultat') { |
|
| 768 | + $legend = $nom; |
|
| 769 | + $req = $GLOBALS['debug_objets']['requete'][$objet]; |
|
| 770 | + if (function_exists('_mysql_traite_query')) { |
|
| 771 | + $c = strtolower(_request('connect')); |
|
| 772 | + $c = $GLOBALS['connexions'][$c ? $c : 0]['prefixe']; |
|
| 773 | + $req = _mysql_traite_query($req, '', $c); |
|
| 774 | + } |
|
| 775 | + // permettre le copier/coller facile |
|
| 776 | + // $res = ancre_texte($req, array(), true); |
|
| 777 | + $res = "<div id='T" . md5($req) . "'>\n<pre>\n" . $req . "</pre>\n</div>\n"; |
|
| 778 | + // formatage et affichage des resultats bruts de la requete |
|
| 779 | + $ress_req = spip_query($req); |
|
| 780 | + $brut_sql = ''; |
|
| 781 | + $num = 1; |
|
| 782 | + // eviter l'affichage de milliers de lignes |
|
| 783 | + // personnalisation possible dans mes_options |
|
| 784 | + $max_aff = defined('_MAX_DEBUG_AFF') ? _MAX_DEBUG_AFF : 50; |
|
| 785 | + while ($retours_sql = sql_fetch($ress_req)) { |
|
| 786 | + if ($num <= $max_aff) { |
|
| 787 | + $brut_sql .= "<h3>" . ($num == 1 ? $num . " sur " . sql_count($ress_req) : $num) . "</h3>"; |
|
| 788 | + $brut_sql .= "<p>"; |
|
| 789 | + foreach ($retours_sql as $key => $val) { |
|
| 790 | + $brut_sql .= "<strong>" . $key . "</strong> => " . spip_htmlspecialchars(couper($val, 150)) . "<br />\n"; |
|
| 791 | + } |
|
| 792 | + $brut_sql .= "</p>"; |
|
| 793 | + } |
|
| 794 | + $num++; |
|
| 795 | + } |
|
| 796 | + $res2 = interdire_scripts($brut_sql); |
|
| 797 | + foreach ($quoi as $view) { |
|
| 798 | + // ne pas afficher les $contexte_inclus |
|
| 799 | + $view = preg_replace(",<\?php.+\?[>],Uims", "", $view); |
|
| 800 | + if ($view) { |
|
| 801 | + $res2 .= "\n<br /><fieldset>" . interdire_scripts($view) . "</fieldset>"; |
|
| 802 | + } |
|
| 803 | + } |
|
| 804 | + |
|
| 805 | + } elseif ($affiche == 'code') { |
|
| 806 | + $legend = $nom; |
|
| 807 | + $res = ancre_texte("<" . "?php\n" . $quoi . "\n?" . ">"); |
|
| 808 | + } elseif ($affiche == 'boucle') { |
|
| 809 | + $legend = _T('zbug_boucle') . ' ' . $nom; |
|
| 810 | + // Le compilateur prefixe le nom des boucles par l'extension du fichier source. |
|
| 811 | + $gram = preg_match('/^([^_]+)_/', $objet, $r) ? $r[1] : ''; |
|
| 812 | + $res = ancre_texte(public_decompiler($quoi, $gram, 0, 'boucle')); |
|
| 813 | + } elseif ($affiche == 'squelette') { |
|
| 814 | + $legend = $GLOBALS['debug_objets']['sourcefile'][$objet]; |
|
| 815 | + $res = ancre_texte($GLOBALS['debug_objets']['squelette'][$objet]); |
|
| 816 | + } |
|
| 817 | + |
|
| 818 | + return array($legend, $res, $res2); |
|
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | // https://code.spip.net/@debusquer_entete |
| 822 | 822 | function debusquer_entete($titre, $corps) { |
| 823 | 823 | |
| 824 | - include_spip('balise/formulaire_admin'); |
|
| 825 | - include_spip('public/assembler'); // pour inclure_balise_dynamique |
|
| 826 | - include_spip('inc/texte'); // pour corriger_typo |
|
| 827 | - |
|
| 828 | - return _DOCTYPE_ECRIRE . |
|
| 829 | - html_lang_attributes() . |
|
| 830 | - "<head>\n<title>" . |
|
| 831 | - ('SPIP ' . $GLOBALS['spip_version_affichee'] . ' ' . |
|
| 832 | - _T('admin_debug') . ' ' . $titre . ' (' . |
|
| 833 | - supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))) . |
|
| 834 | - ")</title>\n" . |
|
| 835 | - "<meta http-equiv='Content-Type' content='text/html" . |
|
| 836 | - (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : '') . |
|
| 837 | - "' />\n" . |
|
| 838 | - http_script('', 'jquery.js') |
|
| 839 | - . "<link rel='stylesheet' href='" . url_absolue(find_in_path('spip_admin.css')) |
|
| 840 | - . "' type='text/css' />" . |
|
| 841 | - "</head>\n" . |
|
| 842 | - "<body style='margin:0 10px;'>\n" . |
|
| 843 | - "<div id='spip-debug-header'>" . |
|
| 844 | - $corps . |
|
| 845 | - inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false) . |
|
| 846 | - '</div></body></html>'; |
|
| 824 | + include_spip('balise/formulaire_admin'); |
|
| 825 | + include_spip('public/assembler'); // pour inclure_balise_dynamique |
|
| 826 | + include_spip('inc/texte'); // pour corriger_typo |
|
| 827 | + |
|
| 828 | + return _DOCTYPE_ECRIRE . |
|
| 829 | + html_lang_attributes() . |
|
| 830 | + "<head>\n<title>" . |
|
| 831 | + ('SPIP ' . $GLOBALS['spip_version_affichee'] . ' ' . |
|
| 832 | + _T('admin_debug') . ' ' . $titre . ' (' . |
|
| 833 | + supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))) . |
|
| 834 | + ")</title>\n" . |
|
| 835 | + "<meta http-equiv='Content-Type' content='text/html" . |
|
| 836 | + (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : '') . |
|
| 837 | + "' />\n" . |
|
| 838 | + http_script('', 'jquery.js') |
|
| 839 | + . "<link rel='stylesheet' href='" . url_absolue(find_in_path('spip_admin.css')) |
|
| 840 | + . "' type='text/css' />" . |
|
| 841 | + "</head>\n" . |
|
| 842 | + "<body style='margin:0 10px;'>\n" . |
|
| 843 | + "<div id='spip-debug-header'>" . |
|
| 844 | + $corps . |
|
| 845 | + inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false) . |
|
| 846 | + '</div></body></html>'; |
|
| 847 | 847 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | if (!$fonc) { |
| 148 | 148 | $fonc = $GLOBALS['debug_objets']['principal']; |
| 149 | 149 | } |
| 150 | - $titre = !$mode ? $fonc : ($mode . (isset($GLOBALS['debug_objets']['sourcefile'][$fonc]) ? " " . $GLOBALS['debug_objets']['sourcefile'][$fonc] : "")); |
|
| 150 | + $titre = !$mode ? $fonc : ($mode.(isset($GLOBALS['debug_objets']['sourcefile'][$fonc]) ? " ".$GLOBALS['debug_objets']['sourcefile'][$fonc] : "")); |
|
| 151 | 151 | } |
| 152 | 152 | if ($message === false) { |
| 153 | 153 | lang_select(); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $fond = isset($GLOBALS['fond']) ? $GLOBALS['fond'] : ""; |
| 177 | 177 | // une erreur critique sort $message en array |
| 178 | 178 | $debug = is_array($msg) ? $msg[1] : $msg; |
| 179 | - spip_log("Debug: " . $debug . " (" . $fond . ")"); |
|
| 179 | + spip_log("Debug: ".$debug." (".$fond.")"); |
|
| 180 | 180 | |
| 181 | 181 | return $msg; |
| 182 | 182 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | function debusquer_bandeau($erreurs) { |
| 185 | 185 | |
| 186 | 186 | if (!empty($erreurs)) { |
| 187 | - $n = array(count($erreurs) . ' ' . _T('zbug_erreur_squelette')); |
|
| 187 | + $n = array(count($erreurs).' '._T('zbug_erreur_squelette')); |
|
| 188 | 188 | |
| 189 | 189 | return debusquer_navigation($erreurs, $n); |
| 190 | 190 | } elseif (!empty($GLOBALS['tableau_des_temps'])) { |
@@ -217,25 +217,25 @@ discard block |
||
| 217 | 217 | $valeur_simple = array(); |
| 218 | 218 | foreach ($valeur as $v) { |
| 219 | 219 | if (is_array($v)) { |
| 220 | - $valeur_simple[] = 'array:' . count($v); |
|
| 220 | + $valeur_simple[] = 'array:'.count($v); |
|
| 221 | 221 | } elseif (is_object($v)) { |
| 222 | 222 | $valeur_simple[] = get_class($v); |
| 223 | 223 | } elseif (is_string($v)) { |
| 224 | - $valeur_simple[] = "'" . $v . "'"; |
|
| 224 | + $valeur_simple[] = "'".$v."'"; |
|
| 225 | 225 | } else { |
| 226 | 226 | $valeur_simple[] = $v; |
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | $n = count($valeur); |
| 230 | - $valeur = (($n > 3) ? 'array:' . $n . ' ' : ''); |
|
| 231 | - $valeur .= '[' . join(', ', $valeur_simple) . ']'; |
|
| 230 | + $valeur = (($n > 3) ? 'array:'.$n.' ' : ''); |
|
| 231 | + $valeur .= '['.join(', ', $valeur_simple).']'; |
|
| 232 | 232 | } elseif (is_object($valeur)) { |
| 233 | 233 | $valeur = get_class($valeur); |
| 234 | 234 | } elseif (is_string($valeur)) { |
| 235 | - $valeur = "'" . $valeur . "'"; |
|
| 235 | + $valeur = "'".$valeur."'"; |
|
| 236 | 236 | } |
| 237 | - $res .= "\n<tr><td><strong>" . nl2br(entites_html($nom)) |
|
| 238 | - . "</strong></td><td>: " . nl2br(entites_html($valeur)) |
|
| 237 | + $res .= "\n<tr><td><strong>".nl2br(entites_html($nom)) |
|
| 238 | + . "</strong></td><td>: ".nl2br(entites_html($valeur)) |
|
| 239 | 239 | . "</td></tr>\n"; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | $nom_code = $lieu->descr['nom']; |
| 264 | 264 | $skel = $lieu->descr['sourcefile']; |
| 265 | 265 | $h2 = parametre_url($href, 'var_mode_objet', $nom_code); |
| 266 | - $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette') . '#L' . $ligne; |
|
| 266 | + $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette').'#L'.$ligne; |
|
| 267 | 267 | $skel = "<a href='$h3'><b>$skel</b></a>"; |
| 268 | 268 | if ($boucle) { |
| 269 | - $h3 = parametre_url($h2 . $boucle, 'var_mode_affiche', 'boucle'); |
|
| 269 | + $h3 = parametre_url($h2.$boucle, 'var_mode_affiche', 'boucle'); |
|
| 270 | 270 | $boucle = "<a href='$h3'><b>$boucle</b></a>"; |
| 271 | 271 | } |
| 272 | 272 | } |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | // Requete erronee |
| 356 | - $err = "<b>" . _T('avis_erreur_mysql') . " $errno</b><br /><tt>\n" |
|
| 356 | + $err = "<b>"._T('avis_erreur_mysql')." $errno</b><br /><tt>\n" |
|
| 357 | 357 | . spip_htmlspecialchars($msg) |
| 358 | 358 | . "\n<br /><span style='color: red'><b>" |
| 359 | 359 | . spip_htmlspecialchars($query) |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | // https://code.spip.net/@trouve_boucle_debug |
| 369 | 369 | function trouve_boucle_debug($n, $nom, $debut = 0, $boucle = "") { |
| 370 | 370 | |
| 371 | - $id = $nom . $boucle; |
|
| 371 | + $id = $nom.$boucle; |
|
| 372 | 372 | if (is_array($GLOBALS['debug_objets']['sequence'][$id])) { |
| 373 | 373 | foreach ($GLOBALS['debug_objets']['sequence'][$id] as $v) { |
| 374 | 374 | |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | - $incl = ',' . $reg[1] . '[.]\w$,'; |
|
| 422 | + $incl = ','.$reg[1].'[.]\w$,'; |
|
| 423 | 423 | |
| 424 | 424 | foreach ($GLOBALS['debug_objets']['sourcefile'] as $k => $v) { |
| 425 | 425 | if (preg_match($incl, $v)) { |
@@ -435,16 +435,13 @@ discard block |
||
| 435 | 435 | list($skel, $boucle, $ligne) = trouve_boucle_debug($n, $nom); |
| 436 | 436 | |
| 437 | 437 | if (!$boucle) { |
| 438 | - return !$ligne ? "" : |
|
| 439 | - (" (" . |
|
| 440 | - (($nom != $skel) ? _T('squelette_inclus_ligne') : |
|
| 441 | - _T('squelette_ligne')) . |
|
| 438 | + return !$ligne ? "" : (" (". |
|
| 439 | + (($nom != $skel) ? _T('squelette_inclus_ligne') : _T('squelette_ligne')). |
|
| 442 | 440 | " <a href='$self&var_mode_objet=$skel&var_mode_affiche=squelette&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"); |
| 443 | 441 | } else { |
| 444 | 442 | $self .= "&var_mode_objet=$skel$boucle&var_mode_affiche=boucle"; |
| 445 | 443 | |
| 446 | - return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : |
|
| 447 | - " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 444 | + return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 448 | 445 | } |
| 449 | 446 | } |
| 450 | 447 | |
@@ -466,13 +463,13 @@ discard block |
||
| 466 | 463 | } |
| 467 | 464 | |
| 468 | 465 | $s = preg_replace(',<(\w[^<>]*)>([^<]*)<br />([^<]*)</\1>,', |
| 469 | - '<\1>\2</\1><br />' . "\n" . '<\1>\3</\1>', |
|
| 466 | + '<\1>\2</\1><br />'."\n".'<\1>\3</\1>', |
|
| 470 | 467 | $s); |
| 471 | 468 | |
| 472 | 469 | |
| 473 | 470 | $tableau = explode("<br />", $s); |
| 474 | 471 | |
| 475 | - $format = "<span style='float:left;display:block;width:50px;height:1px'><a id='L%d' style='background-color: white; visibility: " . ($nocpt ? 'hidden' : 'visible') . ";%s' href='#T%s' title=\"%s\">%0" . strval(@strlen(count($tableau))) . "d</a></span> %s<br />\n"; |
|
| 472 | + $format = "<span style='float:left;display:block;width:50px;height:1px'><a id='L%d' style='background-color: white; visibility: ".($nocpt ? 'hidden' : 'visible').";%s' href='#T%s' title=\"%s\">%0".strval(@strlen(count($tableau)))."d</a></span> %s<br />\n"; |
|
| 476 | 473 | |
| 477 | 474 | $format10 = str_replace('white', 'lightgrey', $format); |
| 478 | 475 | $formaterr = "color: red;"; |
@@ -516,7 +513,7 @@ discard block |
||
| 516 | 513 | . '" style="cursor: pointer;">' |
| 517 | 514 | . ($nocpt ? '' : _T('info_numero_abbreviation')) |
| 518 | 515 | . "</div> |
| 519 | - " . $res . "</div>\n"; |
|
| 516 | + " . $res."</div>\n"; |
|
| 520 | 517 | } |
| 521 | 518 | |
| 522 | 519 | // l'environnement graphique du debuggueur |
@@ -537,14 +534,14 @@ discard block |
||
| 537 | 534 | if (!empty($GLOBALS['debug_objets'][$mode][$fonc])) { |
| 538 | 535 | list($legend, $texte, $res2) = debusquer_source($fonc, $mode); |
| 539 | 536 | $texte .= $res2; |
| 540 | - } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc . 'tout'])) { |
|
| 541 | - $legend = _T('zbug_' . $mode); |
|
| 542 | - $texte = $GLOBALS['debug_objets'][$mode][$fonc . 'tout']; |
|
| 537 | + } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc.'tout'])) { |
|
| 538 | + $legend = _T('zbug_'.$mode); |
|
| 539 | + $texte = $GLOBALS['debug_objets'][$mode][$fonc.'tout']; |
|
| 543 | 540 | $texte = ancre_texte($texte, array('', '')); |
| 544 | 541 | } |
| 545 | 542 | } else { |
| 546 | 543 | if (strlen(trim($res))) { |
| 547 | - return "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res</div>"; |
|
| 544 | + return "<img src='".chemin_image('debug-xx.svg')."' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res</div>"; |
|
| 548 | 545 | } else { |
| 549 | 546 | // cas de l'appel sur erreur: montre la page |
| 550 | 547 | return isset($GLOBALS['debug_objets']['resultat']['tout']) |
@@ -554,7 +551,7 @@ discard block |
||
| 554 | 551 | } |
| 555 | 552 | } else { |
| 556 | 553 | $valider = charger_fonction('valider', 'xml'); |
| 557 | - $val = $valider($GLOBALS['debug_objets']['validation'][$fonc . 'tout']); |
|
| 554 | + $val = $valider($GLOBALS['debug_objets']['validation'][$fonc.'tout']); |
|
| 558 | 555 | // Si erreur, signaler leur nombre dans le formulaire admin |
| 559 | 556 | $GLOBALS['debug_objets']['validation'] = $val->err ? count($val->err) : ''; |
| 560 | 557 | list($texte, $err) = emboite_texte($val, $fonc, $self); |
@@ -565,14 +562,14 @@ discard block |
||
| 565 | 562 | } else { |
| 566 | 563 | $err = ": $err"; |
| 567 | 564 | } |
| 568 | - $legend = _T('validation') . ' ' . $err; |
|
| 565 | + $legend = _T('validation').' '.$err; |
|
| 569 | 566 | $res = $id = ''; |
| 570 | 567 | } |
| 571 | 568 | |
| 572 | 569 | return !trim($texte) ? '' : ( |
| 573 | - "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res" |
|
| 570 | + "<img src='".chemin_image('debug-xx.svg')."' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res" |
|
| 574 | 571 | . "<div id='debug_boucle'><fieldset$id><legend>" |
| 575 | - . "<a href='" . $self . "#f_" . substr($fonc, 0, 37) . "'> ↑ " |
|
| 572 | + . "<a href='".$self."#f_".substr($fonc, 0, 37)."'> ↑ " |
|
| 576 | 573 | . ($legend ? $legend : $mode) |
| 577 | 574 | . "</a></legend>" |
| 578 | 575 | . $texte |
@@ -584,7 +581,7 @@ discard block |
||
| 584 | 581 | // https://code.spip.net/@emboite_texte |
| 585 | 582 | function emboite_texte($res, $fonc = '', $self = '') { |
| 586 | 583 | $errs = $res->err; |
| 587 | - $texte = $res->entete . ($errs ? '' : $res->page); |
|
| 584 | + $texte = $res->entete.($errs ? '' : $res->page); |
|
| 588 | 585 | |
| 589 | 586 | if (!$texte and !$errs) { |
| 590 | 587 | return array(ancre_texte('', array('', '')), false); |
@@ -641,7 +638,7 @@ discard block |
||
| 641 | 638 | $err = "<h2 style='text-align: center'>" |
| 642 | 639 | . $i |
| 643 | 640 | . "<a href='#fin_err'>" |
| 644 | - . " " . _T('erreur_texte') |
|
| 641 | + . " "._T('erreur_texte') |
|
| 645 | 642 | . "</a></h2><table id='debut_err' style='width: 100%'>" |
| 646 | 643 | . $err |
| 647 | 644 | . " </table><a id='fin_err'></a>"; |
@@ -651,9 +648,9 @@ discard block |
||
| 651 | 648 | list($msg, $fermant, $ouvrant) = $errs[0]; |
| 652 | 649 | $rf = reference_boucle_debug($fermant, $fonc, $self); |
| 653 | 650 | $ro = reference_boucle_debug($ouvrant, $fonc, $self); |
| 654 | - $err = $msg . |
|
| 655 | - "<a href='#L" . $fermant . "'>$fermant</a>$rf<br />" . |
|
| 656 | - "<a href='#L" . $ouvrant . "'>$ouvrant</a>$ro"; |
|
| 651 | + $err = $msg. |
|
| 652 | + "<a href='#L".$fermant."'>$fermant</a>$rf<br />". |
|
| 653 | + "<a href='#L".$ouvrant."'>$ouvrant</a>$ro"; |
|
| 657 | 654 | |
| 658 | 655 | return array(ancre_texte($texte, array(array($ouvrant), array($fermant))), $err); |
| 659 | 656 | } |
@@ -685,7 +682,7 @@ discard block |
||
| 685 | 682 | $temps = !isset($GLOBALS['debug_objets']['profile'][$sourcefile]) ? '' : _T('zbug_profile', |
| 686 | 683 | array('time' => $GLOBALS['debug_objets']['profile'][$sourcefile])); |
| 687 | 684 | |
| 688 | - $res .= "<fieldset id='f_" . $nom . "'><legend>" |
|
| 685 | + $res .= "<fieldset id='f_".$nom."'><legend>" |
|
| 689 | 686 | . $t_skel |
| 690 | 687 | . ' ' |
| 691 | 688 | . $sourcefile |
@@ -700,7 +697,7 @@ discard block |
||
| 700 | 697 | . "'>" |
| 701 | 698 | . _T('zbug_calcul') |
| 702 | 699 | . "</a></legend>" |
| 703 | - . (!$temps ? '' : ("\n<span style='display:block;float:" . $GLOBALS['spip_lang_right'] . "'>$temps</span><br />")) |
|
| 700 | + . (!$temps ? '' : ("\n<span style='display:block;float:".$GLOBALS['spip_lang_right']."'>$temps</span><br />")) |
|
| 704 | 701 | . debusquer_contexte($contexte[$sourcefile]) |
| 705 | 702 | . (!$nav ? '' : ("<table width='100%'>\n$nav</table>\n")) |
| 706 | 703 | . "</fieldset>\n"; |
@@ -721,33 +718,33 @@ discard block |
||
| 721 | 718 | $nom = $boucle->id_boucle; |
| 722 | 719 | $req = $boucle->type_requete; |
| 723 | 720 | $crit = public_decompiler($boucle, $gram, 0, 'criteres'); |
| 724 | - $self2 = $self . "&var_mode_objet=" . $objet; |
|
| 725 | - |
|
| 726 | - $res .= "\n<tr style='background-color: " . |
|
| 727 | - ($i % 2 ? '#e0e0f0' : '#f8f8ff') . |
|
| 728 | - "'><td align='right'>$i</td><td>\n" . |
|
| 729 | - "<a class='debug_link_boucle' href='" . |
|
| 730 | - $self2 . |
|
| 731 | - "&var_mode_affiche=boucle#f_$nom_skel'>" . |
|
| 732 | - _T('zbug_boucle') . |
|
| 733 | - "</a></td><td>\n<a class='debug_link_boucle' href='" . |
|
| 734 | - $self2 . |
|
| 735 | - "&var_mode_affiche=resultat#f_$nom_skel'>" . |
|
| 736 | - _T('zbug_resultat') . |
|
| 737 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 738 | - $self2 . |
|
| 739 | - "&var_mode_affiche=code#f_$nom_skel'>" . |
|
| 740 | - _T('zbug_code') . |
|
| 741 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 742 | - str_replace('var_mode=', 'var_profile=', $self2) . |
|
| 743 | - "'>" . |
|
| 744 | - _T('zbug_calcul') . |
|
| 745 | - "</a></td><td>\n" . |
|
| 746 | - (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom) . |
|
| 747 | - "</td><td>\n" . |
|
| 748 | - $req . |
|
| 749 | - "</td><td>\n" . |
|
| 750 | - spip_htmlspecialchars($crit) . |
|
| 721 | + $self2 = $self."&var_mode_objet=".$objet; |
|
| 722 | + |
|
| 723 | + $res .= "\n<tr style='background-color: ". |
|
| 724 | + ($i % 2 ? '#e0e0f0' : '#f8f8ff'). |
|
| 725 | + "'><td align='right'>$i</td><td>\n". |
|
| 726 | + "<a class='debug_link_boucle' href='". |
|
| 727 | + $self2. |
|
| 728 | + "&var_mode_affiche=boucle#f_$nom_skel'>". |
|
| 729 | + _T('zbug_boucle'). |
|
| 730 | + "</a></td><td>\n<a class='debug_link_boucle' href='". |
|
| 731 | + $self2. |
|
| 732 | + "&var_mode_affiche=resultat#f_$nom_skel'>". |
|
| 733 | + _T('zbug_resultat'). |
|
| 734 | + "</a></td><td>\n<a class='debug_link_resultat' href='". |
|
| 735 | + $self2. |
|
| 736 | + "&var_mode_affiche=code#f_$nom_skel'>". |
|
| 737 | + _T('zbug_code'). |
|
| 738 | + "</a></td><td>\n<a class='debug_link_resultat' href='". |
|
| 739 | + str_replace('var_mode=', 'var_profile=', $self2). |
|
| 740 | + "'>". |
|
| 741 | + _T('zbug_calcul'). |
|
| 742 | + "</a></td><td>\n". |
|
| 743 | + (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom). |
|
| 744 | + "</td><td>\n". |
|
| 745 | + $req. |
|
| 746 | + "</td><td>\n". |
|
| 747 | + spip_htmlspecialchars($crit). |
|
| 751 | 748 | "</td></tr>"; |
| 752 | 749 | } |
| 753 | 750 | } |
@@ -774,7 +771,7 @@ discard block |
||
| 774 | 771 | } |
| 775 | 772 | // permettre le copier/coller facile |
| 776 | 773 | // $res = ancre_texte($req, array(), true); |
| 777 | - $res = "<div id='T" . md5($req) . "'>\n<pre>\n" . $req . "</pre>\n</div>\n"; |
|
| 774 | + $res = "<div id='T".md5($req)."'>\n<pre>\n".$req."</pre>\n</div>\n"; |
|
| 778 | 775 | // formatage et affichage des resultats bruts de la requete |
| 779 | 776 | $ress_req = spip_query($req); |
| 780 | 777 | $brut_sql = ''; |
@@ -784,10 +781,10 @@ discard block |
||
| 784 | 781 | $max_aff = defined('_MAX_DEBUG_AFF') ? _MAX_DEBUG_AFF : 50; |
| 785 | 782 | while ($retours_sql = sql_fetch($ress_req)) { |
| 786 | 783 | if ($num <= $max_aff) { |
| 787 | - $brut_sql .= "<h3>" . ($num == 1 ? $num . " sur " . sql_count($ress_req) : $num) . "</h3>"; |
|
| 784 | + $brut_sql .= "<h3>".($num == 1 ? $num." sur ".sql_count($ress_req) : $num)."</h3>"; |
|
| 788 | 785 | $brut_sql .= "<p>"; |
| 789 | 786 | foreach ($retours_sql as $key => $val) { |
| 790 | - $brut_sql .= "<strong>" . $key . "</strong> => " . spip_htmlspecialchars(couper($val, 150)) . "<br />\n"; |
|
| 787 | + $brut_sql .= "<strong>".$key."</strong> => ".spip_htmlspecialchars(couper($val, 150))."<br />\n"; |
|
| 791 | 788 | } |
| 792 | 789 | $brut_sql .= "</p>"; |
| 793 | 790 | } |
@@ -798,15 +795,15 @@ discard block |
||
| 798 | 795 | // ne pas afficher les $contexte_inclus |
| 799 | 796 | $view = preg_replace(",<\?php.+\?[>],Uims", "", $view); |
| 800 | 797 | if ($view) { |
| 801 | - $res2 .= "\n<br /><fieldset>" . interdire_scripts($view) . "</fieldset>"; |
|
| 798 | + $res2 .= "\n<br /><fieldset>".interdire_scripts($view)."</fieldset>"; |
|
| 802 | 799 | } |
| 803 | 800 | } |
| 804 | 801 | |
| 805 | 802 | } elseif ($affiche == 'code') { |
| 806 | 803 | $legend = $nom; |
| 807 | - $res = ancre_texte("<" . "?php\n" . $quoi . "\n?" . ">"); |
|
| 804 | + $res = ancre_texte("<"."?php\n".$quoi."\n?".">"); |
|
| 808 | 805 | } elseif ($affiche == 'boucle') { |
| 809 | - $legend = _T('zbug_boucle') . ' ' . $nom; |
|
| 806 | + $legend = _T('zbug_boucle').' '.$nom; |
|
| 810 | 807 | // Le compilateur prefixe le nom des boucles par l'extension du fichier source. |
| 811 | 808 | $gram = preg_match('/^([^_]+)_/', $objet, $r) ? $r[1] : ''; |
| 812 | 809 | $res = ancre_texte(public_decompiler($quoi, $gram, 0, 'boucle')); |
@@ -825,23 +822,23 @@ discard block |
||
| 825 | 822 | include_spip('public/assembler'); // pour inclure_balise_dynamique |
| 826 | 823 | include_spip('inc/texte'); // pour corriger_typo |
| 827 | 824 | |
| 828 | - return _DOCTYPE_ECRIRE . |
|
| 829 | - html_lang_attributes() . |
|
| 830 | - "<head>\n<title>" . |
|
| 831 | - ('SPIP ' . $GLOBALS['spip_version_affichee'] . ' ' . |
|
| 832 | - _T('admin_debug') . ' ' . $titre . ' (' . |
|
| 833 | - supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))) . |
|
| 834 | - ")</title>\n" . |
|
| 835 | - "<meta http-equiv='Content-Type' content='text/html" . |
|
| 836 | - (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : '') . |
|
| 837 | - "' />\n" . |
|
| 825 | + return _DOCTYPE_ECRIRE. |
|
| 826 | + html_lang_attributes(). |
|
| 827 | + "<head>\n<title>". |
|
| 828 | + ('SPIP '.$GLOBALS['spip_version_affichee'].' '. |
|
| 829 | + _T('admin_debug').' '.$titre.' ('. |
|
| 830 | + supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))). |
|
| 831 | + ")</title>\n". |
|
| 832 | + "<meta http-equiv='Content-Type' content='text/html". |
|
| 833 | + (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : ''). |
|
| 834 | + "' />\n". |
|
| 838 | 835 | http_script('', 'jquery.js') |
| 839 | - . "<link rel='stylesheet' href='" . url_absolue(find_in_path('spip_admin.css')) |
|
| 840 | - . "' type='text/css' />" . |
|
| 841 | - "</head>\n" . |
|
| 842 | - "<body style='margin:0 10px;'>\n" . |
|
| 843 | - "<div id='spip-debug-header'>" . |
|
| 844 | - $corps . |
|
| 845 | - inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false) . |
|
| 836 | + . "<link rel='stylesheet' href='".url_absolue(find_in_path('spip_admin.css')) |
|
| 837 | + . "' type='text/css' />". |
|
| 838 | + "</head>\n". |
|
| 839 | + "<body style='margin:0 10px;'>\n". |
|
| 840 | + "<div id='spip-debug-header'>". |
|
| 841 | + $corps. |
|
| 842 | + inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false). |
|
| 846 | 843 | '</div></body></html>'; |
| 847 | 844 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -34,32 +34,32 @@ discard block |
||
| 34 | 34 | * Contenu HTML, avec boutons d'administrations et sa CSS |
| 35 | 35 | **/ |
| 36 | 36 | function affiche_boutons_admin($contenu) { |
| 37 | - include_spip('inc/filtres'); |
|
| 37 | + include_spip('inc/filtres'); |
|
| 38 | 38 | |
| 39 | - // Inserer le css d'admin |
|
| 40 | - $css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 41 | - . "' type='text/css' />\n"; |
|
| 42 | - if ($f = find_in_path('spip_admin_perso.css')) { |
|
| 43 | - $css .= "<link rel='stylesheet' href='" |
|
| 44 | - . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 45 | - } |
|
| 39 | + // Inserer le css d'admin |
|
| 40 | + $css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 41 | + . "' type='text/css' />\n"; |
|
| 42 | + if ($f = find_in_path('spip_admin_perso.css')) { |
|
| 43 | + $css .= "<link rel='stylesheet' href='" |
|
| 44 | + . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - ($pos = stripos($contenu, '</head>')) |
|
| 48 | - || ($pos = stripos($contenu, '<body>')) |
|
| 49 | - || ($pos = 0); |
|
| 50 | - $contenu = substr_replace($contenu, $css, $pos, 0); |
|
| 47 | + ($pos = stripos($contenu, '</head>')) |
|
| 48 | + || ($pos = stripos($contenu, '<body>')) |
|
| 49 | + || ($pos = 0); |
|
| 50 | + $contenu = substr_replace($contenu, $css, $pos, 0); |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | - // Inserer la balise #FORMULAIRE_ADMIN, en float |
|
| 54 | - $boutons_admin = inclure_balise_dynamique( |
|
| 55 | - balise_FORMULAIRE_ADMIN_dyn('spip-admin-float'), |
|
| 56 | - false); |
|
| 53 | + // Inserer la balise #FORMULAIRE_ADMIN, en float |
|
| 54 | + $boutons_admin = inclure_balise_dynamique( |
|
| 55 | + balise_FORMULAIRE_ADMIN_dyn('spip-admin-float'), |
|
| 56 | + false); |
|
| 57 | 57 | |
| 58 | - ($pos = strripos($contenu, '</body>')) |
|
| 59 | - || ($pos = strripos($contenu, '</html>')) |
|
| 60 | - || ($pos = strlen($contenu)); |
|
| 61 | - $contenu = substr_replace($contenu, $boutons_admin, $pos, 0); |
|
| 58 | + ($pos = strripos($contenu, '</body>')) |
|
| 59 | + || ($pos = strripos($contenu, '</html>')) |
|
| 60 | + || ($pos = strlen($contenu)); |
|
| 61 | + $contenu = substr_replace($contenu, $boutons_admin, $pos, 0); |
|
| 62 | 62 | |
| 63 | 63 | |
| 64 | - return $contenu; |
|
| 64 | + return $contenu; |
|
| 65 | 65 | } |
@@ -37,11 +37,11 @@ |
||
| 37 | 37 | include_spip('inc/filtres'); |
| 38 | 38 | |
| 39 | 39 | // Inserer le css d'admin |
| 40 | - $css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 40 | + $css = "<link rel='stylesheet' href='".url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 41 | 41 | . "' type='text/css' />\n"; |
| 42 | 42 | if ($f = find_in_path('spip_admin_perso.css')) { |
| 43 | 43 | $css .= "<link rel='stylesheet' href='" |
| 44 | - . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 44 | + . url_absolue(direction_css($f))."' type='text/css' />\n"; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | ($pos = stripos($contenu, '</head>')) |
@@ -29,36 +29,36 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | function format_inclure_html($file, $args, $prof) { |
| 31 | 31 | if (strpos($file, '#') === false) { |
| 32 | - $t = $file ? ("(" . $file . ")") : ""; |
|
| 32 | + $t = $file ? ("(".$file.")") : ""; |
|
| 33 | 33 | } else { |
| 34 | - $t = "{fond=" . $file . '}'; |
|
| 34 | + $t = "{fond=".$file.'}'; |
|
| 35 | 35 | } |
| 36 | - $args = !$args ? '' : ("{" . join(", ", $args) . "}"); |
|
| 36 | + $args = !$args ? '' : ("{".join(", ", $args)."}"); |
|
| 37 | 37 | |
| 38 | - return ("<INCLURE" . $t . $args . ">"); |
|
| 38 | + return ("<INCLURE".$t.$args.">"); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | function format_polyglotte_html($args, $prof) { |
| 42 | 42 | $contenu = array(); |
| 43 | 43 | foreach ($args as $l => $t) { |
| 44 | - $contenu[] = ($l ? "[$l]" : '') . $t; |
|
| 44 | + $contenu[] = ($l ? "[$l]" : '').$t; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - return ("<multi>" . join(" ", $contenu) . "</multi>"); |
|
| 47 | + return ("<multi>".join(" ", $contenu)."</multi>"); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | function format_idiome_html($nom, $module, $args, $filtres, $prof) { |
| 51 | 51 | foreach ($args as $k => $v) { |
| 52 | 52 | $args[$k] = "$k=$v"; |
| 53 | 53 | } |
| 54 | - $args = (!$args ? '' : ('{' . join(',', $args) . '}')); |
|
| 54 | + $args = (!$args ? '' : ('{'.join(',', $args).'}')); |
|
| 55 | 55 | |
| 56 | - return ("<:" . ($module ? "$module:" : "") . $nom . $args . $filtres . ":>"); |
|
| 56 | + return ("<:".($module ? "$module:" : "").$nom.$args.$filtres.":>"); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | function format_champ_html($nom, $boucle, $etoile, $avant, $apres, $args, $filtres, $prof) { |
| 60 | 60 | $nom = "#" |
| 61 | - . ($boucle ? ($boucle . ":") : "") |
|
| 61 | + . ($boucle ? ($boucle.":") : "") |
|
| 62 | 62 | . $nom |
| 63 | 63 | . $etoile |
| 64 | 64 | . $args |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | $critere[$k] = $crit_s; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - return (!$critere ? "" : ("{" . join(",", $critere) . "}")); |
|
| 91 | + return (!$critere ? "" : ("{".join(",", $critere)."}")); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | function format_liste_html($fonc, $args, $prof) { |
| 95 | 95 | return ((($fonc !== '') ? "|$fonc" : $fonc) |
| 96 | - . (!$args ? "" : ("{" . join(",", $args) . "}"))); |
|
| 96 | + . (!$args ? "" : ("{".join(",", $args)."}"))); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // Concatenation sans separateur: verifier qu'on ne cree pas de faux lexemes |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | // si un texte se termine par ( et est suivi d'un champ |
| 110 | 110 | // ou assimiles, forcer la notation pleine |
| 111 | 111 | if ($c1 == '(' and substr($texte2, 0, 1) == '#') { |
| 112 | - $args[$i + 1][0] = '[(' . $texte2 . ')]'; |
|
| 112 | + $args[$i + 1][0] = '[('.$texte2.')]'; |
|
| 113 | 113 | } |
| 114 | 114 | } else { |
| 115 | 115 | if ($type == 'texte') { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | if (($c1 == '}' and substr(ltrim($texte2), 0, 1) == '|') |
| 122 | 122 | or (preg_match('/[\w\d_*]/', $c1) and preg_match('/^[\w\d_*{|]/', $texte2)) |
| 123 | 123 | ) { |
| 124 | - $args[$i][0] = '[(' . $texte . ')]'; |
|
| 124 | + $args[$i][0] = '[('.$texte.')]'; |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -11,126 +11,126 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function format_boucle_html($preaff, $avant, $nom, $type, $crit, $corps, $apres, $altern, $postaff, $prof) { |
| 18 | - $preaff = $preaff ? "<BB$nom>$preaff" : ""; |
|
| 19 | - $avant = $avant ? "<B$nom>$avant" : ""; |
|
| 20 | - $apres = $apres ? "$apres</B$nom>" : ""; |
|
| 21 | - $altern = $altern ? "$altern<//B$nom>" : ""; |
|
| 22 | - $postaff = $postaff ? "$postaff</BB$nom>" : ""; |
|
| 23 | - if (!$corps) { |
|
| 24 | - $corps = " />"; |
|
| 25 | - } else { |
|
| 26 | - $corps = ">$corps</BOUCLE$nom>"; |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - return "$preaff$avant<BOUCLE$nom($type)$crit$corps$apres$altern$postaff"; |
|
| 18 | + $preaff = $preaff ? "<BB$nom>$preaff" : ""; |
|
| 19 | + $avant = $avant ? "<B$nom>$avant" : ""; |
|
| 20 | + $apres = $apres ? "$apres</B$nom>" : ""; |
|
| 21 | + $altern = $altern ? "$altern<//B$nom>" : ""; |
|
| 22 | + $postaff = $postaff ? "$postaff</BB$nom>" : ""; |
|
| 23 | + if (!$corps) { |
|
| 24 | + $corps = " />"; |
|
| 25 | + } else { |
|
| 26 | + $corps = ">$corps</BOUCLE$nom>"; |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + return "$preaff$avant<BOUCLE$nom($type)$crit$corps$apres$altern$postaff"; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | function format_inclure_html($file, $args, $prof) { |
| 33 | - if (strpos($file, '#') === false) { |
|
| 34 | - $t = $file ? ("(" . $file . ")") : ""; |
|
| 35 | - } else { |
|
| 36 | - $t = "{fond=" . $file . '}'; |
|
| 37 | - } |
|
| 38 | - $args = !$args ? '' : ("{" . join(", ", $args) . "}"); |
|
| 39 | - |
|
| 40 | - return ("<INCLURE" . $t . $args . ">"); |
|
| 33 | + if (strpos($file, '#') === false) { |
|
| 34 | + $t = $file ? ("(" . $file . ")") : ""; |
|
| 35 | + } else { |
|
| 36 | + $t = "{fond=" . $file . '}'; |
|
| 37 | + } |
|
| 38 | + $args = !$args ? '' : ("{" . join(", ", $args) . "}"); |
|
| 39 | + |
|
| 40 | + return ("<INCLURE" . $t . $args . ">"); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | function format_polyglotte_html($args, $prof) { |
| 44 | - $contenu = array(); |
|
| 45 | - foreach ($args as $l => $t) { |
|
| 46 | - $contenu[] = ($l ? "[$l]" : '') . $t; |
|
| 47 | - } |
|
| 44 | + $contenu = array(); |
|
| 45 | + foreach ($args as $l => $t) { |
|
| 46 | + $contenu[] = ($l ? "[$l]" : '') . $t; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - return ("<multi>" . join(" ", $contenu) . "</multi>"); |
|
| 49 | + return ("<multi>" . join(" ", $contenu) . "</multi>"); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | function format_idiome_html($nom, $module, $args, $filtres, $prof) { |
| 53 | - foreach ($args as $k => $v) { |
|
| 54 | - $args[$k] = "$k=$v"; |
|
| 55 | - } |
|
| 56 | - $args = (!$args ? '' : ('{' . join(',', $args) . '}')); |
|
| 53 | + foreach ($args as $k => $v) { |
|
| 54 | + $args[$k] = "$k=$v"; |
|
| 55 | + } |
|
| 56 | + $args = (!$args ? '' : ('{' . join(',', $args) . '}')); |
|
| 57 | 57 | |
| 58 | - return ("<:" . ($module ? "$module:" : "") . $nom . $args . $filtres . ":>"); |
|
| 58 | + return ("<:" . ($module ? "$module:" : "") . $nom . $args . $filtres . ":>"); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | function format_champ_html($nom, $boucle, $etoile, $avant, $apres, $args, $filtres, $prof) { |
| 62 | - $nom = "#" |
|
| 63 | - . ($boucle ? ($boucle . ":") : "") |
|
| 64 | - . $nom |
|
| 65 | - . $etoile |
|
| 66 | - . $args |
|
| 67 | - . $filtres; |
|
| 62 | + $nom = "#" |
|
| 63 | + . ($boucle ? ($boucle . ":") : "") |
|
| 64 | + . $nom |
|
| 65 | + . $etoile |
|
| 66 | + . $args |
|
| 67 | + . $filtres; |
|
| 68 | 68 | |
| 69 | - // Determiner si c'est un champ etendu, |
|
| 69 | + // Determiner si c'est un champ etendu, |
|
| 70 | 70 | |
| 71 | - $s = ($avant or $apres or $filtres |
|
| 72 | - or (strpos($args, '(#') !== false)); |
|
| 71 | + $s = ($avant or $apres or $filtres |
|
| 72 | + or (strpos($args, '(#') !== false)); |
|
| 73 | 73 | |
| 74 | - return ($s ? "[$avant($nom)$apres]" : $nom); |
|
| 74 | + return ($s ? "[$avant($nom)$apres]" : $nom); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | function format_critere_html($critere) { |
| 78 | - foreach ($critere as $k => $crit) { |
|
| 79 | - $crit_s = ''; |
|
| 80 | - foreach ($crit as $operande) { |
|
| 81 | - list($type, $valeur) = $operande; |
|
| 82 | - if ($type == 'champ' and $valeur[0] == '[') { |
|
| 83 | - $valeur = substr($valeur, 1, -1); |
|
| 84 | - if (preg_match(',^[(](#[^|]*)[)]$,sS', $valeur)) { |
|
| 85 | - $valeur = substr($valeur, 1, -1); |
|
| 86 | - } |
|
| 87 | - } |
|
| 88 | - $crit_s .= $valeur; |
|
| 89 | - } |
|
| 90 | - $critere[$k] = $crit_s; |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - return (!$critere ? "" : ("{" . join(",", $critere) . "}")); |
|
| 78 | + foreach ($critere as $k => $crit) { |
|
| 79 | + $crit_s = ''; |
|
| 80 | + foreach ($crit as $operande) { |
|
| 81 | + list($type, $valeur) = $operande; |
|
| 82 | + if ($type == 'champ' and $valeur[0] == '[') { |
|
| 83 | + $valeur = substr($valeur, 1, -1); |
|
| 84 | + if (preg_match(',^[(](#[^|]*)[)]$,sS', $valeur)) { |
|
| 85 | + $valeur = substr($valeur, 1, -1); |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | + $crit_s .= $valeur; |
|
| 89 | + } |
|
| 90 | + $critere[$k] = $crit_s; |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + return (!$critere ? "" : ("{" . join(",", $critere) . "}")); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | function format_liste_html($fonc, $args, $prof) { |
| 97 | - return ((($fonc !== '') ? "|$fonc" : $fonc) |
|
| 98 | - . (!$args ? "" : ("{" . join(",", $args) . "}"))); |
|
| 97 | + return ((($fonc !== '') ? "|$fonc" : $fonc) |
|
| 98 | + . (!$args ? "" : ("{" . join(",", $args) . "}"))); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // Concatenation sans separateur: verifier qu'on ne cree pas de faux lexemes |
| 102 | 102 | function format_suite_html($args) { |
| 103 | - for ($i = 0; $i < count($args) - 1; $i++) { |
|
| 104 | - list($texte, $type) = $args[$i]; |
|
| 105 | - list($texte2, $type2) = $args[$i + 1]; |
|
| 106 | - if (!$texte or !$texte2) { |
|
| 107 | - continue; |
|
| 108 | - } |
|
| 109 | - $c1 = substr($texte, -1); |
|
| 110 | - if ($type2 !== 'texte') { |
|
| 111 | - // si un texte se termine par ( et est suivi d'un champ |
|
| 112 | - // ou assimiles, forcer la notation pleine |
|
| 113 | - if ($c1 == '(' and substr($texte2, 0, 1) == '#') { |
|
| 114 | - $args[$i + 1][0] = '[(' . $texte2 . ')]'; |
|
| 115 | - } |
|
| 116 | - } else { |
|
| 117 | - if ($type == 'texte') { |
|
| 118 | - continue; |
|
| 119 | - } |
|
| 120 | - // si un champ ou assimiles est suivi d'un texte |
|
| 121 | - // et si celui-ci commence par un caractere de champ |
|
| 122 | - // forcer la notation pleine |
|
| 123 | - if (($c1 == '}' and substr(ltrim($texte2), 0, 1) == '|') |
|
| 124 | - or (preg_match('/[\w\d_*]/', $c1) and preg_match('/^[\w\d_*{|]/', $texte2)) |
|
| 125 | - ) { |
|
| 126 | - $args[$i][0] = '[(' . $texte . ')]'; |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - return join("", array_map(function($arg) { return reset($arg); }, $args)); |
|
| 103 | + for ($i = 0; $i < count($args) - 1; $i++) { |
|
| 104 | + list($texte, $type) = $args[$i]; |
|
| 105 | + list($texte2, $type2) = $args[$i + 1]; |
|
| 106 | + if (!$texte or !$texte2) { |
|
| 107 | + continue; |
|
| 108 | + } |
|
| 109 | + $c1 = substr($texte, -1); |
|
| 110 | + if ($type2 !== 'texte') { |
|
| 111 | + // si un texte se termine par ( et est suivi d'un champ |
|
| 112 | + // ou assimiles, forcer la notation pleine |
|
| 113 | + if ($c1 == '(' and substr($texte2, 0, 1) == '#') { |
|
| 114 | + $args[$i + 1][0] = '[(' . $texte2 . ')]'; |
|
| 115 | + } |
|
| 116 | + } else { |
|
| 117 | + if ($type == 'texte') { |
|
| 118 | + continue; |
|
| 119 | + } |
|
| 120 | + // si un champ ou assimiles est suivi d'un texte |
|
| 121 | + // et si celui-ci commence par un caractere de champ |
|
| 122 | + // forcer la notation pleine |
|
| 123 | + if (($c1 == '}' and substr(ltrim($texte2), 0, 1) == '|') |
|
| 124 | + or (preg_match('/[\w\d_*]/', $c1) and preg_match('/^[\w\d_*{|]/', $texte2)) |
|
| 125 | + ) { |
|
| 126 | + $args[$i][0] = '[(' . $texte . ')]'; |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + return join("", array_map(function($arg) { return reset($arg); }, $args)); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | function format_texte_html($texte) { |
| 135 | - return $texte; |
|
| 135 | + return $texte; |
|
| 136 | 136 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | **/ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * Code PHP compilé de la boucle |
| 34 | 34 | **/ |
| 35 | 35 | function boucle_DEFAUT_dist($id_boucle, &$boucles) { |
| 36 | - return calculer_boucle($id_boucle, $boucles); |
|
| 36 | + return calculer_boucle($id_boucle, $boucles); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * Code PHP compilé de la boucle |
| 53 | 53 | **/ |
| 54 | 54 | function boucle_BOUCLE_dist($id_boucle, &$boucles) { |
| 55 | - return calculer_boucle($id_boucle, $boucles); |
|
| 55 | + return calculer_boucle($id_boucle, $boucles); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -82,30 +82,30 @@ discard block |
||
| 82 | 82 | * Code PHP compilé de la boucle |
| 83 | 83 | **/ |
| 84 | 84 | function boucle_HIERARCHIE_dist($id_boucle, &$boucles) { |
| 85 | - $boucle = &$boucles[$id_boucle]; |
|
| 86 | - $id_table = $boucle->id_table . ".id_rubrique"; |
|
| 85 | + $boucle = &$boucles[$id_boucle]; |
|
| 86 | + $id_table = $boucle->id_table . ".id_rubrique"; |
|
| 87 | 87 | |
| 88 | - // Si la boucle mere est une boucle RUBRIQUES il faut ignorer la feuille |
|
| 89 | - // sauf en presence du critere {tout} (vu par phraser_html) |
|
| 90 | - // ou {id_article} qui positionne aussi le {tout} |
|
| 88 | + // Si la boucle mere est une boucle RUBRIQUES il faut ignorer la feuille |
|
| 89 | + // sauf en presence du critere {tout} (vu par phraser_html) |
|
| 90 | + // ou {id_article} qui positionne aussi le {tout} |
|
| 91 | 91 | |
| 92 | - $boucle->hierarchie = 'if (!($id_rubrique = intval(' |
|
| 93 | - . calculer_argument_precedent($boucle->id_boucle, 'id_rubrique', $boucles) |
|
| 94 | - . ")))\n\t\treturn '';\n\t" |
|
| 95 | - . "include_spip('inc/rubriques');\n\t" |
|
| 96 | - . '$hierarchie = calcul_hierarchie_in($id_rubrique,' |
|
| 97 | - . (isset($boucle->modificateur['tout']) ? 'true' : 'false') |
|
| 98 | - . ");\n\t" |
|
| 99 | - . 'if (!$hierarchie) return "";' . "\n\t"; |
|
| 92 | + $boucle->hierarchie = 'if (!($id_rubrique = intval(' |
|
| 93 | + . calculer_argument_precedent($boucle->id_boucle, 'id_rubrique', $boucles) |
|
| 94 | + . ")))\n\t\treturn '';\n\t" |
|
| 95 | + . "include_spip('inc/rubriques');\n\t" |
|
| 96 | + . '$hierarchie = calcul_hierarchie_in($id_rubrique,' |
|
| 97 | + . (isset($boucle->modificateur['tout']) ? 'true' : 'false') |
|
| 98 | + . ");\n\t" |
|
| 99 | + . 'if (!$hierarchie) return "";' . "\n\t"; |
|
| 100 | 100 | |
| 101 | - $boucle->where[] = array("'IN'", "'$id_table'", '"($hierarchie)"'); |
|
| 101 | + $boucle->where[] = array("'IN'", "'$id_table'", '"($hierarchie)"'); |
|
| 102 | 102 | |
| 103 | - $order = "FIELD($id_table, \$hierarchie)"; |
|
| 104 | - if (!isset($boucle->default_order[0]) or $boucle->default_order[0] != " DESC") { |
|
| 105 | - $boucle->default_order[] = "\"$order\""; |
|
| 106 | - } else { |
|
| 107 | - $boucle->default_order[0] = "\"$order DESC\""; |
|
| 108 | - } |
|
| 103 | + $order = "FIELD($id_table, \$hierarchie)"; |
|
| 104 | + if (!isset($boucle->default_order[0]) or $boucle->default_order[0] != " DESC") { |
|
| 105 | + $boucle->default_order[] = "\"$order\""; |
|
| 106 | + } else { |
|
| 107 | + $boucle->default_order[0] = "\"$order DESC\""; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - return calculer_boucle($id_boucle, $boucles); |
|
| 110 | + return calculer_boucle($id_boucle, $boucles); |
|
| 111 | 111 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | **/ |
| 84 | 84 | function boucle_HIERARCHIE_dist($id_boucle, &$boucles) { |
| 85 | 85 | $boucle = &$boucles[$id_boucle]; |
| 86 | - $id_table = $boucle->id_table . ".id_rubrique"; |
|
| 86 | + $id_table = $boucle->id_table.".id_rubrique"; |
|
| 87 | 87 | |
| 88 | 88 | // Si la boucle mere est une boucle RUBRIQUES il faut ignorer la feuille |
| 89 | 89 | // sauf en presence du critere {tout} (vu par phraser_html) |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | . '$hierarchie = calcul_hierarchie_in($id_rubrique,' |
| 97 | 97 | . (isset($boucle->modificateur['tout']) ? 'true' : 'false') |
| 98 | 98 | . ");\n\t" |
| 99 | - . 'if (!$hierarchie) return "";' . "\n\t"; |
|
| 99 | + . 'if (!$hierarchie) return "";'."\n\t"; |
|
| 100 | 100 | |
| 101 | 101 | $boucle->where[] = array("'IN'", "'$id_table'", '"($hierarchie)"'); |
| 102 | 102 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/presentation'); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @return string Code HTML |
| 33 | 33 | **/ |
| 34 | 34 | function exec_puce_statut_dist() { |
| 35 | - exec_puce_statut_args(_request('id'), _request('type')); |
|
| 35 | + exec_puce_statut_args(_request('id'), _request('type')); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -52,25 +52,25 @@ discard block |
||
| 52 | 52 | * @return string Code HTML |
| 53 | 53 | **/ |
| 54 | 54 | function exec_puce_statut_args($id, $type) { |
| 55 | - $id = intval($id); |
|
| 56 | - if ($table_objet_sql = table_objet_sql($type) |
|
| 57 | - and $d = lister_tables_objets_sql($table_objet_sql) |
|
| 58 | - and isset($d['statut_textes_instituer']) |
|
| 59 | - and $d['statut_textes_instituer'] |
|
| 60 | - ) { |
|
| 61 | - $prim = id_table_objet($type); |
|
| 62 | - if (isset($d['field']['id_rubrique'])) { |
|
| 63 | - $select = "id_rubrique,statut"; |
|
| 64 | - } else { |
|
| 65 | - $select = "0 as id_rubrique,statut"; |
|
| 66 | - } |
|
| 67 | - $r = sql_fetsel($select, $table_objet_sql, "$prim=$id"); |
|
| 68 | - $statut = $r['statut']; |
|
| 69 | - $id_rubrique = $r['id_rubrique']; |
|
| 70 | - } else { |
|
| 71 | - $id_rubrique = $id; |
|
| 72 | - $statut = 'prop'; // arbitraire |
|
| 73 | - } |
|
| 74 | - $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 75 | - ajax_retour($puce_statut($id, $statut, $id_rubrique, $type, true)); |
|
| 55 | + $id = intval($id); |
|
| 56 | + if ($table_objet_sql = table_objet_sql($type) |
|
| 57 | + and $d = lister_tables_objets_sql($table_objet_sql) |
|
| 58 | + and isset($d['statut_textes_instituer']) |
|
| 59 | + and $d['statut_textes_instituer'] |
|
| 60 | + ) { |
|
| 61 | + $prim = id_table_objet($type); |
|
| 62 | + if (isset($d['field']['id_rubrique'])) { |
|
| 63 | + $select = "id_rubrique,statut"; |
|
| 64 | + } else { |
|
| 65 | + $select = "0 as id_rubrique,statut"; |
|
| 66 | + } |
|
| 67 | + $r = sql_fetsel($select, $table_objet_sql, "$prim=$id"); |
|
| 68 | + $statut = $r['statut']; |
|
| 69 | + $id_rubrique = $r['id_rubrique']; |
|
| 70 | + } else { |
|
| 71 | + $id_rubrique = $id; |
|
| 72 | + $statut = 'prop'; // arbitraire |
|
| 73 | + } |
|
| 74 | + $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 75 | + ajax_retour($puce_statut($id, $statut, $id_rubrique, $type, true)); |
|
| 76 | 76 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/minipres'); |
@@ -42,28 +42,28 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | **/ |
| 44 | 44 | function exec_install_dist() { |
| 45 | - $etape = _request('etape'); |
|
| 46 | - $deja = (_FILE_CONNECT and analyse_fichier_connection(_FILE_CONNECT)); |
|
| 45 | + $etape = _request('etape'); |
|
| 46 | + $deja = (_FILE_CONNECT and analyse_fichier_connection(_FILE_CONNECT)); |
|
| 47 | 47 | |
| 48 | - // Si deja installe, on n'a plus le droit qu'a l'etape chmod |
|
| 49 | - // pour chgt post-install ou aux etapes supplementaires |
|
| 50 | - // de declaration de base externes. |
|
| 51 | - // Mais alors il faut authentifier car ecrire/index.php l'a omis |
|
| 48 | + // Si deja installe, on n'a plus le droit qu'a l'etape chmod |
|
| 49 | + // pour chgt post-install ou aux etapes supplementaires |
|
| 50 | + // de declaration de base externes. |
|
| 51 | + // Mais alors il faut authentifier car ecrire/index.php l'a omis |
|
| 52 | 52 | |
| 53 | - if ($deja and in_array($etape, array('chmod', 'sup1', 'sup2'))) { |
|
| 53 | + if ($deja and in_array($etape, array('chmod', 'sup1', 'sup2'))) { |
|
| 54 | 54 | |
| 55 | - $auth = charger_fonction('auth', 'inc'); |
|
| 56 | - if (!$auth()) { |
|
| 57 | - verifier_visiteur(); |
|
| 58 | - $deja = (!autoriser('configurer')); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - if ($deja) { |
|
| 62 | - // Rien a faire ici |
|
| 63 | - echo minipres(); |
|
| 64 | - } else { |
|
| 65 | - include_spip('base/create'); |
|
| 66 | - $fonc = charger_fonction("etape_$etape", 'install'); |
|
| 67 | - $fonc(); |
|
| 68 | - } |
|
| 55 | + $auth = charger_fonction('auth', 'inc'); |
|
| 56 | + if (!$auth()) { |
|
| 57 | + verifier_visiteur(); |
|
| 58 | + $deja = (!autoriser('configurer')); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + if ($deja) { |
|
| 62 | + // Rien a faire ici |
|
| 63 | + echo minipres(); |
|
| 64 | + } else { |
|
| 65 | + include_spip('base/create'); |
|
| 66 | + $fonc = charger_fonction("etape_$etape", 'install'); |
|
| 67 | + $fonc(); |
|
| 68 | + } |
|
| 69 | 69 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -25,25 +25,25 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function exec_404_dist() { |
| 27 | 27 | |
| 28 | - $exec = _request('exec'); |
|
| 28 | + $exec = _request('exec'); |
|
| 29 | 29 | |
| 30 | - $titre = "exec_$exec"; |
|
| 31 | - $navigation = ''; |
|
| 32 | - $extra = ''; |
|
| 30 | + $titre = "exec_$exec"; |
|
| 31 | + $navigation = ''; |
|
| 32 | + $extra = ''; |
|
| 33 | 33 | |
| 34 | - include_spip('inc/presentation'); // alleger les inclusions avec un inc/presentation_mini |
|
| 35 | - $commencer_page = charger_fonction('commencer_page', 'inc'); |
|
| 36 | - echo $commencer_page($titre); |
|
| 34 | + include_spip('inc/presentation'); // alleger les inclusions avec un inc/presentation_mini |
|
| 35 | + $commencer_page = charger_fonction('commencer_page', 'inc'); |
|
| 36 | + echo $commencer_page($titre); |
|
| 37 | 37 | |
| 38 | - echo debut_gauche("404_$exec", true); |
|
| 39 | - echo pipeline('affiche_gauche', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
|
| 38 | + echo debut_gauche("404_$exec", true); |
|
| 39 | + echo pipeline('affiche_gauche', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
|
| 40 | 40 | |
| 41 | - echo creer_colonne_droite('404', true); |
|
| 42 | - echo pipeline('affiche_droite', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
|
| 41 | + echo creer_colonne_droite('404', true); |
|
| 42 | + echo pipeline('affiche_droite', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
|
| 43 | 43 | |
| 44 | - echo debut_droite('404', true); |
|
| 45 | - echo "<h1 class='grostitre'>" . _T('fichier_introuvable', array('fichier' => $exec)) . '</h1>'; |
|
| 46 | - echo pipeline('affiche_milieu', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
|
| 44 | + echo debut_droite('404', true); |
|
| 45 | + echo "<h1 class='grostitre'>" . _T('fichier_introuvable', array('fichier' => $exec)) . '</h1>'; |
|
| 46 | + echo pipeline('affiche_milieu', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
|
| 47 | 47 | |
| 48 | - echo fin_gauche(), fin_page(); |
|
| 48 | + echo fin_gauche(), fin_page(); |
|
| 49 | 49 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | echo pipeline('affiche_droite', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
| 43 | 43 | |
| 44 | 44 | echo debut_droite('404', true); |
| 45 | - echo "<h1 class='grostitre'>" . _T('fichier_introuvable', array('fichier' => $exec)) . '</h1>'; |
|
| 45 | + echo "<h1 class='grostitre'>"._T('fichier_introuvable', array('fichier' => $exec)).'</h1>'; |
|
| 46 | 46 | echo pipeline('affiche_milieu', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
| 47 | 47 | |
| 48 | 48 | echo fin_gauche(), fin_page(); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -27,23 +27,23 @@ discard block |
||
| 27 | 27 | * @uses ajax_retour() |
| 28 | 28 | **/ |
| 29 | 29 | function exec_plonger_dist() { |
| 30 | - include_spip('inc/actions'); |
|
| 30 | + include_spip('inc/actions'); |
|
| 31 | 31 | |
| 32 | - $rac = preg_replace(',[^\w\,/#&;-]+,', ' ', _request('rac')); |
|
| 33 | - $id = intval(_request('id')); |
|
| 34 | - $exclus = intval(_request('exclus')); |
|
| 35 | - $col = intval(_request('col')); |
|
| 36 | - $do = _request('do'); |
|
| 37 | - if (preg_match('/^\w*$/', $do)) { |
|
| 38 | - if (!$do) { |
|
| 39 | - $do = 'aff'; |
|
| 40 | - } |
|
| 32 | + $rac = preg_replace(',[^\w\,/#&;-]+,', ' ', _request('rac')); |
|
| 33 | + $id = intval(_request('id')); |
|
| 34 | + $exclus = intval(_request('exclus')); |
|
| 35 | + $col = intval(_request('col')); |
|
| 36 | + $do = _request('do'); |
|
| 37 | + if (preg_match('/^\w*$/', $do)) { |
|
| 38 | + if (!$do) { |
|
| 39 | + $do = 'aff'; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $plonger = charger_fonction('plonger', 'inc'); |
|
| 43 | - $r = $plonger($id, spip_htmlentities($rac), array(), $col, $exclus, $do); |
|
| 44 | - } else { |
|
| 45 | - $r = ''; |
|
| 46 | - } |
|
| 42 | + $plonger = charger_fonction('plonger', 'inc'); |
|
| 43 | + $r = $plonger($id, spip_htmlentities($rac), array(), $col, $exclus, $do); |
|
| 44 | + } else { |
|
| 45 | + $r = ''; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - ajax_retour($r); |
|
| 48 | + ajax_retour($r); |
|
| 49 | 49 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 10 | - return; |
|
| 10 | + return; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | include_spip('inc/actions'); |
@@ -21,23 +21,23 @@ discard block |
||
| 21 | 21 | * @uses ajax_retour() |
| 22 | 22 | */ |
| 23 | 23 | function exec_info_plugin_dist() { |
| 24 | - if (!autoriser('configurer', '_plugins')) { |
|
| 25 | - include_spip('inc/minipres'); |
|
| 26 | - echo minipres(); |
|
| 27 | - } else { |
|
| 28 | - $plug = _DIR_RACINE . htmlspecialchars(_request('plugin')); |
|
| 29 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 30 | - $dir = ""; |
|
| 31 | - if (strncmp($plug, _DIR_PLUGINS, strlen(_DIR_PLUGINS)) == 0) { |
|
| 32 | - $dir = _DIR_PLUGINS; |
|
| 33 | - } elseif (strncmp($plug, _DIR_PLUGINS_DIST, strlen(_DIR_PLUGINS_DIST)) == 0) { |
|
| 34 | - $dir = _DIR_PLUGINS_DIST; |
|
| 35 | - } |
|
| 36 | - if ($dir) { |
|
| 37 | - $plug = substr($plug, strlen($dir)); |
|
| 38 | - } |
|
| 39 | - $info = $get_infos($plug, false, $dir); |
|
| 40 | - $afficher_plugin = charger_fonction("afficher_plugin", "plugins"); |
|
| 41 | - ajax_retour(affiche_bloc_plugin($plug, $info, $dir)); |
|
| 42 | - } |
|
| 24 | + if (!autoriser('configurer', '_plugins')) { |
|
| 25 | + include_spip('inc/minipres'); |
|
| 26 | + echo minipres(); |
|
| 27 | + } else { |
|
| 28 | + $plug = _DIR_RACINE . htmlspecialchars(_request('plugin')); |
|
| 29 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 30 | + $dir = ""; |
|
| 31 | + if (strncmp($plug, _DIR_PLUGINS, strlen(_DIR_PLUGINS)) == 0) { |
|
| 32 | + $dir = _DIR_PLUGINS; |
|
| 33 | + } elseif (strncmp($plug, _DIR_PLUGINS_DIST, strlen(_DIR_PLUGINS_DIST)) == 0) { |
|
| 34 | + $dir = _DIR_PLUGINS_DIST; |
|
| 35 | + } |
|
| 36 | + if ($dir) { |
|
| 37 | + $plug = substr($plug, strlen($dir)); |
|
| 38 | + } |
|
| 39 | + $info = $get_infos($plug, false, $dir); |
|
| 40 | + $afficher_plugin = charger_fonction("afficher_plugin", "plugins"); |
|
| 41 | + ajax_retour(affiche_bloc_plugin($plug, $info, $dir)); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | include_spip('inc/minipres'); |
| 26 | 26 | echo minipres(); |
| 27 | 27 | } else { |
| 28 | - $plug = _DIR_RACINE . htmlspecialchars(_request('plugin')); |
|
| 28 | + $plug = _DIR_RACINE.htmlspecialchars(_request('plugin')); |
|
| 29 | 29 | $get_infos = charger_fonction('get_infos', 'plugins'); |
| 30 | 30 | $dir = ""; |
| 31 | 31 | if (strncmp($plug, _DIR_PLUGINS, strlen(_DIR_PLUGINS)) == 0) { |