@@ -11,77 +11,77 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | # Les information d'une rubrique selectionnee dans le mini navigateur |
| 18 | 18 | |
| 19 | 19 | function inc_informer_dist($id, $col, $exclus, $rac, $type, $do = 'aff') { |
| 20 | - include_spip('inc/texte'); |
|
| 21 | - $titre = $descriptif = ''; |
|
| 22 | - if ($type === 'rubrique') { |
|
| 23 | - $row = sql_fetsel('titre, descriptif', 'spip_rubriques', 'id_rubrique = ' . intval($id)); |
|
| 24 | - if ($row) { |
|
| 25 | - $titre = typo($row['titre']); |
|
| 26 | - $descriptif = propre($row['descriptif']); |
|
| 27 | - } else { |
|
| 28 | - $titre = _T('info_racine_site'); |
|
| 29 | - } |
|
| 30 | - } |
|
| 20 | + include_spip('inc/texte'); |
|
| 21 | + $titre = $descriptif = ''; |
|
| 22 | + if ($type === 'rubrique') { |
|
| 23 | + $row = sql_fetsel('titre, descriptif', 'spip_rubriques', 'id_rubrique = ' . intval($id)); |
|
| 24 | + if ($row) { |
|
| 25 | + $titre = typo($row['titre']); |
|
| 26 | + $descriptif = propre($row['descriptif']); |
|
| 27 | + } else { |
|
| 28 | + $titre = _T('info_racine_site'); |
|
| 29 | + } |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - $res = ''; |
|
| 33 | - if ( |
|
| 34 | - $type === 'rubrique' |
|
| 35 | - and intval($GLOBALS['visiteur_session']['prefs']['display'] ?? 0) !== 1 |
|
| 36 | - and isset($GLOBALS['meta']['image_process']) |
|
| 37 | - ) { |
|
| 38 | - if ($GLOBALS['meta']['image_process'] !== 'non') { |
|
| 39 | - $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 40 | - if ($res = $chercher_logo($id, 'id_rubrique', 'on')) { |
|
| 41 | - [$fid, $dir, $nom, $format] = $res; |
|
| 42 | - include_spip('inc/filtres_images_mini'); |
|
| 43 | - $res = image_reduire("<img src='$fid' alt='' />", 100, 48); |
|
| 44 | - if ($res) { |
|
| 45 | - $res = "<div class='informer__media' style='float: " . $GLOBALS['spip_lang_right'] . '; margin-' . $GLOBALS['spip_lang_right'] . ": -5px; margin-top: -5px;'>$res</div>"; |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - } |
|
| 49 | - } |
|
| 32 | + $res = ''; |
|
| 33 | + if ( |
|
| 34 | + $type === 'rubrique' |
|
| 35 | + and intval($GLOBALS['visiteur_session']['prefs']['display'] ?? 0) !== 1 |
|
| 36 | + and isset($GLOBALS['meta']['image_process']) |
|
| 37 | + ) { |
|
| 38 | + if ($GLOBALS['meta']['image_process'] !== 'non') { |
|
| 39 | + $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 40 | + if ($res = $chercher_logo($id, 'id_rubrique', 'on')) { |
|
| 41 | + [$fid, $dir, $nom, $format] = $res; |
|
| 42 | + include_spip('inc/filtres_images_mini'); |
|
| 43 | + $res = image_reduire("<img src='$fid' alt='' />", 100, 48); |
|
| 44 | + if ($res) { |
|
| 45 | + $res = "<div class='informer__media' style='float: " . $GLOBALS['spip_lang_right'] . '; margin-' . $GLOBALS['spip_lang_right'] . ": -5px; margin-top: -5px;'>$res</div>"; |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - $rac = spip_htmlentities($rac, ENT_QUOTES); |
|
| 52 | - $do = spip_htmlentities($do, ENT_QUOTES); |
|
| 53 | - $id = intval($id); |
|
| 51 | + $rac = spip_htmlentities($rac, ENT_QUOTES); |
|
| 52 | + $do = spip_htmlentities($do, ENT_QUOTES); |
|
| 53 | + $id = intval($id); |
|
| 54 | 54 | |
| 55 | 55 | # ce lien provoque la selection (directe) de la rubrique cliquee |
| 56 | 56 | # et l'affichage de son titre dans le bandeau |
| 57 | - $titre = strtr( |
|
| 58 | - str_replace( |
|
| 59 | - "'", |
|
| 60 | - '’', |
|
| 61 | - str_replace('"', '"', textebrut($titre)) |
|
| 62 | - ), |
|
| 63 | - "\n\r", |
|
| 64 | - ' ' |
|
| 65 | - ); |
|
| 57 | + $titre = strtr( |
|
| 58 | + str_replace( |
|
| 59 | + "'", |
|
| 60 | + '’', |
|
| 61 | + str_replace('"', '"', textebrut($titre)) |
|
| 62 | + ), |
|
| 63 | + "\n\r", |
|
| 64 | + ' ' |
|
| 65 | + ); |
|
| 66 | 66 | |
| 67 | - $js_func = $do . '_selection_titre'; |
|
| 67 | + $js_func = $do . '_selection_titre'; |
|
| 68 | 68 | |
| 69 | - return "<div style='display: none;'>" |
|
| 70 | - . "<input type='text' id='" . $rac . "_sel' value='$id' />" |
|
| 71 | - . "<input type='text' id='" . $rac . "_sel2' value=\"" |
|
| 72 | - . entites_html($titre) |
|
| 73 | - . '" />' |
|
| 74 | - . '</div>' |
|
| 75 | - . "<div class='informer' style='padding: 5px; border-top: 0px;'>" |
|
| 76 | - . '<div class="informer__item">' |
|
| 77 | - . (!$res ? '' : $res) |
|
| 78 | - . "<p class='informer__titre'><b>" . safehtml($titre) . '</b></p>' |
|
| 79 | - . (!$descriptif ? '' : "<div class='informer__descriptif'>" . safehtml($descriptif) . '</div>') |
|
| 80 | - . '</div>' |
|
| 81 | - . "<div class='informer__action' style='clear:both; text-align: " . $GLOBALS['spip_lang_right'] . ";'>" |
|
| 82 | - . "<input type='submit' class='fondo btn submit' value='" |
|
| 83 | - . _T('bouton_choisir') |
|
| 84 | - . "'\nonclick=\"$js_func('$titre',$id,'selection_rubrique','id_parent'); return false;\" />" |
|
| 85 | - . '</div>' |
|
| 86 | - . '</div>'; |
|
| 69 | + return "<div style='display: none;'>" |
|
| 70 | + . "<input type='text' id='" . $rac . "_sel' value='$id' />" |
|
| 71 | + . "<input type='text' id='" . $rac . "_sel2' value=\"" |
|
| 72 | + . entites_html($titre) |
|
| 73 | + . '" />' |
|
| 74 | + . '</div>' |
|
| 75 | + . "<div class='informer' style='padding: 5px; border-top: 0px;'>" |
|
| 76 | + . '<div class="informer__item">' |
|
| 77 | + . (!$res ? '' : $res) |
|
| 78 | + . "<p class='informer__titre'><b>" . safehtml($titre) . '</b></p>' |
|
| 79 | + . (!$descriptif ? '' : "<div class='informer__descriptif'>" . safehtml($descriptif) . '</div>') |
|
| 80 | + . '</div>' |
|
| 81 | + . "<div class='informer__action' style='clear:both; text-align: " . $GLOBALS['spip_lang_right'] . ";'>" |
|
| 82 | + . "<input type='submit' class='fondo btn submit' value='" |
|
| 83 | + . _T('bouton_choisir') |
|
| 84 | + . "'\nonclick=\"$js_func('$titre',$id,'selection_rubrique','id_parent'); return false;\" />" |
|
| 85 | + . '</div>' |
|
| 86 | + . '</div>'; |
|
| 87 | 87 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | include_spip('inc/texte'); |
| 21 | 21 | $titre = $descriptif = ''; |
| 22 | 22 | if ($type === 'rubrique') { |
| 23 | - $row = sql_fetsel('titre, descriptif', 'spip_rubriques', 'id_rubrique = ' . intval($id)); |
|
| 23 | + $row = sql_fetsel('titre, descriptif', 'spip_rubriques', 'id_rubrique = '.intval($id)); |
|
| 24 | 24 | if ($row) { |
| 25 | 25 | $titre = typo($row['titre']); |
| 26 | 26 | $descriptif = propre($row['descriptif']); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | include_spip('inc/filtres_images_mini'); |
| 43 | 43 | $res = image_reduire("<img src='$fid' alt='' />", 100, 48); |
| 44 | 44 | if ($res) { |
| 45 | - $res = "<div class='informer__media' style='float: " . $GLOBALS['spip_lang_right'] . '; margin-' . $GLOBALS['spip_lang_right'] . ": -5px; margin-top: -5px;'>$res</div>"; |
|
| 45 | + $res = "<div class='informer__media' style='float: ".$GLOBALS['spip_lang_right'].'; margin-'.$GLOBALS['spip_lang_right'].": -5px; margin-top: -5px;'>$res</div>"; |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -64,21 +64,21 @@ discard block |
||
| 64 | 64 | ' ' |
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | - $js_func = $do . '_selection_titre'; |
|
| 67 | + $js_func = $do.'_selection_titre'; |
|
| 68 | 68 | |
| 69 | 69 | return "<div style='display: none;'>" |
| 70 | - . "<input type='text' id='" . $rac . "_sel' value='$id' />" |
|
| 71 | - . "<input type='text' id='" . $rac . "_sel2' value=\"" |
|
| 70 | + . "<input type='text' id='".$rac."_sel' value='$id' />" |
|
| 71 | + . "<input type='text' id='".$rac."_sel2' value=\"" |
|
| 72 | 72 | . entites_html($titre) |
| 73 | 73 | . '" />' |
| 74 | 74 | . '</div>' |
| 75 | 75 | . "<div class='informer' style='padding: 5px; border-top: 0px;'>" |
| 76 | 76 | . '<div class="informer__item">' |
| 77 | 77 | . (!$res ? '' : $res) |
| 78 | - . "<p class='informer__titre'><b>" . safehtml($titre) . '</b></p>' |
|
| 79 | - . (!$descriptif ? '' : "<div class='informer__descriptif'>" . safehtml($descriptif) . '</div>') |
|
| 78 | + . "<p class='informer__titre'><b>".safehtml($titre).'</b></p>' |
|
| 79 | + . (!$descriptif ? '' : "<div class='informer__descriptif'>".safehtml($descriptif).'</div>') |
|
| 80 | 80 | . '</div>' |
| 81 | - . "<div class='informer__action' style='clear:both; text-align: " . $GLOBALS['spip_lang_right'] . ";'>" |
|
| 81 | + . "<div class='informer__action' style='clear:both; text-align: ".$GLOBALS['spip_lang_right'].";'>" |
|
| 82 | 82 | . "<input type='submit' class='fondo btn submit' value='" |
| 83 | 83 | . _T('bouton_choisir') |
| 84 | 84 | . "'\nonclick=\"$js_func('$titre',$id,'selection_rubrique','id_parent'); return false;\" />" |
@@ -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 | /** |
@@ -43,25 +43,25 @@ discard block |
||
| 43 | 43 | * @return string Code HTML |
| 44 | 44 | **/ |
| 45 | 45 | function inc_commencer_page_dist( |
| 46 | - $titre = '', |
|
| 47 | - $rubrique = 'accueil', |
|
| 48 | - $sous_rubrique = 'accueil', |
|
| 49 | - $id_rubrique = '', |
|
| 50 | - $menu = true, |
|
| 51 | - $minipres = false, |
|
| 52 | - $alertes = true |
|
| 46 | + $titre = '', |
|
| 47 | + $rubrique = 'accueil', |
|
| 48 | + $sous_rubrique = 'accueil', |
|
| 49 | + $id_rubrique = '', |
|
| 50 | + $menu = true, |
|
| 51 | + $minipres = false, |
|
| 52 | + $alertes = true |
|
| 53 | 53 | ) { |
| 54 | 54 | |
| 55 | - include_spip('inc/headers'); |
|
| 55 | + include_spip('inc/headers'); |
|
| 56 | 56 | |
| 57 | - http_no_cache(); |
|
| 57 | + http_no_cache(); |
|
| 58 | 58 | |
| 59 | - return init_entete($titre, $id_rubrique, $minipres) |
|
| 60 | - . init_body($rubrique, $sous_rubrique, $id_rubrique, $menu) |
|
| 61 | - . "<div id='page'>" |
|
| 62 | - . auteurs_recemment_connectes($GLOBALS['connect_id_auteur']) |
|
| 63 | - . ($alertes ? alertes_auteur($GLOBALS['connect_id_auteur']) : '') |
|
| 64 | - . '<div class="largeur">'; |
|
| 59 | + return init_entete($titre, $id_rubrique, $minipres) |
|
| 60 | + . init_body($rubrique, $sous_rubrique, $id_rubrique, $menu) |
|
| 61 | + . "<div id='page'>" |
|
| 62 | + . auteurs_recemment_connectes($GLOBALS['connect_id_auteur']) |
|
| 63 | + . ($alertes ? alertes_auteur($GLOBALS['connect_id_auteur']) : '') |
|
| 64 | + . '<div class="largeur">'; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -82,21 +82,21 @@ discard block |
||
| 82 | 82 | * Entête du fichier HTML avec le DOCTYPE |
| 83 | 83 | */ |
| 84 | 84 | function init_entete($titre = '', $dummy = 0, $minipres = false) { |
| 85 | - include_spip('inc/texte'); |
|
| 86 | - if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']['nom_site']))) { |
|
| 87 | - $nom_site_spip = _T('info_mon_site_spip'); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - $titre = '[' |
|
| 91 | - . $nom_site_spip |
|
| 92 | - . ']' |
|
| 93 | - . ($titre ? ' ' . textebrut(typo($titre)) : ''); |
|
| 94 | - |
|
| 95 | - return _DOCTYPE_ECRIRE |
|
| 96 | - . html_lang_attributes() |
|
| 97 | - . "<head>\n" |
|
| 98 | - . init_head($titre, $dummy, $minipres) |
|
| 99 | - . "</head>\n"; |
|
| 85 | + include_spip('inc/texte'); |
|
| 86 | + if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']['nom_site']))) { |
|
| 87 | + $nom_site_spip = _T('info_mon_site_spip'); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + $titre = '[' |
|
| 91 | + . $nom_site_spip |
|
| 92 | + . ']' |
|
| 93 | + . ($titre ? ' ' . textebrut(typo($titre)) : ''); |
|
| 94 | + |
|
| 95 | + return _DOCTYPE_ECRIRE |
|
| 96 | + . html_lang_attributes() |
|
| 97 | + . "<head>\n" |
|
| 98 | + . init_head($titre, $dummy, $minipres) |
|
| 99 | + . "</head>\n"; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @return string |
| 111 | 111 | */ |
| 112 | 112 | function init_head($titre = '', $dummy = 0, $minipres = false) { |
| 113 | - return recuperer_fond('prive/squelettes/head/dist', ['titre' => $titre, 'minipres' => $minipres ? ' ' : '']); |
|
| 113 | + return recuperer_fond('prive/squelettes/head/dist', ['titre' => $titre, 'minipres' => $minipres ? ' ' : '']); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -132,20 +132,20 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | function init_body($rubrique = 'accueil', $sous_rubrique = 'accueil', $id_rubrique = '', $menu = true) { |
| 134 | 134 | |
| 135 | - $res = pipeline('body_prive', "<body class='" |
|
| 136 | - . init_body_class() . ' ' . _request('exec') . "'" |
|
| 137 | - . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '') |
|
| 138 | - . '>'); |
|
| 135 | + $res = pipeline('body_prive', "<body class='" |
|
| 136 | + . init_body_class() . ' ' . _request('exec') . "'" |
|
| 137 | + . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '') |
|
| 138 | + . '>'); |
|
| 139 | 139 | |
| 140 | - if (!$menu) { |
|
| 141 | - return $res; |
|
| 142 | - } |
|
| 140 | + if (!$menu) { |
|
| 141 | + return $res; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | 144 | |
| 145 | - $bandeau = charger_fonction('bandeau', 'inc'); |
|
| 145 | + $bandeau = charger_fonction('bandeau', 'inc'); |
|
| 146 | 146 | |
| 147 | - return $res |
|
| 148 | - . $bandeau(); |
|
| 147 | + return $res |
|
| 148 | + . $bandeau(); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -157,23 +157,23 @@ discard block |
||
| 157 | 157 | * @return string Classes CSS (séparées par des espaces) |
| 158 | 158 | */ |
| 159 | 159 | function init_body_class() { |
| 160 | - $display_modes = [ |
|
| 161 | - 0 => 'icones_img_texte' // défaut. |
|
| 162 | - /*init*/, |
|
| 163 | - 1 => 'icones_texte', |
|
| 164 | - 2 => 'icones_img_texte', |
|
| 165 | - 3 => 'icones_img' |
|
| 166 | - ]; |
|
| 160 | + $display_modes = [ |
|
| 161 | + 0 => 'icones_img_texte' // défaut. |
|
| 162 | + /*init*/, |
|
| 163 | + 1 => 'icones_texte', |
|
| 164 | + 2 => 'icones_img_texte', |
|
| 165 | + 3 => 'icones_img' |
|
| 166 | + ]; |
|
| 167 | 167 | |
| 168 | - $prefs = $GLOBALS['visiteur_session']['prefs'] ?? []; |
|
| 168 | + $prefs = $GLOBALS['visiteur_session']['prefs'] ?? []; |
|
| 169 | 169 | |
| 170 | - $display_mode = $display_modes[intval($prefs['display'] ?? 0)] ?? $display_modes[0]; |
|
| 171 | - $spip_display_navigation = isset($prefs['display_navigation']) ? spip_sanitize_classname($prefs['display_navigation']) : 'navigation_avec_icones'; |
|
| 170 | + $display_mode = $display_modes[intval($prefs['display'] ?? 0)] ?? $display_modes[0]; |
|
| 171 | + $spip_display_navigation = isset($prefs['display_navigation']) ? spip_sanitize_classname($prefs['display_navigation']) : 'navigation_avec_icones'; |
|
| 172 | 172 | |
| 173 | - $couleur = intval($prefs['couleur'] ?? 2); |
|
| 173 | + $couleur = intval($prefs['couleur'] ?? 2); |
|
| 174 | 174 | |
| 175 | - $classes = "spip-theme-colors-$couleur $spip_display_navigation $display_mode"; |
|
| 176 | - return spip_sanitize_classname($classes); |
|
| 175 | + $classes = "spip-theme-colors-$couleur $spip_display_navigation $display_mode"; |
|
| 176 | + return spip_sanitize_classname($classes); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | |
@@ -184,5 +184,5 @@ discard block |
||
| 184 | 184 | * @return string |
| 185 | 185 | */ |
| 186 | 186 | function auteurs_recemment_connectes($id_auteur) { |
| 187 | - return recuperer_fond('prive/objets/liste/auteurs_enligne'); |
|
| 187 | + return recuperer_fond('prive/objets/liste/auteurs_enligne'); |
|
| 188 | 188 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $titre = '[' |
| 91 | 91 | . $nom_site_spip |
| 92 | 92 | . ']' |
| 93 | - . ($titre ? ' ' . textebrut(typo($titre)) : ''); |
|
| 93 | + . ($titre ? ' '.textebrut(typo($titre)) : ''); |
|
| 94 | 94 | |
| 95 | 95 | return _DOCTYPE_ECRIRE |
| 96 | 96 | . html_lang_attributes() |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | function init_body($rubrique = 'accueil', $sous_rubrique = 'accueil', $id_rubrique = '', $menu = true) { |
| 134 | 134 | |
| 135 | 135 | $res = pipeline('body_prive', "<body class='" |
| 136 | - . init_body_class() . ' ' . _request('exec') . "'" |
|
| 136 | + . init_body_class().' '._request('exec')."'" |
|
| 137 | 137 | . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '') |
| 138 | 138 | . '>'); |
| 139 | 139 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | /** Drapeau indiquant que l'on est dans l'espace privé */ |
| 20 | 20 | define('_ESPACE_PRIVE', true); |
| 21 | 21 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 22 | - include 'inc_version.php'; |
|
| 22 | + include 'inc_version.php'; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | include_spip('inc/cookie'); |
@@ -35,18 +35,18 @@ discard block |
||
| 35 | 35 | // alors il faut blinder les variables d'URL |
| 36 | 36 | // |
| 37 | 37 | if (autoriser_sans_cookie($exec, false)) { |
| 38 | - if (!isset($reinstall)) { |
|
| 39 | - $reinstall = 'non'; |
|
| 40 | - } |
|
| 41 | - $var_auth = true; |
|
| 38 | + if (!isset($reinstall)) { |
|
| 39 | + $reinstall = 'non'; |
|
| 40 | + } |
|
| 41 | + $var_auth = true; |
|
| 42 | 42 | } else { |
| 43 | - // Authentification, redefinissable |
|
| 44 | - $auth = charger_fonction('auth', 'inc'); |
|
| 45 | - $var_auth = $auth(); |
|
| 46 | - if ($var_auth) { |
|
| 47 | - echo auth_echec($var_auth); |
|
| 48 | - exit; |
|
| 49 | - } |
|
| 43 | + // Authentification, redefinissable |
|
| 44 | + $auth = charger_fonction('auth', 'inc'); |
|
| 45 | + $var_auth = $auth(); |
|
| 46 | + if ($var_auth) { |
|
| 47 | + echo auth_echec($var_auth); |
|
| 48 | + exit; |
|
| 49 | + } |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // initialiser a la langue par defaut |
@@ -57,29 +57,29 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | if (_request('action') or _request('var_ajax') or _request('formulaire_action')) { |
| 60 | - if (!autoriser_sans_cookie($exec)) { |
|
| 61 | - // Charger l'aiguilleur qui va mettre sur la bonne voie les traitements derogatoires |
|
| 62 | - include_spip('public/aiguiller'); |
|
| 63 | - if ( |
|
| 64 | - // cas des appels actions ?action=xxx |
|
| 65 | - traiter_appels_actions() |
|
| 66 | - or |
|
| 67 | - // cas des hits ajax sur les inclusions ajax |
|
| 68 | - traiter_appels_inclusions_ajax() |
|
| 69 | - or |
|
| 70 | - // cas des formulaires charger/verifier/traiter |
|
| 71 | - traiter_formulaires_dynamiques() |
|
| 72 | - ) { |
|
| 73 | - exit; |
|
| 74 | - } // le hit est fini ! |
|
| 75 | - } |
|
| 60 | + if (!autoriser_sans_cookie($exec)) { |
|
| 61 | + // Charger l'aiguilleur qui va mettre sur la bonne voie les traitements derogatoires |
|
| 62 | + include_spip('public/aiguiller'); |
|
| 63 | + if ( |
|
| 64 | + // cas des appels actions ?action=xxx |
|
| 65 | + traiter_appels_actions() |
|
| 66 | + or |
|
| 67 | + // cas des hits ajax sur les inclusions ajax |
|
| 68 | + traiter_appels_inclusions_ajax() |
|
| 69 | + or |
|
| 70 | + // cas des formulaires charger/verifier/traiter |
|
| 71 | + traiter_formulaires_dynamiques() |
|
| 72 | + ) { |
|
| 73 | + exit; |
|
| 74 | + } // le hit est fini ! |
|
| 75 | + } |
|
| 76 | 76 | } |
| 77 | 77 | // securiser les redirect du back-office |
| 78 | 78 | if (_request('redirect')) { |
| 79 | - if (!function_exists('securiser_redirect_action')) { |
|
| 80 | - include_spip('public/aiguiller'); |
|
| 81 | - } |
|
| 82 | - set_request('redirect', securiser_redirect_action(_request('redirect'))); |
|
| 79 | + if (!function_exists('securiser_redirect_action')) { |
|
| 80 | + include_spip('public/aiguiller'); |
|
| 81 | + } |
|
| 82 | + set_request('redirect', securiser_redirect_action(_request('redirect'))); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // Controle de la version, sauf si on est deja en train de s'en occuper |
| 91 | 91 | if ( |
| 92 | - !$reinstall == 'oui' |
|
| 93 | - and !_AJAX |
|
| 94 | - and isset($GLOBALS['meta']['version_installee']) |
|
| 95 | - and ($GLOBALS['spip_version_base'] != (str_replace(',', '.', $GLOBALS['meta']['version_installee']))) |
|
| 92 | + !$reinstall == 'oui' |
|
| 93 | + and !_AJAX |
|
| 94 | + and isset($GLOBALS['meta']['version_installee']) |
|
| 95 | + and ($GLOBALS['spip_version_base'] != (str_replace(',', '.', $GLOBALS['meta']['version_installee']))) |
|
| 96 | 96 | ) { |
| 97 | - $exec = 'demande_mise_a_jour'; |
|
| 97 | + $exec = 'demande_mise_a_jour'; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Quand une action d'administration est en cours (meta "admin"), |
@@ -104,39 +104,39 @@ discard block |
||
| 104 | 104 | // sinon c'est qu'elle a ete interrompue et il faut la reprendre |
| 105 | 105 | |
| 106 | 106 | elseif (isset($GLOBALS['meta']['admin'])) { |
| 107 | - if (preg_match('/^(.*)_(\d+)_/', $GLOBALS['meta']['admin'], $l)) { |
|
| 108 | - [, $var_f, $n] = $l; |
|
| 109 | - } |
|
| 110 | - if ( |
|
| 111 | - _AJAX |
|
| 112 | - or !( |
|
| 113 | - isset($_COOKIE['spip_admin']) |
|
| 114 | - or (isset($GLOBALS['visiteur_session']) and $GLOBALS['visiteur_session']['statut'] == '0minirezo') |
|
| 115 | - ) |
|
| 116 | - ) { |
|
| 117 | - spip_log('Quand la meta admin vaut ' . |
|
| 118 | - $GLOBALS['meta']['admin'] . |
|
| 119 | - ' seul un admin peut se connecter et sans AJAX.' . |
|
| 120 | - ' En cas de probleme, detruire cette meta.'); |
|
| 121 | - die(_T('info_travaux_texte')); |
|
| 122 | - } |
|
| 123 | - if ($n) { |
|
| 124 | - [, $var_f, $n] = $l; |
|
| 125 | - if (tester_url_ecrire("base_$var_f")) { |
|
| 126 | - $var_f = "base_$var_f"; |
|
| 127 | - } |
|
| 128 | - if ($var_f != $exec) { |
|
| 129 | - spip_log("Le script $var_f lance par auteur$n se substitue a l'exec $exec"); |
|
| 130 | - $exec = $var_f; |
|
| 131 | - set_request('exec', $exec); |
|
| 132 | - } |
|
| 133 | - } |
|
| 107 | + if (preg_match('/^(.*)_(\d+)_/', $GLOBALS['meta']['admin'], $l)) { |
|
| 108 | + [, $var_f, $n] = $l; |
|
| 109 | + } |
|
| 110 | + if ( |
|
| 111 | + _AJAX |
|
| 112 | + or !( |
|
| 113 | + isset($_COOKIE['spip_admin']) |
|
| 114 | + or (isset($GLOBALS['visiteur_session']) and $GLOBALS['visiteur_session']['statut'] == '0minirezo') |
|
| 115 | + ) |
|
| 116 | + ) { |
|
| 117 | + spip_log('Quand la meta admin vaut ' . |
|
| 118 | + $GLOBALS['meta']['admin'] . |
|
| 119 | + ' seul un admin peut se connecter et sans AJAX.' . |
|
| 120 | + ' En cas de probleme, detruire cette meta.'); |
|
| 121 | + die(_T('info_travaux_texte')); |
|
| 122 | + } |
|
| 123 | + if ($n) { |
|
| 124 | + [, $var_f, $n] = $l; |
|
| 125 | + if (tester_url_ecrire("base_$var_f")) { |
|
| 126 | + $var_f = "base_$var_f"; |
|
| 127 | + } |
|
| 128 | + if ($var_f != $exec) { |
|
| 129 | + spip_log("Le script $var_f lance par auteur$n se substitue a l'exec $exec"); |
|
| 130 | + $exec = $var_f; |
|
| 131 | + set_request('exec', $exec); |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | 134 | } |
| 135 | 135 | // si nom pas plausible, prendre le script par defaut |
| 136 | 136 | // attention aux deux cas 404/403 qui commencent par un 4 ! |
| 137 | 137 | elseif (!preg_match(',^[a-z4_][0-9a-z_-]*$,i', $exec)) { |
| 138 | - $exec = 'accueil'; |
|
| 139 | - set_request('exec', $exec); |
|
| 138 | + $exec = 'accueil'; |
|
| 139 | + set_request('exec', $exec); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // si la langue est specifiee par cookie et ne correspond pas |
@@ -144,19 +144,19 @@ discard block |
||
| 144 | 144 | // on appelle directement la fonction, car un appel d'action peut conduire a une boucle infinie |
| 145 | 145 | // si le cookie n'est pas pose correctement dans l'action |
| 146 | 146 | if ( |
| 147 | - !$var_auth and isset($_COOKIE['spip_lang_ecrire']) |
|
| 148 | - and $_COOKIE['spip_lang_ecrire'] <> $GLOBALS['visiteur_session']['lang'] |
|
| 147 | + !$var_auth and isset($_COOKIE['spip_lang_ecrire']) |
|
| 148 | + and $_COOKIE['spip_lang_ecrire'] <> $GLOBALS['visiteur_session']['lang'] |
|
| 149 | 149 | ) { |
| 150 | - include_spip('action/converser'); |
|
| 151 | - action_converser_post($GLOBALS['visiteur_session']['lang'], true); |
|
| 150 | + include_spip('action/converser'); |
|
| 151 | + action_converser_post($GLOBALS['visiteur_session']['lang'], true); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if ($var_f = tester_url_ecrire($exec)) { |
| 155 | - $var_f = charger_fonction($var_f); |
|
| 156 | - $var_f(); // at last |
|
| 155 | + $var_f = charger_fonction($var_f); |
|
| 156 | + $var_f(); // at last |
|
| 157 | 157 | } else { |
| 158 | - // Rien de connu: rerouter vers exec=404 au lieu d'echouer |
|
| 159 | - // ce qui permet de laisser la main a un plugin |
|
| 160 | - $var_f = charger_fonction('404'); |
|
| 161 | - $var_f($exec); |
|
| 158 | + // Rien de connu: rerouter vers exec=404 au lieu d'echouer |
|
| 159 | + // ce qui permet de laisser la main a un plugin |
|
| 160 | + $var_f = charger_fonction('404'); |
|
| 161 | + $var_f($exec); |
|
| 162 | 162 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * Ce programme est un logiciel libre distribué sous licence GNU/GPL. * |
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 12 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * Fichier d'exécution de l'interface privée |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | // Determiner l'action demandee |
| 30 | 30 | // |
| 31 | 31 | |
| 32 | -$exec = (string)_request('exec'); |
|
| 32 | +$exec = (string) _request('exec'); |
|
| 33 | 33 | $reinstall = (!is_null(_request('reinstall'))) ? _request('reinstall') : ($exec == 'install' ? 'oui' : null); |
| 34 | 34 | // |
| 35 | 35 | // Les scripts d'insallation n'authentifient pas, forcement, |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | or (isset($GLOBALS['visiteur_session']) and $GLOBALS['visiteur_session']['statut'] == '0minirezo') |
| 116 | 116 | ) |
| 117 | 117 | ) { |
| 118 | - spip_log('Quand la meta admin vaut ' . |
|
| 119 | - $GLOBALS['meta']['admin'] . |
|
| 120 | - ' seul un admin peut se connecter et sans AJAX.' . |
|
| 118 | + spip_log('Quand la meta admin vaut '. |
|
| 119 | + $GLOBALS['meta']['admin']. |
|
| 120 | + ' seul un admin peut se connecter et sans AJAX.'. |
|
| 121 | 121 | ' En cas de probleme, detruire cette meta.'); |
| 122 | 122 | die(_T('info_travaux_texte')); |
| 123 | 123 | } |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | function objet_modifier($objet, $id, $set = null) { |
| 78 | 78 | if (($t = objet_type($objet)) !== $objet) { |
| 79 | - spip_log("objet_modifier: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 79 | + spip_log("objet_modifier: appel avec type $objet invalide au lieu de $t", 'editer'._LOG_INFO_IMPORTANTE); |
|
| 80 | 80 | $objet = $t; |
| 81 | 81 | } |
| 82 | 82 | if ( |
| 83 | - include_spip('action/editer_' . $objet) |
|
| 84 | - and function_exists($modifier = $objet . '_modifier') |
|
| 83 | + include_spip('action/editer_'.$objet) |
|
| 84 | + and function_exists($modifier = $objet.'_modifier') |
|
| 85 | 85 | ) { |
| 86 | 86 | return $modifier($id, $set); |
| 87 | 87 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $trouver_table = charger_fonction('trouver_table', 'base'); |
| 91 | 91 | $desc = $trouver_table($table_sql); |
| 92 | 92 | if (!$desc or !isset($desc['field'])) { |
| 93 | - spip_log("Objet $objet inconnu dans objet_modifier", 'editer' . _LOG_ERREUR); |
|
| 93 | + spip_log("Objet $objet inconnu dans objet_modifier", 'editer'._LOG_ERREUR); |
|
| 94 | 94 | |
| 95 | 95 | return _L("Erreur objet $objet inconnu"); |
| 96 | 96 | } |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | function objet_inserer($objet, $id_parent = null, $set = null) { |
| 171 | 171 | $d = null; |
| 172 | 172 | if (($t = objet_type($objet)) !== $objet) { |
| 173 | - spip_log("objet_inserer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 173 | + spip_log("objet_inserer: appel avec type $objet invalide au lieu de $t", 'editer'._LOG_INFO_IMPORTANTE); |
|
| 174 | 174 | $objet = $t; |
| 175 | 175 | } |
| 176 | 176 | if ( |
| 177 | - include_spip('action/editer_' . $objet) |
|
| 178 | - and function_exists($inserer = $objet . '_inserer') |
|
| 177 | + include_spip('action/editer_'.$objet) |
|
| 178 | + and function_exists($inserer = $objet.'_inserer') |
|
| 179 | 179 | ) { |
| 180 | 180 | return $inserer($id_parent, $set); |
| 181 | 181 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $row = sql_fetsel('id_rubrique, id_secteur, lang', 'spip_rubriques', 'id_parent=0', '', '0+titre,titre', '1'); |
| 197 | 197 | $id_rubrique = $row['id_rubrique']; |
| 198 | 198 | } else { |
| 199 | - $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 199 | + $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique)); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | $champs['id_rubrique'] = $id_rubrique; |
@@ -314,12 +314,12 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | function objet_instituer($objet, $id, $c, $calcul_rub = true) { |
| 316 | 316 | if (($t = objet_type($objet)) !== $objet) { |
| 317 | - spip_log("objet_instituer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 317 | + spip_log("objet_instituer: appel avec type $objet invalide au lieu de $t", 'editer'._LOG_INFO_IMPORTANTE); |
|
| 318 | 318 | $objet = $t; |
| 319 | 319 | } |
| 320 | 320 | if ( |
| 321 | - include_spip('action/editer_' . $objet) |
|
| 322 | - and function_exists($instituer = $objet . '_instituer') |
|
| 321 | + include_spip('action/editer_'.$objet) |
|
| 322 | + and function_exists($instituer = $objet.'_instituer') |
|
| 323 | 323 | ) { |
| 324 | 324 | return $instituer($id, $c, $calcul_rub); |
| 325 | 325 | } |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $sel[] = ($champ_date ? "$champ_date as date" : "'' as date"); |
| 349 | 349 | $sel[] = (isset($desc['field']['id_rubrique']) ? 'id_rubrique' : '0 as id_rubrique'); |
| 350 | 350 | |
| 351 | - $row = sql_fetsel($sel, $table_sql, id_table_objet($objet) . '=' . intval($id)); |
|
| 351 | + $row = sql_fetsel($sel, $table_sql, id_table_objet($objet).'='.intval($id)); |
|
| 352 | 352 | |
| 353 | 353 | $id_rubrique = $row['id_rubrique']; |
| 354 | 354 | $statut_ancien = $statut = $row['statut']; |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | if ($s != 'publie' and autoriser('modifier', $objet, $id)) { |
| 372 | 372 | $statut = $champs['statut'] = $s; |
| 373 | 373 | } else { |
| 374 | - spip_log("editer_objet $objet #$id refus " . json_encode($c, JSON_THROW_ON_ERROR), 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 374 | + spip_log("editer_objet $objet #$id refus ".json_encode($c, JSON_THROW_ON_ERROR), 'editer'._LOG_INFO_IMPORTANTE); |
|
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | and isset($c['id_parent']) |
| 402 | 402 | and $id_parent = $c['id_parent'] |
| 403 | 403 | and $id_parent != $id_rubrique |
| 404 | - and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent))) |
|
| 404 | + and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique='.intval($id_parent))) |
|
| 405 | 405 | ) { |
| 406 | 406 | $champs['id_rubrique'] = $id_parent; |
| 407 | 407 | |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | // Si on deplace l'objet |
| 501 | 501 | // changer aussi son secteur et sa langue (si heritee) |
| 502 | 502 | if (isset($champs['id_rubrique'])) { |
| 503 | - $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique'])); |
|
| 503 | + $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique='.sql_quote($champs['id_rubrique'])); |
|
| 504 | 504 | $langue = $row_rub['lang']; |
| 505 | 505 | |
| 506 | 506 | if (isset($desc['field']['id_secteur'])) { |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | sql_fetsel( |
| 513 | 513 | '1', |
| 514 | 514 | $table_sql, |
| 515 | - id_table_objet($objet) . '=' . intval($id) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue) |
|
| 515 | + id_table_objet($objet).'='.intval($id)." AND langue_choisie<>'oui' AND lang<>".sql_quote($langue) |
|
| 516 | 516 | ) |
| 517 | 517 | ) { |
| 518 | 518 | $champs['lang'] = $langue; |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | if (!$champs) { |
| 524 | 524 | return; |
| 525 | 525 | } |
| 526 | - sql_updateq($table_sql, $champs, id_table_objet($objet) . '=' . intval($id)); |
|
| 526 | + sql_updateq($table_sql, $champs, id_table_objet($objet).'='.intval($id)); |
|
| 527 | 527 | |
| 528 | 528 | // Changer le statut des rubriques concernees |
| 529 | 529 | if ($cond) { |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | */ |
| 568 | 568 | function objet_lire($objet, $valeur_id, $options = []) { |
| 569 | 569 | if (($t = objet_type($objet)) !== $objet) { |
| 570 | - spip_log("objet_lire: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 570 | + spip_log("objet_lire: appel avec type $objet invalide au lieu de $t", 'editer'._LOG_INFO_IMPORTANTE); |
|
| 571 | 571 | $objet = $t; |
| 572 | 572 | } |
| 573 | 573 | |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | ) { |
| 590 | 590 | // Il est possible pour un type d'objet de fournir une fonction de lecture de tous les champs d'un objet. |
| 591 | 591 | if ( |
| 592 | - include_spip('action/editer_' . $objet) |
|
| 592 | + include_spip('action/editer_'.$objet) |
|
| 593 | 593 | and function_exists($lire = "{$objet}_lire_champs") |
| 594 | 594 | ) { |
| 595 | 595 | $valeurs = $lire($objet, $valeur_id, $champ_id); |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | |
| 600 | 600 | // La condition est appliquée sur le champ désigné par l'utilisateur. |
| 601 | 601 | $where = [ |
| 602 | - $champ_id . '=' . sql_quote($valeur_id) |
|
| 602 | + $champ_id.'='.sql_quote($valeur_id) |
|
| 603 | 603 | ]; |
| 604 | 604 | |
| 605 | 605 | // Acquisition de tous les champs de l'objet : si l'accès SQL retourne une erreur on renvoie un tableau vide. |
@@ -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 | /** |
@@ -33,36 +33,36 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | function action_editer_objet_dist($id = null, $objet = null, $set = null) { |
| 35 | 35 | |
| 36 | - // appel direct depuis une url avec arg = "objet/id" |
|
| 37 | - if (is_null($id) or is_null($objet)) { |
|
| 38 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 39 | - $arg = $securiser_action(); |
|
| 40 | - [$objet, $id] = array_pad(explode('/', $arg, 2), 2, null); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - // appel incorrect ou depuis une url erronnée interdit |
|
| 44 | - if (is_null($id) or is_null($objet)) { |
|
| 45 | - include_spip('inc/minipres'); |
|
| 46 | - echo minipres(_T('info_acces_interdit')); |
|
| 47 | - die(); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - // si id n'est pas un nombre, c'est une creation |
|
| 51 | - // mais on verifie qu'on a toutes les donnees qu'il faut. |
|
| 52 | - if (!$id = intval($id)) { |
|
| 53 | - // on ne sait pas si un parent existe mais on essaye |
|
| 54 | - $id_parent = _request('id_parent'); |
|
| 55 | - $id = objet_inserer($objet, $id_parent); |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - if (!($id = intval($id)) > 0) { |
|
| 59 | - return [$id, _L('echec enregistrement en base')]; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - // Enregistre l'envoi dans la BD |
|
| 63 | - $err = objet_modifier($objet, $id, $set); |
|
| 64 | - |
|
| 65 | - return [$id, $err]; |
|
| 36 | + // appel direct depuis une url avec arg = "objet/id" |
|
| 37 | + if (is_null($id) or is_null($objet)) { |
|
| 38 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 39 | + $arg = $securiser_action(); |
|
| 40 | + [$objet, $id] = array_pad(explode('/', $arg, 2), 2, null); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + // appel incorrect ou depuis une url erronnée interdit |
|
| 44 | + if (is_null($id) or is_null($objet)) { |
|
| 45 | + include_spip('inc/minipres'); |
|
| 46 | + echo minipres(_T('info_acces_interdit')); |
|
| 47 | + die(); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + // si id n'est pas un nombre, c'est une creation |
|
| 51 | + // mais on verifie qu'on a toutes les donnees qu'il faut. |
|
| 52 | + if (!$id = intval($id)) { |
|
| 53 | + // on ne sait pas si un parent existe mais on essaye |
|
| 54 | + $id_parent = _request('id_parent'); |
|
| 55 | + $id = objet_inserer($objet, $id_parent); |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + if (!($id = intval($id)) > 0) { |
|
| 59 | + return [$id, _L('echec enregistrement en base')]; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + // Enregistre l'envoi dans la BD |
|
| 63 | + $err = objet_modifier($objet, $id, $set); |
|
| 64 | + |
|
| 65 | + return [$id, $err]; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -75,85 +75,85 @@ discard block |
||
| 75 | 75 | * @return mixed|string |
| 76 | 76 | */ |
| 77 | 77 | function objet_modifier($objet, $id, $set = null) { |
| 78 | - if (($t = objet_type($objet)) !== $objet) { |
|
| 79 | - spip_log("objet_modifier: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 80 | - $objet = $t; |
|
| 81 | - } |
|
| 82 | - if ( |
|
| 83 | - include_spip('action/editer_' . $objet) |
|
| 84 | - and function_exists($modifier = $objet . '_modifier') |
|
| 85 | - ) { |
|
| 86 | - return $modifier($id, $set); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $table_sql = table_objet_sql($objet); |
|
| 90 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 91 | - $desc = $trouver_table($table_sql); |
|
| 92 | - if (!$desc or !isset($desc['field'])) { |
|
| 93 | - spip_log("Objet $objet inconnu dans objet_modifier", 'editer' . _LOG_ERREUR); |
|
| 94 | - |
|
| 95 | - return _L("Erreur objet $objet inconnu"); |
|
| 96 | - } |
|
| 97 | - include_spip('inc/modifier'); |
|
| 98 | - |
|
| 99 | - $champ_date = ''; |
|
| 100 | - if (isset($desc['date']) and $desc['date']) { |
|
| 101 | - $champ_date = $desc['date']; |
|
| 102 | - } elseif (isset($desc['field']['date'])) { |
|
| 103 | - $champ_date = 'date'; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - $include_list = array_keys($desc['field']); |
|
| 107 | - // on ne traite pas la cle primaire par defaut, notamment car |
|
| 108 | - // sur une creation, id_x vaut 'oui', et serait enregistre en id_x=0 dans la base |
|
| 109 | - $include_list = array_diff($include_list, [$desc['key']['PRIMARY KEY']]); |
|
| 110 | - |
|
| 111 | - if (isset($desc['champs_editables']) and is_array($desc['champs_editables'])) { |
|
| 112 | - $include_list = $desc['champs_editables']; |
|
| 113 | - } |
|
| 114 | - $c = collecter_requests( |
|
| 115 | - // include list |
|
| 116 | - $include_list, |
|
| 117 | - // exclude list |
|
| 118 | - [$champ_date, 'statut', 'id_parent', 'id_secteur'], |
|
| 119 | - // donnees eventuellement fournies |
|
| 120 | - $set |
|
| 121 | - ); |
|
| 122 | - |
|
| 123 | - // Si l'objet est publie, invalider les caches et demander sa reindexation |
|
| 124 | - if (objet_test_si_publie($objet, $id)) { |
|
| 125 | - $invalideur = "id='$objet/$id'"; |
|
| 126 | - $indexation = true; |
|
| 127 | - } else { |
|
| 128 | - $invalideur = ''; |
|
| 129 | - $indexation = false; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - if ( |
|
| 133 | - $err = objet_modifier_champs( |
|
| 134 | - $objet, |
|
| 135 | - $id, |
|
| 136 | - [ |
|
| 137 | - 'data' => $set, |
|
| 138 | - 'nonvide' => '', |
|
| 139 | - 'invalideur' => $invalideur, |
|
| 140 | - 'indexation' => $indexation, |
|
| 141 | - // champ a mettre a date('Y-m-d H:i:s') s'il y a modif |
|
| 142 | - 'date_modif' => (isset($desc['field']['date_modif']) ? 'date_modif' : '') |
|
| 143 | - ], |
|
| 144 | - $c |
|
| 145 | - ) |
|
| 146 | - ) { |
|
| 147 | - return $err; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - // Modification de statut, changement de rubrique ? |
|
| 151 | - // FIXME: Ici lorsqu'un $set est passé, la fonction collecter_requests() retourne tout |
|
| 152 | - // le tableau $set hors liste d’exclusion, mais du coup on a possiblement des champs en trop. |
|
| 153 | - $c = collecter_requests([$champ_date, 'statut', 'id_parent'], [], $set); |
|
| 154 | - $err = objet_instituer($objet, $id, $c); |
|
| 155 | - |
|
| 156 | - return $err; |
|
| 78 | + if (($t = objet_type($objet)) !== $objet) { |
|
| 79 | + spip_log("objet_modifier: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 80 | + $objet = $t; |
|
| 81 | + } |
|
| 82 | + if ( |
|
| 83 | + include_spip('action/editer_' . $objet) |
|
| 84 | + and function_exists($modifier = $objet . '_modifier') |
|
| 85 | + ) { |
|
| 86 | + return $modifier($id, $set); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $table_sql = table_objet_sql($objet); |
|
| 90 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 91 | + $desc = $trouver_table($table_sql); |
|
| 92 | + if (!$desc or !isset($desc['field'])) { |
|
| 93 | + spip_log("Objet $objet inconnu dans objet_modifier", 'editer' . _LOG_ERREUR); |
|
| 94 | + |
|
| 95 | + return _L("Erreur objet $objet inconnu"); |
|
| 96 | + } |
|
| 97 | + include_spip('inc/modifier'); |
|
| 98 | + |
|
| 99 | + $champ_date = ''; |
|
| 100 | + if (isset($desc['date']) and $desc['date']) { |
|
| 101 | + $champ_date = $desc['date']; |
|
| 102 | + } elseif (isset($desc['field']['date'])) { |
|
| 103 | + $champ_date = 'date'; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + $include_list = array_keys($desc['field']); |
|
| 107 | + // on ne traite pas la cle primaire par defaut, notamment car |
|
| 108 | + // sur une creation, id_x vaut 'oui', et serait enregistre en id_x=0 dans la base |
|
| 109 | + $include_list = array_diff($include_list, [$desc['key']['PRIMARY KEY']]); |
|
| 110 | + |
|
| 111 | + if (isset($desc['champs_editables']) and is_array($desc['champs_editables'])) { |
|
| 112 | + $include_list = $desc['champs_editables']; |
|
| 113 | + } |
|
| 114 | + $c = collecter_requests( |
|
| 115 | + // include list |
|
| 116 | + $include_list, |
|
| 117 | + // exclude list |
|
| 118 | + [$champ_date, 'statut', 'id_parent', 'id_secteur'], |
|
| 119 | + // donnees eventuellement fournies |
|
| 120 | + $set |
|
| 121 | + ); |
|
| 122 | + |
|
| 123 | + // Si l'objet est publie, invalider les caches et demander sa reindexation |
|
| 124 | + if (objet_test_si_publie($objet, $id)) { |
|
| 125 | + $invalideur = "id='$objet/$id'"; |
|
| 126 | + $indexation = true; |
|
| 127 | + } else { |
|
| 128 | + $invalideur = ''; |
|
| 129 | + $indexation = false; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + if ( |
|
| 133 | + $err = objet_modifier_champs( |
|
| 134 | + $objet, |
|
| 135 | + $id, |
|
| 136 | + [ |
|
| 137 | + 'data' => $set, |
|
| 138 | + 'nonvide' => '', |
|
| 139 | + 'invalideur' => $invalideur, |
|
| 140 | + 'indexation' => $indexation, |
|
| 141 | + // champ a mettre a date('Y-m-d H:i:s') s'il y a modif |
|
| 142 | + 'date_modif' => (isset($desc['field']['date_modif']) ? 'date_modif' : '') |
|
| 143 | + ], |
|
| 144 | + $c |
|
| 145 | + ) |
|
| 146 | + ) { |
|
| 147 | + return $err; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + // Modification de statut, changement de rubrique ? |
|
| 151 | + // FIXME: Ici lorsqu'un $set est passé, la fonction collecter_requests() retourne tout |
|
| 152 | + // le tableau $set hors liste d’exclusion, mais du coup on a possiblement des champs en trop. |
|
| 153 | + $c = collecter_requests([$champ_date, 'statut', 'id_parent'], [], $set); |
|
| 154 | + $err = objet_instituer($objet, $id, $c); |
|
| 155 | + |
|
| 156 | + return $err; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -168,157 +168,157 @@ discard block |
||
| 168 | 168 | * @return bool|int |
| 169 | 169 | */ |
| 170 | 170 | function objet_inserer($objet, $id_parent = null, $set = null) { |
| 171 | - $d = null; |
|
| 172 | - if (($t = objet_type($objet)) !== $objet) { |
|
| 173 | - spip_log("objet_inserer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 174 | - $objet = $t; |
|
| 175 | - } |
|
| 176 | - if ( |
|
| 177 | - include_spip('action/editer_' . $objet) |
|
| 178 | - and function_exists($inserer = $objet . '_inserer') |
|
| 179 | - ) { |
|
| 180 | - return $inserer($id_parent, $set); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - $table_sql = table_objet_sql($objet); |
|
| 184 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 185 | - $desc = $trouver_table($table_sql); |
|
| 186 | - if (!$desc or !isset($desc['field'])) { |
|
| 187 | - return 0; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - $lang_rub = ''; |
|
| 191 | - $champs = []; |
|
| 192 | - if (isset($desc['field']['id_rubrique'])) { |
|
| 193 | - // Si id_rubrique vaut 0 ou n'est pas definie, creer l'objet |
|
| 194 | - // dans la premiere rubrique racine |
|
| 195 | - if (!$id_rubrique = intval($id_parent)) { |
|
| 196 | - $row = sql_fetsel('id_rubrique, id_secteur, lang', 'spip_rubriques', 'id_parent=0', '', '0+titre,titre', '1'); |
|
| 197 | - $id_rubrique = $row['id_rubrique']; |
|
| 198 | - } else { |
|
| 199 | - $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - $champs['id_rubrique'] = $id_rubrique; |
|
| 203 | - if (isset($desc['field']['id_secteur'])) { |
|
| 204 | - $champs['id_secteur'] = $row['id_secteur']; |
|
| 205 | - } |
|
| 206 | - $lang_rub = $row['lang']; |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - // La langue a la creation : si les liens de traduction sont autorises |
|
| 210 | - // dans les rubriques, on essaie avec la langue de l'auteur, |
|
| 211 | - // ou a defaut celle de la rubrique |
|
| 212 | - // Sinon c'est la langue de la rubrique qui est choisie + heritee |
|
| 213 | - if ( |
|
| 214 | - isset($desc['field']['lang']) and !empty($GLOBALS['meta']['multi_objets']) and in_array( |
|
| 215 | - $table_sql, |
|
| 216 | - explode(',', $GLOBALS['meta']['multi_objets']) |
|
| 217 | - ) |
|
| 218 | - ) { |
|
| 219 | - lang_select($GLOBALS['visiteur_session']['lang']); |
|
| 220 | - if ( |
|
| 221 | - in_array( |
|
| 222 | - $GLOBALS['spip_lang'], |
|
| 223 | - explode(',', $GLOBALS['meta']['langues_multilingue']) |
|
| 224 | - ) |
|
| 225 | - ) { |
|
| 226 | - $champs['lang'] = $GLOBALS['spip_lang']; |
|
| 227 | - if (isset($desc['field']['langue_choisie'])) { |
|
| 228 | - $champs['langue_choisie'] = 'oui'; |
|
| 229 | - } |
|
| 230 | - } |
|
| 231 | - } elseif (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) { |
|
| 232 | - $champs['lang'] = ($lang_rub ?: $GLOBALS['meta']['langue_site']); |
|
| 233 | - $champs['langue_choisie'] = 'non'; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - if (isset($desc['field']['statut'])) { |
|
| 237 | - if (isset($desc['statut_textes_instituer'])) { |
|
| 238 | - $cles_statut = array_keys($desc['statut_textes_instituer']); |
|
| 239 | - $champs['statut'] = reset($cles_statut); |
|
| 240 | - } else { |
|
| 241 | - $champs['statut'] = 'prepa'; |
|
| 242 | - } |
|
| 243 | - } |
|
| 244 | - |
|
| 245 | - |
|
| 246 | - if ((isset($desc['date']) and $d = $desc['date']) or isset($desc['field'][$d = 'date'])) { |
|
| 247 | - $champs[$d] = date('Y-m-d H:i:s'); |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - if ($set) { |
|
| 251 | - $champs = array_merge($champs, $set); |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - // Envoyer aux plugins |
|
| 255 | - $champs = pipeline( |
|
| 256 | - 'pre_insertion', |
|
| 257 | - [ |
|
| 258 | - 'args' => [ |
|
| 259 | - 'table' => $table_sql, |
|
| 260 | - 'id_parent' => $id_parent, |
|
| 261 | - ], |
|
| 262 | - 'data' => $champs |
|
| 263 | - ] |
|
| 264 | - ); |
|
| 265 | - |
|
| 266 | - $id = sql_insertq($table_sql, $champs); |
|
| 267 | - |
|
| 268 | - if ($id) { |
|
| 269 | - // controler si le serveur n'a pas renvoye une erreur |
|
| 270 | - // et associer l'auteur sinon |
|
| 271 | - // si la table n'a pas deja un champ id_auteur |
|
| 272 | - // et si le form n'a pas poste un id_auteur (meme vide, ce qui sert a annuler cette auto association) |
|
| 273 | - if ( |
|
| 274 | - $id > 0 |
|
| 275 | - and !isset($desc['field']['id_auteur']) |
|
| 276 | - ) { |
|
| 277 | - $id_auteur = ((is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ? |
|
| 278 | - $GLOBALS['visiteur_session']['id_auteur'] |
|
| 279 | - : _request('id_auteur')); |
|
| 280 | - if ($id_auteur) { |
|
| 281 | - include_spip('action/editer_auteur'); |
|
| 282 | - auteur_associer($id_auteur, [$objet => $id]); |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - |
|
| 286 | - pipeline( |
|
| 287 | - 'post_insertion', |
|
| 288 | - [ |
|
| 289 | - 'args' => [ |
|
| 290 | - 'table' => $table_sql, |
|
| 291 | - 'id_parent' => $id_parent, |
|
| 292 | - 'id_objet' => $id, |
|
| 293 | - ], |
|
| 294 | - 'data' => $champs |
|
| 295 | - ] |
|
| 296 | - ); |
|
| 297 | - } |
|
| 171 | + $d = null; |
|
| 172 | + if (($t = objet_type($objet)) !== $objet) { |
|
| 173 | + spip_log("objet_inserer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 174 | + $objet = $t; |
|
| 175 | + } |
|
| 176 | + if ( |
|
| 177 | + include_spip('action/editer_' . $objet) |
|
| 178 | + and function_exists($inserer = $objet . '_inserer') |
|
| 179 | + ) { |
|
| 180 | + return $inserer($id_parent, $set); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + $table_sql = table_objet_sql($objet); |
|
| 184 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 185 | + $desc = $trouver_table($table_sql); |
|
| 186 | + if (!$desc or !isset($desc['field'])) { |
|
| 187 | + return 0; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + $lang_rub = ''; |
|
| 191 | + $champs = []; |
|
| 192 | + if (isset($desc['field']['id_rubrique'])) { |
|
| 193 | + // Si id_rubrique vaut 0 ou n'est pas definie, creer l'objet |
|
| 194 | + // dans la premiere rubrique racine |
|
| 195 | + if (!$id_rubrique = intval($id_parent)) { |
|
| 196 | + $row = sql_fetsel('id_rubrique, id_secteur, lang', 'spip_rubriques', 'id_parent=0', '', '0+titre,titre', '1'); |
|
| 197 | + $id_rubrique = $row['id_rubrique']; |
|
| 198 | + } else { |
|
| 199 | + $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + $champs['id_rubrique'] = $id_rubrique; |
|
| 203 | + if (isset($desc['field']['id_secteur'])) { |
|
| 204 | + $champs['id_secteur'] = $row['id_secteur']; |
|
| 205 | + } |
|
| 206 | + $lang_rub = $row['lang']; |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + // La langue a la creation : si les liens de traduction sont autorises |
|
| 210 | + // dans les rubriques, on essaie avec la langue de l'auteur, |
|
| 211 | + // ou a defaut celle de la rubrique |
|
| 212 | + // Sinon c'est la langue de la rubrique qui est choisie + heritee |
|
| 213 | + if ( |
|
| 214 | + isset($desc['field']['lang']) and !empty($GLOBALS['meta']['multi_objets']) and in_array( |
|
| 215 | + $table_sql, |
|
| 216 | + explode(',', $GLOBALS['meta']['multi_objets']) |
|
| 217 | + ) |
|
| 218 | + ) { |
|
| 219 | + lang_select($GLOBALS['visiteur_session']['lang']); |
|
| 220 | + if ( |
|
| 221 | + in_array( |
|
| 222 | + $GLOBALS['spip_lang'], |
|
| 223 | + explode(',', $GLOBALS['meta']['langues_multilingue']) |
|
| 224 | + ) |
|
| 225 | + ) { |
|
| 226 | + $champs['lang'] = $GLOBALS['spip_lang']; |
|
| 227 | + if (isset($desc['field']['langue_choisie'])) { |
|
| 228 | + $champs['langue_choisie'] = 'oui'; |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | + } elseif (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) { |
|
| 232 | + $champs['lang'] = ($lang_rub ?: $GLOBALS['meta']['langue_site']); |
|
| 233 | + $champs['langue_choisie'] = 'non'; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + if (isset($desc['field']['statut'])) { |
|
| 237 | + if (isset($desc['statut_textes_instituer'])) { |
|
| 238 | + $cles_statut = array_keys($desc['statut_textes_instituer']); |
|
| 239 | + $champs['statut'] = reset($cles_statut); |
|
| 240 | + } else { |
|
| 241 | + $champs['statut'] = 'prepa'; |
|
| 242 | + } |
|
| 243 | + } |
|
| 244 | + |
|
| 245 | + |
|
| 246 | + if ((isset($desc['date']) and $d = $desc['date']) or isset($desc['field'][$d = 'date'])) { |
|
| 247 | + $champs[$d] = date('Y-m-d H:i:s'); |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + if ($set) { |
|
| 251 | + $champs = array_merge($champs, $set); |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + // Envoyer aux plugins |
|
| 255 | + $champs = pipeline( |
|
| 256 | + 'pre_insertion', |
|
| 257 | + [ |
|
| 258 | + 'args' => [ |
|
| 259 | + 'table' => $table_sql, |
|
| 260 | + 'id_parent' => $id_parent, |
|
| 261 | + ], |
|
| 262 | + 'data' => $champs |
|
| 263 | + ] |
|
| 264 | + ); |
|
| 265 | + |
|
| 266 | + $id = sql_insertq($table_sql, $champs); |
|
| 267 | + |
|
| 268 | + if ($id) { |
|
| 269 | + // controler si le serveur n'a pas renvoye une erreur |
|
| 270 | + // et associer l'auteur sinon |
|
| 271 | + // si la table n'a pas deja un champ id_auteur |
|
| 272 | + // et si le form n'a pas poste un id_auteur (meme vide, ce qui sert a annuler cette auto association) |
|
| 273 | + if ( |
|
| 274 | + $id > 0 |
|
| 275 | + and !isset($desc['field']['id_auteur']) |
|
| 276 | + ) { |
|
| 277 | + $id_auteur = ((is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ? |
|
| 278 | + $GLOBALS['visiteur_session']['id_auteur'] |
|
| 279 | + : _request('id_auteur')); |
|
| 280 | + if ($id_auteur) { |
|
| 281 | + include_spip('action/editer_auteur'); |
|
| 282 | + auteur_associer($id_auteur, [$objet => $id]); |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + |
|
| 286 | + pipeline( |
|
| 287 | + 'post_insertion', |
|
| 288 | + [ |
|
| 289 | + 'args' => [ |
|
| 290 | + 'table' => $table_sql, |
|
| 291 | + 'id_parent' => $id_parent, |
|
| 292 | + 'id_objet' => $id, |
|
| 293 | + ], |
|
| 294 | + 'data' => $champs |
|
| 295 | + ] |
|
| 296 | + ); |
|
| 297 | + } |
|
| 298 | 298 | |
| 299 | - // Appeler une notification |
|
| 300 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 301 | - $notifications( |
|
| 302 | - "{$objet}_inserer", |
|
| 303 | - $id, |
|
| 304 | - [ |
|
| 305 | - 'id_parent' => $id_parent, |
|
| 306 | - 'champs' => $champs, |
|
| 307 | - ] |
|
| 308 | - ); |
|
| 309 | - $notifications( |
|
| 310 | - 'objet_inserer', |
|
| 311 | - $id, |
|
| 312 | - [ |
|
| 313 | - 'objet' => $objet, |
|
| 314 | - 'id_objet' => $id, |
|
| 315 | - 'id_parent' => $id_parent, |
|
| 316 | - 'champs' => $champs, |
|
| 317 | - ] |
|
| 318 | - ); |
|
| 319 | - } |
|
| 320 | - |
|
| 321 | - return $id; |
|
| 299 | + // Appeler une notification |
|
| 300 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 301 | + $notifications( |
|
| 302 | + "{$objet}_inserer", |
|
| 303 | + $id, |
|
| 304 | + [ |
|
| 305 | + 'id_parent' => $id_parent, |
|
| 306 | + 'champs' => $champs, |
|
| 307 | + ] |
|
| 308 | + ); |
|
| 309 | + $notifications( |
|
| 310 | + 'objet_inserer', |
|
| 311 | + $id, |
|
| 312 | + [ |
|
| 313 | + 'objet' => $objet, |
|
| 314 | + 'id_objet' => $id, |
|
| 315 | + 'id_parent' => $id_parent, |
|
| 316 | + 'champs' => $champs, |
|
| 317 | + ] |
|
| 318 | + ); |
|
| 319 | + } |
|
| 320 | + |
|
| 321 | + return $id; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | |
@@ -335,138 +335,138 @@ discard block |
||
| 335 | 335 | * @return string |
| 336 | 336 | */ |
| 337 | 337 | function objet_instituer($objet, $id, $c, $calcul_rub = true) { |
| 338 | - if (($t = objet_type($objet)) !== $objet) { |
|
| 339 | - spip_log("objet_instituer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 340 | - $objet = $t; |
|
| 341 | - } |
|
| 342 | - if ( |
|
| 343 | - include_spip('action/editer_' . $objet) |
|
| 344 | - and function_exists($instituer = $objet . '_instituer') |
|
| 345 | - ) { |
|
| 346 | - return $instituer($id, $c, $calcul_rub); |
|
| 347 | - } |
|
| 348 | - |
|
| 349 | - $table_sql = table_objet_sql($objet); |
|
| 350 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 351 | - $desc = $trouver_table($table_sql); |
|
| 352 | - if (!$desc or !isset($desc['field'])) { |
|
| 353 | - return _L("Impossible d'instituer $objet : non connu en base"); |
|
| 354 | - } |
|
| 355 | - |
|
| 356 | - include_spip('inc/autoriser'); |
|
| 357 | - include_spip('inc/rubriques'); |
|
| 358 | - include_spip('inc/modifier'); |
|
| 359 | - |
|
| 360 | - $sel = []; |
|
| 361 | - $sel[] = (isset($desc['field']['statut']) ? 'statut' : "'' as statut"); |
|
| 362 | - |
|
| 363 | - $champ_date = ''; |
|
| 364 | - if (isset($desc['date']) and $desc['date']) { |
|
| 365 | - $champ_date = $desc['date']; |
|
| 366 | - } elseif (isset($desc['field']['date'])) { |
|
| 367 | - $champ_date = 'date'; |
|
| 368 | - } |
|
| 369 | - |
|
| 370 | - $sel[] = ($champ_date ? "$champ_date as date" : "'' as date"); |
|
| 371 | - $sel[] = (isset($desc['field']['id_rubrique']) ? 'id_rubrique' : '0 as id_rubrique'); |
|
| 372 | - |
|
| 373 | - $row = sql_fetsel($sel, $table_sql, id_table_objet($objet) . '=' . intval($id)); |
|
| 374 | - |
|
| 375 | - $id_rubrique = $row['id_rubrique']; |
|
| 376 | - $statut_ancien = $statut = $row['statut']; |
|
| 377 | - $date_ancienne = $date = $row['date']; |
|
| 378 | - $champs = []; |
|
| 379 | - |
|
| 380 | - $d = ($date and isset($c[$champ_date])) ? $c[$champ_date] : null; |
|
| 381 | - $s = (isset($desc['field']['statut']) and isset($c['statut'])) ? $c['statut'] : $statut; |
|
| 382 | - |
|
| 383 | - // cf autorisations dans inc/instituer_objet |
|
| 384 | - if ($s != $statut or ($d and $d != $date)) { |
|
| 385 | - if ( |
|
| 386 | - $id_rubrique ? |
|
| 387 | - autoriser('publierdans', 'rubrique', $id_rubrique) |
|
| 388 | - : |
|
| 389 | - autoriser('instituer', $objet, $id, null, ['statut' => $s]) |
|
| 390 | - ) { |
|
| 391 | - $statut = $champs['statut'] = $s; |
|
| 392 | - } else { |
|
| 393 | - if ($s != 'publie' and autoriser('modifier', $objet, $id)) { |
|
| 394 | - $statut = $champs['statut'] = $s; |
|
| 395 | - } else { |
|
| 396 | - spip_log("editer_objet $objet #$id refus " . json_encode($c, JSON_THROW_ON_ERROR), 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 397 | - } |
|
| 398 | - } |
|
| 399 | - |
|
| 400 | - // En cas de publication, fixer la date a "maintenant" |
|
| 401 | - // sauf si $c commande autre chose |
|
| 402 | - // ou si l'objet est deja date dans le futur |
|
| 403 | - // En cas de proposition d'un objet (mais pas depublication), idem |
|
| 404 | - if ($champ_date) { |
|
| 405 | - if ( |
|
| 406 | - $champs['statut'] == 'publie' |
|
| 407 | - or ($champs['statut'] == 'prop' and !in_array($statut_ancien, ['publie', 'prop'])) |
|
| 408 | - or $d |
|
| 409 | - ) { |
|
| 410 | - if ($d or strtotime($d = $date) > time()) { |
|
| 411 | - $champs[$champ_date] = $date = $d; |
|
| 412 | - } else { |
|
| 413 | - $champs[$champ_date] = $date = date('Y-m-d H:i:s'); |
|
| 414 | - } |
|
| 415 | - } |
|
| 416 | - } |
|
| 417 | - } |
|
| 418 | - |
|
| 419 | - // Verifier que la rubrique demandee existe et est differente |
|
| 420 | - // de la rubrique actuelle |
|
| 421 | - if ( |
|
| 422 | - $id_rubrique |
|
| 423 | - and isset($c['id_parent']) |
|
| 424 | - and $id_parent = $c['id_parent'] |
|
| 425 | - and $id_parent != $id_rubrique |
|
| 426 | - and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent))) |
|
| 427 | - ) { |
|
| 428 | - $champs['id_rubrique'] = $id_parent; |
|
| 429 | - |
|
| 430 | - // si l'objet etait publie |
|
| 431 | - // et que le demandeur n'est pas admin de la rubrique |
|
| 432 | - // repasser l'objet en statut 'propose'. |
|
| 433 | - if ( |
|
| 434 | - $statut == 'publie' |
|
| 435 | - and !autoriser('publierdans', 'rubrique', $id_rubrique) |
|
| 436 | - ) { |
|
| 437 | - $champs['statut'] = 'prop'; |
|
| 438 | - } |
|
| 439 | - } |
|
| 440 | - |
|
| 441 | - |
|
| 442 | - // Envoyer aux plugins |
|
| 443 | - $champs = pipeline( |
|
| 444 | - 'pre_edition', |
|
| 445 | - [ |
|
| 446 | - 'args' => [ |
|
| 447 | - 'table' => $table_sql, |
|
| 448 | - 'id_objet' => $id, |
|
| 449 | - 'action' => 'instituer', |
|
| 450 | - 'statut_ancien' => $statut_ancien, |
|
| 451 | - 'date_ancienne' => $date_ancienne, |
|
| 452 | - 'id_parent_ancien' => $id_rubrique, |
|
| 453 | - ], |
|
| 454 | - 'data' => $champs |
|
| 455 | - ] |
|
| 456 | - ); |
|
| 457 | - |
|
| 458 | - if (!(is_countable($champs) ? count($champs) : 0)) { |
|
| 459 | - return ''; |
|
| 460 | - } |
|
| 461 | - |
|
| 462 | - // Envoyer les modifs. |
|
| 463 | - objet_editer_heritage($objet, $id, $id_rubrique, $statut_ancien, $champs, $calcul_rub); |
|
| 464 | - |
|
| 465 | - // Invalider les caches |
|
| 466 | - include_spip('inc/invalideur'); |
|
| 467 | - suivre_invalideur("id='$objet/$id'"); |
|
| 468 | - |
|
| 469 | - /* |
|
| 338 | + if (($t = objet_type($objet)) !== $objet) { |
|
| 339 | + spip_log("objet_instituer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 340 | + $objet = $t; |
|
| 341 | + } |
|
| 342 | + if ( |
|
| 343 | + include_spip('action/editer_' . $objet) |
|
| 344 | + and function_exists($instituer = $objet . '_instituer') |
|
| 345 | + ) { |
|
| 346 | + return $instituer($id, $c, $calcul_rub); |
|
| 347 | + } |
|
| 348 | + |
|
| 349 | + $table_sql = table_objet_sql($objet); |
|
| 350 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 351 | + $desc = $trouver_table($table_sql); |
|
| 352 | + if (!$desc or !isset($desc['field'])) { |
|
| 353 | + return _L("Impossible d'instituer $objet : non connu en base"); |
|
| 354 | + } |
|
| 355 | + |
|
| 356 | + include_spip('inc/autoriser'); |
|
| 357 | + include_spip('inc/rubriques'); |
|
| 358 | + include_spip('inc/modifier'); |
|
| 359 | + |
|
| 360 | + $sel = []; |
|
| 361 | + $sel[] = (isset($desc['field']['statut']) ? 'statut' : "'' as statut"); |
|
| 362 | + |
|
| 363 | + $champ_date = ''; |
|
| 364 | + if (isset($desc['date']) and $desc['date']) { |
|
| 365 | + $champ_date = $desc['date']; |
|
| 366 | + } elseif (isset($desc['field']['date'])) { |
|
| 367 | + $champ_date = 'date'; |
|
| 368 | + } |
|
| 369 | + |
|
| 370 | + $sel[] = ($champ_date ? "$champ_date as date" : "'' as date"); |
|
| 371 | + $sel[] = (isset($desc['field']['id_rubrique']) ? 'id_rubrique' : '0 as id_rubrique'); |
|
| 372 | + |
|
| 373 | + $row = sql_fetsel($sel, $table_sql, id_table_objet($objet) . '=' . intval($id)); |
|
| 374 | + |
|
| 375 | + $id_rubrique = $row['id_rubrique']; |
|
| 376 | + $statut_ancien = $statut = $row['statut']; |
|
| 377 | + $date_ancienne = $date = $row['date']; |
|
| 378 | + $champs = []; |
|
| 379 | + |
|
| 380 | + $d = ($date and isset($c[$champ_date])) ? $c[$champ_date] : null; |
|
| 381 | + $s = (isset($desc['field']['statut']) and isset($c['statut'])) ? $c['statut'] : $statut; |
|
| 382 | + |
|
| 383 | + // cf autorisations dans inc/instituer_objet |
|
| 384 | + if ($s != $statut or ($d and $d != $date)) { |
|
| 385 | + if ( |
|
| 386 | + $id_rubrique ? |
|
| 387 | + autoriser('publierdans', 'rubrique', $id_rubrique) |
|
| 388 | + : |
|
| 389 | + autoriser('instituer', $objet, $id, null, ['statut' => $s]) |
|
| 390 | + ) { |
|
| 391 | + $statut = $champs['statut'] = $s; |
|
| 392 | + } else { |
|
| 393 | + if ($s != 'publie' and autoriser('modifier', $objet, $id)) { |
|
| 394 | + $statut = $champs['statut'] = $s; |
|
| 395 | + } else { |
|
| 396 | + spip_log("editer_objet $objet #$id refus " . json_encode($c, JSON_THROW_ON_ERROR), 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 397 | + } |
|
| 398 | + } |
|
| 399 | + |
|
| 400 | + // En cas de publication, fixer la date a "maintenant" |
|
| 401 | + // sauf si $c commande autre chose |
|
| 402 | + // ou si l'objet est deja date dans le futur |
|
| 403 | + // En cas de proposition d'un objet (mais pas depublication), idem |
|
| 404 | + if ($champ_date) { |
|
| 405 | + if ( |
|
| 406 | + $champs['statut'] == 'publie' |
|
| 407 | + or ($champs['statut'] == 'prop' and !in_array($statut_ancien, ['publie', 'prop'])) |
|
| 408 | + or $d |
|
| 409 | + ) { |
|
| 410 | + if ($d or strtotime($d = $date) > time()) { |
|
| 411 | + $champs[$champ_date] = $date = $d; |
|
| 412 | + } else { |
|
| 413 | + $champs[$champ_date] = $date = date('Y-m-d H:i:s'); |
|
| 414 | + } |
|
| 415 | + } |
|
| 416 | + } |
|
| 417 | + } |
|
| 418 | + |
|
| 419 | + // Verifier que la rubrique demandee existe et est differente |
|
| 420 | + // de la rubrique actuelle |
|
| 421 | + if ( |
|
| 422 | + $id_rubrique |
|
| 423 | + and isset($c['id_parent']) |
|
| 424 | + and $id_parent = $c['id_parent'] |
|
| 425 | + and $id_parent != $id_rubrique |
|
| 426 | + and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent))) |
|
| 427 | + ) { |
|
| 428 | + $champs['id_rubrique'] = $id_parent; |
|
| 429 | + |
|
| 430 | + // si l'objet etait publie |
|
| 431 | + // et que le demandeur n'est pas admin de la rubrique |
|
| 432 | + // repasser l'objet en statut 'propose'. |
|
| 433 | + if ( |
|
| 434 | + $statut == 'publie' |
|
| 435 | + and !autoriser('publierdans', 'rubrique', $id_rubrique) |
|
| 436 | + ) { |
|
| 437 | + $champs['statut'] = 'prop'; |
|
| 438 | + } |
|
| 439 | + } |
|
| 440 | + |
|
| 441 | + |
|
| 442 | + // Envoyer aux plugins |
|
| 443 | + $champs = pipeline( |
|
| 444 | + 'pre_edition', |
|
| 445 | + [ |
|
| 446 | + 'args' => [ |
|
| 447 | + 'table' => $table_sql, |
|
| 448 | + 'id_objet' => $id, |
|
| 449 | + 'action' => 'instituer', |
|
| 450 | + 'statut_ancien' => $statut_ancien, |
|
| 451 | + 'date_ancienne' => $date_ancienne, |
|
| 452 | + 'id_parent_ancien' => $id_rubrique, |
|
| 453 | + ], |
|
| 454 | + 'data' => $champs |
|
| 455 | + ] |
|
| 456 | + ); |
|
| 457 | + |
|
| 458 | + if (!(is_countable($champs) ? count($champs) : 0)) { |
|
| 459 | + return ''; |
|
| 460 | + } |
|
| 461 | + |
|
| 462 | + // Envoyer les modifs. |
|
| 463 | + objet_editer_heritage($objet, $id, $id_rubrique, $statut_ancien, $champs, $calcul_rub); |
|
| 464 | + |
|
| 465 | + // Invalider les caches |
|
| 466 | + include_spip('inc/invalideur'); |
|
| 467 | + suivre_invalideur("id='$objet/$id'"); |
|
| 468 | + |
|
| 469 | + /* |
|
| 470 | 470 | if ($date) { |
| 471 | 471 | $t = strtotime($date); |
| 472 | 472 | $p = @$GLOBALS['meta']['date_prochain_postdate']; |
@@ -475,60 +475,60 @@ discard block |
||
| 475 | 475 | } |
| 476 | 476 | }*/ |
| 477 | 477 | |
| 478 | - // Pipeline |
|
| 479 | - pipeline( |
|
| 480 | - 'post_edition', |
|
| 481 | - [ |
|
| 482 | - 'args' => [ |
|
| 483 | - 'table' => $table_sql, |
|
| 484 | - 'id_objet' => $id, |
|
| 485 | - 'action' => 'instituer', |
|
| 486 | - 'statut_ancien' => $statut_ancien, |
|
| 487 | - 'date_ancienne' => $date_ancienne, |
|
| 488 | - 'id_parent_ancien' => $id_rubrique, |
|
| 489 | - ], |
|
| 490 | - 'data' => $champs |
|
| 491 | - ] |
|
| 492 | - ); |
|
| 493 | - |
|
| 494 | - // Notifications |
|
| 495 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 496 | - $notifications( |
|
| 497 | - "{$objet}_instituer", |
|
| 498 | - $id, |
|
| 499 | - [ |
|
| 500 | - 'statut' => $statut, |
|
| 501 | - 'statut_ancien' => $statut_ancien, |
|
| 502 | - 'date' => $date, |
|
| 503 | - 'date_ancienne' => $date_ancienne, |
|
| 504 | - 'id_parent_ancien' => $id_rubrique, |
|
| 505 | - 'champs' => $champs, |
|
| 506 | - ] |
|
| 507 | - ); |
|
| 508 | - $notifications( |
|
| 509 | - 'objet_instituer', |
|
| 510 | - $id, |
|
| 511 | - [ |
|
| 512 | - 'objet' => $objet, |
|
| 513 | - 'id_objet' => $id, |
|
| 514 | - 'statut' => $statut, |
|
| 515 | - 'statut_ancien' => $statut_ancien, |
|
| 516 | - 'date' => $date, |
|
| 517 | - 'date_ancienne' => $date_ancienne, |
|
| 518 | - 'id_parent_ancien' => $id_rubrique, |
|
| 519 | - 'champs' => $champs, |
|
| 520 | - ] |
|
| 521 | - ); |
|
| 478 | + // Pipeline |
|
| 479 | + pipeline( |
|
| 480 | + 'post_edition', |
|
| 481 | + [ |
|
| 482 | + 'args' => [ |
|
| 483 | + 'table' => $table_sql, |
|
| 484 | + 'id_objet' => $id, |
|
| 485 | + 'action' => 'instituer', |
|
| 486 | + 'statut_ancien' => $statut_ancien, |
|
| 487 | + 'date_ancienne' => $date_ancienne, |
|
| 488 | + 'id_parent_ancien' => $id_rubrique, |
|
| 489 | + ], |
|
| 490 | + 'data' => $champs |
|
| 491 | + ] |
|
| 492 | + ); |
|
| 493 | + |
|
| 494 | + // Notifications |
|
| 495 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 496 | + $notifications( |
|
| 497 | + "{$objet}_instituer", |
|
| 498 | + $id, |
|
| 499 | + [ |
|
| 500 | + 'statut' => $statut, |
|
| 501 | + 'statut_ancien' => $statut_ancien, |
|
| 502 | + 'date' => $date, |
|
| 503 | + 'date_ancienne' => $date_ancienne, |
|
| 504 | + 'id_parent_ancien' => $id_rubrique, |
|
| 505 | + 'champs' => $champs, |
|
| 506 | + ] |
|
| 507 | + ); |
|
| 508 | + $notifications( |
|
| 509 | + 'objet_instituer', |
|
| 510 | + $id, |
|
| 511 | + [ |
|
| 512 | + 'objet' => $objet, |
|
| 513 | + 'id_objet' => $id, |
|
| 514 | + 'statut' => $statut, |
|
| 515 | + 'statut_ancien' => $statut_ancien, |
|
| 516 | + 'date' => $date, |
|
| 517 | + 'date_ancienne' => $date_ancienne, |
|
| 518 | + 'id_parent_ancien' => $id_rubrique, |
|
| 519 | + 'champs' => $champs, |
|
| 520 | + ] |
|
| 521 | + ); |
|
| 522 | 522 | |
| 523 | - // Rétro-compat |
|
| 524 | - $notifications( |
|
| 525 | - "instituer$objet", |
|
| 526 | - $id, |
|
| 527 | - ['statut' => $statut, 'statut_ancien' => $statut_ancien, 'date' => $date, 'date_ancienne' => $date_ancienne] |
|
| 528 | - ); |
|
| 529 | - } |
|
| 530 | - |
|
| 531 | - return ''; // pas d'erreur |
|
| 523 | + // Rétro-compat |
|
| 524 | + $notifications( |
|
| 525 | + "instituer$objet", |
|
| 526 | + $id, |
|
| 527 | + ['statut' => $statut, 'statut_ancien' => $statut_ancien, 'date' => $date, 'date_ancienne' => $date_ancienne] |
|
| 528 | + ); |
|
| 529 | + } |
|
| 530 | + |
|
| 531 | + return ''; // pas d'erreur |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | /** |
@@ -543,51 +543,51 @@ discard block |
||
| 543 | 543 | * @return void |
| 544 | 544 | */ |
| 545 | 545 | function objet_editer_heritage($objet, $id, $id_rubrique, $statut, $champs, $cond = true) { |
| 546 | - $table_sql = table_objet_sql($objet); |
|
| 547 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 548 | - $desc = $trouver_table($table_sql); |
|
| 549 | - |
|
| 550 | - // Si on deplace l'objet |
|
| 551 | - // changer aussi son secteur et sa langue (si heritee) |
|
| 552 | - if (isset($champs['id_rubrique'])) { |
|
| 553 | - $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique'])); |
|
| 554 | - $langue = $row_rub['lang']; |
|
| 555 | - |
|
| 556 | - if (isset($desc['field']['id_secteur'])) { |
|
| 557 | - $champs['id_secteur'] = $row_rub['id_secteur']; |
|
| 558 | - } |
|
| 559 | - |
|
| 560 | - if (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) { |
|
| 561 | - if ( |
|
| 562 | - sql_fetsel( |
|
| 563 | - '1', |
|
| 564 | - $table_sql, |
|
| 565 | - id_table_objet($objet) . '=' . intval($id) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue) |
|
| 566 | - ) |
|
| 567 | - ) { |
|
| 568 | - $champs['lang'] = $langue; |
|
| 569 | - } |
|
| 570 | - } |
|
| 571 | - } |
|
| 572 | - |
|
| 573 | - if (!$champs) { |
|
| 574 | - return; |
|
| 575 | - } |
|
| 576 | - sql_updateq($table_sql, $champs, id_table_objet($objet) . '=' . intval($id)); |
|
| 577 | - |
|
| 578 | - // Changer le statut des rubriques concernees |
|
| 579 | - if ($cond) { |
|
| 580 | - include_spip('inc/rubriques'); |
|
| 581 | - //$postdate = ($GLOBALS['meta']["post_dates"] == "non" AND isset($champs['date']) AND (strtotime($champs['date']) < time()))?$champs['date']:false; |
|
| 582 | - $postdate = false; |
|
| 583 | - // On rajoute les infos de l'objet |
|
| 584 | - $infos = [ |
|
| 585 | - 'objet' => $objet, |
|
| 586 | - 'id_objet' => $id, |
|
| 587 | - 'statut_ancien' => $statut, |
|
| 588 | - ]; |
|
| 589 | - calculer_rubriques_if($id_rubrique, $champs, $infos, $postdate); |
|
| 590 | - } |
|
| 546 | + $table_sql = table_objet_sql($objet); |
|
| 547 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 548 | + $desc = $trouver_table($table_sql); |
|
| 549 | + |
|
| 550 | + // Si on deplace l'objet |
|
| 551 | + // changer aussi son secteur et sa langue (si heritee) |
|
| 552 | + if (isset($champs['id_rubrique'])) { |
|
| 553 | + $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique'])); |
|
| 554 | + $langue = $row_rub['lang']; |
|
| 555 | + |
|
| 556 | + if (isset($desc['field']['id_secteur'])) { |
|
| 557 | + $champs['id_secteur'] = $row_rub['id_secteur']; |
|
| 558 | + } |
|
| 559 | + |
|
| 560 | + if (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) { |
|
| 561 | + if ( |
|
| 562 | + sql_fetsel( |
|
| 563 | + '1', |
|
| 564 | + $table_sql, |
|
| 565 | + id_table_objet($objet) . '=' . intval($id) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue) |
|
| 566 | + ) |
|
| 567 | + ) { |
|
| 568 | + $champs['lang'] = $langue; |
|
| 569 | + } |
|
| 570 | + } |
|
| 571 | + } |
|
| 572 | + |
|
| 573 | + if (!$champs) { |
|
| 574 | + return; |
|
| 575 | + } |
|
| 576 | + sql_updateq($table_sql, $champs, id_table_objet($objet) . '=' . intval($id)); |
|
| 577 | + |
|
| 578 | + // Changer le statut des rubriques concernees |
|
| 579 | + if ($cond) { |
|
| 580 | + include_spip('inc/rubriques'); |
|
| 581 | + //$postdate = ($GLOBALS['meta']["post_dates"] == "non" AND isset($champs['date']) AND (strtotime($champs['date']) < time()))?$champs['date']:false; |
|
| 582 | + $postdate = false; |
|
| 583 | + // On rajoute les infos de l'objet |
|
| 584 | + $infos = [ |
|
| 585 | + 'objet' => $objet, |
|
| 586 | + 'id_objet' => $id, |
|
| 587 | + 'statut_ancien' => $statut, |
|
| 588 | + ]; |
|
| 589 | + calculer_rubriques_if($id_rubrique, $champs, $infos, $postdate); |
|
| 590 | + } |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | |
@@ -616,75 +616,75 @@ discard block |
||
| 616 | 616 | * string|int : valeur du champ demande pour l'objet demande |
| 617 | 617 | */ |
| 618 | 618 | function objet_lire($objet, $valeur_id, $options = []) { |
| 619 | - if (($t = objet_type($objet)) !== $objet) { |
|
| 620 | - spip_log("objet_lire: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 621 | - $objet = $t; |
|
| 622 | - } |
|
| 623 | - |
|
| 624 | - // tableau du cache des descriptions et des id d'objet (au sens id_xxx). |
|
| 625 | - // Les tableaux sont toujours indexés par le trio [objet][cle][valeur_cle] |
|
| 626 | - static $descriptions = []; |
|
| 627 | - |
|
| 628 | - // On détermine le nom du champ id de la table. |
|
| 629 | - include_spip('base/objets'); |
|
| 630 | - $primary = id_table_objet($objet); |
|
| 631 | - |
|
| 632 | - // On détermine l'id à utiliser. |
|
| 633 | - $champ_id = (!empty($options['champ_id']) ? $options['champ_id'] : $primary); |
|
| 634 | - |
|
| 635 | - // Si l'objet n'a pas encore été stocké, il faut récupérer sa description complète. |
|
| 636 | - if ( |
|
| 637 | - !isset($descriptions[$objet][$champ_id][$valeur_id]) |
|
| 638 | - or (isset($options['force']) and $options['force']) |
|
| 639 | - ) { |
|
| 640 | - // Il est possible pour un type d'objet de fournir une fonction de lecture de tous les champs d'un objet. |
|
| 641 | - if ( |
|
| 642 | - include_spip('action/editer_' . $objet) |
|
| 643 | - and function_exists($lire = "{$objet}_lire_champs") |
|
| 644 | - ) { |
|
| 645 | - $valeurs = $lire($objet, $valeur_id, $champ_id); |
|
| 646 | - } else { |
|
| 647 | - // On récupère la table SQL à partir du type d'objet. |
|
| 648 | - $table = table_objet_sql($objet); |
|
| 649 | - |
|
| 650 | - // La condition est appliquée sur le champ désigné par l'utilisateur. |
|
| 651 | - $where = [ |
|
| 652 | - $champ_id . '=' . sql_quote($valeur_id) |
|
| 653 | - ]; |
|
| 654 | - |
|
| 655 | - // Acquisition de tous les champs de l'objet : si l'accès SQL retourne une erreur on renvoie un tableau vide. |
|
| 656 | - $valeurs = sql_fetsel('*', $table, $where); |
|
| 657 | - } |
|
| 658 | - |
|
| 659 | - if (!$valeurs) { |
|
| 660 | - $valeurs = false; |
|
| 661 | - } |
|
| 662 | - |
|
| 663 | - $descriptions[$objet][$champ_id][$valeur_id] = $valeurs; |
|
| 664 | - |
|
| 665 | - if ($champ_id !== $primary and isset($valeurs[$primary])) { |
|
| 666 | - $descriptions[$objet][$primary][$valeurs[$primary]] = $valeurs; |
|
| 667 | - $descriptions[$objet][$champ_id][$valeur_id] = &$descriptions[$objet][$primary][$valeurs[$primary]]; |
|
| 668 | - } |
|
| 669 | - } |
|
| 670 | - |
|
| 671 | - $retour = $descriptions[$objet][$champ_id][$valeur_id]; |
|
| 672 | - |
|
| 673 | - // On ne retourne maintenant que les champs demandés. |
|
| 674 | - // - on détermine les informations à renvoyer. |
|
| 675 | - if ($retour and !empty($options['champs'])) { |
|
| 676 | - $champs = $options['champs']; |
|
| 677 | - // Extraction des seules informations demandées. |
|
| 678 | - // -- si on demande une information unique on renvoie la valeur simple, sinon on renvoie un tableau. |
|
| 679 | - // -- si une information n'est pas un champ valide elle n'est pas renvoyée sans renvoyer d'erreur. |
|
| 680 | - if (is_array($champs)) { |
|
| 681 | - // Tableau des informations valides |
|
| 682 | - $retour = array_intersect_key($retour, array_flip($champs)); |
|
| 683 | - } else { |
|
| 684 | - // Valeur unique demandée. |
|
| 685 | - $retour = ($retour[$champs] ?? false); |
|
| 686 | - } |
|
| 687 | - } |
|
| 688 | - |
|
| 689 | - return $retour; |
|
| 619 | + if (($t = objet_type($objet)) !== $objet) { |
|
| 620 | + spip_log("objet_lire: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 621 | + $objet = $t; |
|
| 622 | + } |
|
| 623 | + |
|
| 624 | + // tableau du cache des descriptions et des id d'objet (au sens id_xxx). |
|
| 625 | + // Les tableaux sont toujours indexés par le trio [objet][cle][valeur_cle] |
|
| 626 | + static $descriptions = []; |
|
| 627 | + |
|
| 628 | + // On détermine le nom du champ id de la table. |
|
| 629 | + include_spip('base/objets'); |
|
| 630 | + $primary = id_table_objet($objet); |
|
| 631 | + |
|
| 632 | + // On détermine l'id à utiliser. |
|
| 633 | + $champ_id = (!empty($options['champ_id']) ? $options['champ_id'] : $primary); |
|
| 634 | + |
|
| 635 | + // Si l'objet n'a pas encore été stocké, il faut récupérer sa description complète. |
|
| 636 | + if ( |
|
| 637 | + !isset($descriptions[$objet][$champ_id][$valeur_id]) |
|
| 638 | + or (isset($options['force']) and $options['force']) |
|
| 639 | + ) { |
|
| 640 | + // Il est possible pour un type d'objet de fournir une fonction de lecture de tous les champs d'un objet. |
|
| 641 | + if ( |
|
| 642 | + include_spip('action/editer_' . $objet) |
|
| 643 | + and function_exists($lire = "{$objet}_lire_champs") |
|
| 644 | + ) { |
|
| 645 | + $valeurs = $lire($objet, $valeur_id, $champ_id); |
|
| 646 | + } else { |
|
| 647 | + // On récupère la table SQL à partir du type d'objet. |
|
| 648 | + $table = table_objet_sql($objet); |
|
| 649 | + |
|
| 650 | + // La condition est appliquée sur le champ désigné par l'utilisateur. |
|
| 651 | + $where = [ |
|
| 652 | + $champ_id . '=' . sql_quote($valeur_id) |
|
| 653 | + ]; |
|
| 654 | + |
|
| 655 | + // Acquisition de tous les champs de l'objet : si l'accès SQL retourne une erreur on renvoie un tableau vide. |
|
| 656 | + $valeurs = sql_fetsel('*', $table, $where); |
|
| 657 | + } |
|
| 658 | + |
|
| 659 | + if (!$valeurs) { |
|
| 660 | + $valeurs = false; |
|
| 661 | + } |
|
| 662 | + |
|
| 663 | + $descriptions[$objet][$champ_id][$valeur_id] = $valeurs; |
|
| 664 | + |
|
| 665 | + if ($champ_id !== $primary and isset($valeurs[$primary])) { |
|
| 666 | + $descriptions[$objet][$primary][$valeurs[$primary]] = $valeurs; |
|
| 667 | + $descriptions[$objet][$champ_id][$valeur_id] = &$descriptions[$objet][$primary][$valeurs[$primary]]; |
|
| 668 | + } |
|
| 669 | + } |
|
| 670 | + |
|
| 671 | + $retour = $descriptions[$objet][$champ_id][$valeur_id]; |
|
| 672 | + |
|
| 673 | + // On ne retourne maintenant que les champs demandés. |
|
| 674 | + // - on détermine les informations à renvoyer. |
|
| 675 | + if ($retour and !empty($options['champs'])) { |
|
| 676 | + $champs = $options['champs']; |
|
| 677 | + // Extraction des seules informations demandées. |
|
| 678 | + // -- si on demande une information unique on renvoie la valeur simple, sinon on renvoie un tableau. |
|
| 679 | + // -- si une information n'est pas un champ valide elle n'est pas renvoyée sans renvoyer d'erreur. |
|
| 680 | + if (is_array($champs)) { |
|
| 681 | + // Tableau des informations valides |
|
| 682 | + $retour = array_intersect_key($retour, array_flip($champs)); |
|
| 683 | + } else { |
|
| 684 | + // Valeur unique demandée. |
|
| 685 | + $retour = ($retour[$champs] ?? false); |
|
| 686 | + } |
|
| 687 | + } |
|
| 688 | + |
|
| 689 | + return $retour; |
|
| 690 | 690 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $_id = $e['id_table_objet']; |
| 51 | 51 | if (isset($contexte[$_id]) and $id = intval($contexte[$_id])) { |
| 52 | 52 | $table = $e['table_objet_sql']; |
| 53 | - $row = sql_fetsel('*', $table, "$_id=" . intval($id)); |
|
| 53 | + $row = sql_fetsel('*', $table, "$_id=".intval($id)); |
|
| 54 | 54 | if (isset($row['id_rubrique'])) { |
| 55 | 55 | $contexte['id_rubrique'] = $row['id_rubrique']; |
| 56 | 56 | if (isset($row['id_secteur'])) { |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | $boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position) |
| 115 | 115 | + [ |
| 116 | 116 | $id => new Bouton( |
| 117 | - ($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '', // icone |
|
| 118 | - $infos['titre'], // titre |
|
| 117 | + ($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '', // icone |
|
| 118 | + $infos['titre'], // titre |
|
| 119 | 119 | (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
| 120 | 120 | (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
| 121 | 121 | ) |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | $boutons_admin = array_slice($boutons_admin, 0, $position) |
| 133 | 133 | + [ |
| 134 | 134 | $id => new Bouton( |
| 135 | - ($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '', // icone |
|
| 136 | - $infos['titre'], // titre |
|
| 135 | + ($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '', // icone |
|
| 136 | + $infos['titre'], // titre |
|
| 137 | 137 | (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
| 138 | 138 | (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
| 139 | 139 | ) |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $url = str_replace('&', '&', $url); |
| 221 | 221 | while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) { |
| 222 | 222 | if ($matches[2] == 'id_secteur' and !isset($contexte['id_secteur']) and isset($contexte['id_rubrique'])) { |
| 223 | - $contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($contexte['id_rubrique'])); |
|
| 223 | + $contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.intval($contexte['id_rubrique'])); |
|
| 224 | 224 | } |
| 225 | 225 | $val = _request($matches[2], $contexte); |
| 226 | 226 | $url = parametre_url($url, $matches[1], $val ?: '', '&'); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | **/ |
| 20 | 20 | |
| 21 | 21 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 22 | - return; |
|
| 22 | + return; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | include_spip('inc/boutons'); |
@@ -39,33 +39,33 @@ discard block |
||
| 39 | 39 | * contexte |
| 40 | 40 | **/ |
| 41 | 41 | function definir_barre_contexte($contexte = null) { |
| 42 | - if (is_null($contexte)) { |
|
| 43 | - $contexte = $_GET; |
|
| 44 | - } elseif (is_string($contexte)) { |
|
| 45 | - $contexte = unserialize($contexte); |
|
| 46 | - } |
|
| 47 | - if (!isset($contexte['id_rubrique']) and isset($contexte['exec'])) { |
|
| 48 | - if (!function_exists('trouver_objet_exec')) { |
|
| 49 | - include_spip('inc/pipelines_ecrire'); |
|
| 50 | - } |
|
| 51 | - if ($e = trouver_objet_exec($contexte['exec'])) { |
|
| 52 | - $_id = $e['id_table_objet']; |
|
| 53 | - if (isset($contexte[$_id]) and $id = intval($contexte[$_id])) { |
|
| 54 | - $table = $e['table_objet_sql']; |
|
| 55 | - $row = sql_fetsel('*', $table, "$_id=" . intval($id)); |
|
| 56 | - if (isset($row['id_rubrique'])) { |
|
| 57 | - $contexte['id_rubrique'] = $row['id_rubrique']; |
|
| 58 | - if (isset($row['id_secteur'])) { |
|
| 59 | - $contexte['id_secteur'] = $row['id_secteur']; |
|
| 60 | - } |
|
| 61 | - } elseif (isset($row['id_groupe'])) { |
|
| 62 | - // TODO supprimer ce bloc quand https://core.spip.net/issues/3844 sera réalisé |
|
| 63 | - $contexte['id_groupe'] = $row['id_groupe']; |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - } |
|
| 67 | - } |
|
| 68 | - return $contexte; |
|
| 42 | + if (is_null($contexte)) { |
|
| 43 | + $contexte = $_GET; |
|
| 44 | + } elseif (is_string($contexte)) { |
|
| 45 | + $contexte = unserialize($contexte); |
|
| 46 | + } |
|
| 47 | + if (!isset($contexte['id_rubrique']) and isset($contexte['exec'])) { |
|
| 48 | + if (!function_exists('trouver_objet_exec')) { |
|
| 49 | + include_spip('inc/pipelines_ecrire'); |
|
| 50 | + } |
|
| 51 | + if ($e = trouver_objet_exec($contexte['exec'])) { |
|
| 52 | + $_id = $e['id_table_objet']; |
|
| 53 | + if (isset($contexte[$_id]) and $id = intval($contexte[$_id])) { |
|
| 54 | + $table = $e['table_objet_sql']; |
|
| 55 | + $row = sql_fetsel('*', $table, "$_id=" . intval($id)); |
|
| 56 | + if (isset($row['id_rubrique'])) { |
|
| 57 | + $contexte['id_rubrique'] = $row['id_rubrique']; |
|
| 58 | + if (isset($row['id_secteur'])) { |
|
| 59 | + $contexte['id_secteur'] = $row['id_secteur']; |
|
| 60 | + } |
|
| 61 | + } elseif (isset($row['id_groupe'])) { |
|
| 62 | + // TODO supprimer ce bloc quand https://core.spip.net/issues/3844 sera réalisé |
|
| 63 | + $contexte['id_groupe'] = $row['id_groupe']; |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | + return $contexte; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -81,89 +81,89 @@ discard block |
||
| 81 | 81 | * @return array |
| 82 | 82 | */ |
| 83 | 83 | function definir_barre_boutons($contexte = [], $icones = true, $autorise = true) { |
| 84 | - include_spip('inc/autoriser'); |
|
| 85 | - $boutons_admin = []; |
|
| 84 | + include_spip('inc/autoriser'); |
|
| 85 | + $boutons_admin = []; |
|
| 86 | 86 | |
| 87 | - // les boutons du core, issus de ecrire/paquet.xml |
|
| 88 | - $liste_boutons = []; |
|
| 87 | + // les boutons du core, issus de ecrire/paquet.xml |
|
| 88 | + $liste_boutons = []; |
|
| 89 | 89 | |
| 90 | - // ajouter les boutons issus des plugin via paquet.xml |
|
| 91 | - if ( |
|
| 92 | - function_exists('boutons_plugins') |
|
| 93 | - and is_array($liste_boutons_plugins = boutons_plugins()) |
|
| 94 | - ) { |
|
| 95 | - $liste_boutons = &$liste_boutons_plugins; |
|
| 96 | - } |
|
| 90 | + // ajouter les boutons issus des plugin via paquet.xml |
|
| 91 | + if ( |
|
| 92 | + function_exists('boutons_plugins') |
|
| 93 | + and is_array($liste_boutons_plugins = boutons_plugins()) |
|
| 94 | + ) { |
|
| 95 | + $liste_boutons = &$liste_boutons_plugins; |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - foreach ($liste_boutons as $id => $infos) { |
|
| 99 | - $parent = ''; |
|
| 100 | - // les boutons principaux ne sont pas soumis a autorisation |
|
| 101 | - if ( |
|
| 102 | - !isset($infos['parent']) |
|
| 103 | - or !($parent = $infos['parent']) |
|
| 104 | - or !$autorise |
|
| 105 | - or autoriser('menu', "_$id", 0, null, ['contexte' => $contexte]) |
|
| 106 | - ) { |
|
| 107 | - if ( |
|
| 108 | - $parent |
|
| 109 | - and $parent = preg_replace(',^bando_,', 'menu_', $parent) |
|
| 110 | - and isset($boutons_admin[$parent]) |
|
| 111 | - ) { |
|
| 112 | - $position = (isset($infos['position']) and strlen($infos['position'])) ? intval($infos['position']) : count($boutons_admin[$parent]->sousmenu); |
|
| 113 | - if ($position < 0) { |
|
| 114 | - $position = count($boutons_admin[$parent]->sousmenu) + 1 + $position; |
|
| 115 | - } |
|
| 116 | - $boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position) |
|
| 117 | - + [ |
|
| 118 | - $id => new Bouton( |
|
| 119 | - ($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '', // icone |
|
| 120 | - $infos['titre'], // titre |
|
| 121 | - (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
|
| 122 | - (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
|
| 123 | - ) |
|
| 124 | - ] |
|
| 125 | - + array_slice($boutons_admin[$parent]->sousmenu, $position, 100); |
|
| 126 | - } |
|
| 127 | - if ( |
|
| 128 | - !$parent |
|
| 129 | - // provisoire, eviter les vieux boutons |
|
| 130 | - and (!in_array($id, ['forum', 'statistiques_visites'])) |
|
| 131 | - and (!$autorise or autoriser('menugrandeentree', "_$id", 0, null, ['contexte' => $contexte])) |
|
| 132 | - ) { |
|
| 133 | - $position = (isset($infos['position']) and $infos['position']) ? $infos['position'] : count($boutons_admin); |
|
| 134 | - $boutons_admin = array_slice($boutons_admin, 0, $position) |
|
| 135 | - + [ |
|
| 136 | - $id => new Bouton( |
|
| 137 | - ($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '', // icone |
|
| 138 | - $infos['titre'], // titre |
|
| 139 | - (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
|
| 140 | - (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
|
| 141 | - ) |
|
| 142 | - ] |
|
| 143 | - + array_slice($boutons_admin, $position, 100); |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - } |
|
| 147 | - $boutons_admin = pipeline('ajouter_menus', $boutons_admin); |
|
| 98 | + foreach ($liste_boutons as $id => $infos) { |
|
| 99 | + $parent = ''; |
|
| 100 | + // les boutons principaux ne sont pas soumis a autorisation |
|
| 101 | + if ( |
|
| 102 | + !isset($infos['parent']) |
|
| 103 | + or !($parent = $infos['parent']) |
|
| 104 | + or !$autorise |
|
| 105 | + or autoriser('menu', "_$id", 0, null, ['contexte' => $contexte]) |
|
| 106 | + ) { |
|
| 107 | + if ( |
|
| 108 | + $parent |
|
| 109 | + and $parent = preg_replace(',^bando_,', 'menu_', $parent) |
|
| 110 | + and isset($boutons_admin[$parent]) |
|
| 111 | + ) { |
|
| 112 | + $position = (isset($infos['position']) and strlen($infos['position'])) ? intval($infos['position']) : count($boutons_admin[$parent]->sousmenu); |
|
| 113 | + if ($position < 0) { |
|
| 114 | + $position = count($boutons_admin[$parent]->sousmenu) + 1 + $position; |
|
| 115 | + } |
|
| 116 | + $boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position) |
|
| 117 | + + [ |
|
| 118 | + $id => new Bouton( |
|
| 119 | + ($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '', // icone |
|
| 120 | + $infos['titre'], // titre |
|
| 121 | + (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
|
| 122 | + (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
|
| 123 | + ) |
|
| 124 | + ] |
|
| 125 | + + array_slice($boutons_admin[$parent]->sousmenu, $position, 100); |
|
| 126 | + } |
|
| 127 | + if ( |
|
| 128 | + !$parent |
|
| 129 | + // provisoire, eviter les vieux boutons |
|
| 130 | + and (!in_array($id, ['forum', 'statistiques_visites'])) |
|
| 131 | + and (!$autorise or autoriser('menugrandeentree', "_$id", 0, null, ['contexte' => $contexte])) |
|
| 132 | + ) { |
|
| 133 | + $position = (isset($infos['position']) and $infos['position']) ? $infos['position'] : count($boutons_admin); |
|
| 134 | + $boutons_admin = array_slice($boutons_admin, 0, $position) |
|
| 135 | + + [ |
|
| 136 | + $id => new Bouton( |
|
| 137 | + ($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '', // icone |
|
| 138 | + $infos['titre'], // titre |
|
| 139 | + (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
|
| 140 | + (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
|
| 141 | + ) |
|
| 142 | + ] |
|
| 143 | + + array_slice($boutons_admin, $position, 100); |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + } |
|
| 147 | + $boutons_admin = pipeline('ajouter_menus', $boutons_admin); |
|
| 148 | 148 | |
| 149 | - // définir les favoris et positions d’origine |
|
| 150 | - if ($boutons_admin) { |
|
| 151 | - $menus_favoris = obtenir_menus_favoris(); |
|
| 152 | - $i = 1; |
|
| 153 | - foreach ($boutons_admin as $key => $menu) { |
|
| 154 | - $menu->favori = (int) table_valeur($menus_favoris, $key, false); |
|
| 155 | - $menu->position = $i++; |
|
| 156 | - if ($menu->sousmenu) { |
|
| 157 | - $j = 1; |
|
| 158 | - foreach ($menu->sousmenu as $key => $bouton) { |
|
| 159 | - $bouton->favori = (int) table_valeur($menus_favoris, $key, false); |
|
| 160 | - $bouton->position = $j++; |
|
| 161 | - } |
|
| 162 | - } |
|
| 163 | - } |
|
| 164 | - } |
|
| 149 | + // définir les favoris et positions d’origine |
|
| 150 | + if ($boutons_admin) { |
|
| 151 | + $menus_favoris = obtenir_menus_favoris(); |
|
| 152 | + $i = 1; |
|
| 153 | + foreach ($boutons_admin as $key => $menu) { |
|
| 154 | + $menu->favori = (int) table_valeur($menus_favoris, $key, false); |
|
| 155 | + $menu->position = $i++; |
|
| 156 | + if ($menu->sousmenu) { |
|
| 157 | + $j = 1; |
|
| 158 | + foreach ($menu->sousmenu as $key => $bouton) { |
|
| 159 | + $bouton->favori = (int) table_valeur($menus_favoris, $key, false); |
|
| 160 | + $bouton->position = $j++; |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | - return $boutons_admin; |
|
| 166 | + return $boutons_admin; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -175,22 +175,22 @@ discard block |
||
| 175 | 175 | * @return Bouton[] |
| 176 | 176 | */ |
| 177 | 177 | function trier_boutons_enfants_par_alpha($menus, $avec_favoris = false) { |
| 178 | - foreach ($menus as $menu) { |
|
| 179 | - if ($menu->sousmenu) { |
|
| 180 | - $libelles = $isfavoris = $favoris = []; |
|
| 181 | - foreach ($menu->sousmenu as $key => $item) { |
|
| 182 | - $libelles[$key] = strtolower(translitteration(_T($item->libelle))); |
|
| 183 | - $isfavoris[$key] = (bool) $item->favori; |
|
| 184 | - $favoris[$key] = $item->favori; |
|
| 185 | - } |
|
| 186 | - if ($avec_favoris) { |
|
| 187 | - array_multisort($isfavoris, SORT_DESC, $favoris, SORT_ASC, $libelles, SORT_ASC, $menu->sousmenu); |
|
| 188 | - } else { |
|
| 189 | - array_multisort($libelles, SORT_ASC, $menu->sousmenu); |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - } |
|
| 193 | - return $menus; |
|
| 178 | + foreach ($menus as $menu) { |
|
| 179 | + if ($menu->sousmenu) { |
|
| 180 | + $libelles = $isfavoris = $favoris = []; |
|
| 181 | + foreach ($menu->sousmenu as $key => $item) { |
|
| 182 | + $libelles[$key] = strtolower(translitteration(_T($item->libelle))); |
|
| 183 | + $isfavoris[$key] = (bool) $item->favori; |
|
| 184 | + $favoris[$key] = $item->favori; |
|
| 185 | + } |
|
| 186 | + if ($avec_favoris) { |
|
| 187 | + array_multisort($isfavoris, SORT_DESC, $favoris, SORT_ASC, $libelles, SORT_ASC, $menu->sousmenu); |
|
| 188 | + } else { |
|
| 189 | + array_multisort($libelles, SORT_ASC, $menu->sousmenu); |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + } |
|
| 193 | + return $menus; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @return Bouton[] |
| 202 | 202 | */ |
| 203 | 203 | function trier_boutons_enfants_par_favoris_alpha($menus) { |
| 204 | - return trier_boutons_enfants_par_alpha($menus, true); |
|
| 204 | + return trier_boutons_enfants_par_alpha($menus, true); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | |
@@ -214,23 +214,23 @@ discard block |
||
| 214 | 214 | * @return string |
| 215 | 215 | */ |
| 216 | 216 | function bandeau_creer_url($url, $args = '', $contexte = null) { |
| 217 | - if (!preg_match(',[\/\?],', $url)) { |
|
| 218 | - $url = generer_url_ecrire($url, $args, true); |
|
| 219 | - // recuperer les parametres du contexte demande par l'url sous la forme |
|
| 220 | - // &truc=@machin@ |
|
| 221 | - // @machin@ etant remplace par _request('machin') |
|
| 222 | - $url = str_replace('&', '&', $url); |
|
| 223 | - while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) { |
|
| 224 | - if ($matches[2] == 'id_secteur' and !isset($contexte['id_secteur']) and isset($contexte['id_rubrique'])) { |
|
| 225 | - $contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($contexte['id_rubrique'])); |
|
| 226 | - } |
|
| 227 | - $val = _request($matches[2], $contexte); |
|
| 228 | - $url = parametre_url($url, $matches[1], $val ?: '', '&'); |
|
| 229 | - } |
|
| 230 | - $url = str_replace('&', '&', $url); |
|
| 231 | - } |
|
| 217 | + if (!preg_match(',[\/\?],', $url)) { |
|
| 218 | + $url = generer_url_ecrire($url, $args, true); |
|
| 219 | + // recuperer les parametres du contexte demande par l'url sous la forme |
|
| 220 | + // &truc=@machin@ |
|
| 221 | + // @machin@ etant remplace par _request('machin') |
|
| 222 | + $url = str_replace('&', '&', $url); |
|
| 223 | + while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) { |
|
| 224 | + if ($matches[2] == 'id_secteur' and !isset($contexte['id_secteur']) and isset($contexte['id_rubrique'])) { |
|
| 225 | + $contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($contexte['id_rubrique'])); |
|
| 226 | + } |
|
| 227 | + $val = _request($matches[2], $contexte); |
|
| 228 | + $url = parametre_url($url, $matches[1], $val ?: '', '&'); |
|
| 229 | + } |
|
| 230 | + $url = str_replace('&', '&', $url); |
|
| 231 | + } |
|
| 232 | 232 | |
| 233 | - return $url; |
|
| 233 | + return $url; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * Code HTML du bandeau |
| 241 | 241 | */ |
| 242 | 242 | function inc_bandeau_dist() { |
| 243 | - return recuperer_fond('prive/squelettes/inclure/barre-nav', $_GET); |
|
| 243 | + return recuperer_fond('prive/squelettes/inclure/barre-nav', $_GET); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
@@ -249,13 +249,13 @@ discard block |
||
| 249 | 249 | * @return array |
| 250 | 250 | */ |
| 251 | 251 | function obtenir_menus_favoris() { |
| 252 | - if ( |
|
| 253 | - isset($GLOBALS['visiteur_session']['prefs']['menus_favoris']) |
|
| 254 | - and is_array($GLOBALS['visiteur_session']['prefs']['menus_favoris']) |
|
| 255 | - and $GLOBALS['visiteur_session']['prefs']['menus_favoris'] |
|
| 256 | - ) { |
|
| 257 | - return $GLOBALS['visiteur_session']['prefs']['menus_favoris']; |
|
| 258 | - } |
|
| 259 | - $definir_menus_favoris = charger_fonction('definir_menus_favoris', 'inc'); |
|
| 260 | - return $definir_menus_favoris(); |
|
| 252 | + if ( |
|
| 253 | + isset($GLOBALS['visiteur_session']['prefs']['menus_favoris']) |
|
| 254 | + and is_array($GLOBALS['visiteur_session']['prefs']['menus_favoris']) |
|
| 255 | + and $GLOBALS['visiteur_session']['prefs']['menus_favoris'] |
|
| 256 | + ) { |
|
| 257 | + return $GLOBALS['visiteur_session']['prefs']['menus_favoris']; |
|
| 258 | + } |
|
| 259 | + $definir_menus_favoris = charger_fonction('definir_menus_favoris', 'inc'); |
|
| 260 | + return $definir_menus_favoris(); |
|
| 261 | 261 | } |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | function changer_langue($lang, $liste_langues = null) { |
| 41 | 41 | |
| 42 | 42 | if (is_null($liste_langues)) { |
| 43 | - $liste_langues = ($GLOBALS['meta']['langues_proposees'] ?? '') . ',' . ($GLOBALS['meta']['langues_multilingue'] ?? ''); |
|
| 43 | + $liste_langues = ($GLOBALS['meta']['langues_proposees'] ?? '').','.($GLOBALS['meta']['langues_multilingue'] ?? ''); |
|
| 44 | 44 | } else { |
| 45 | 45 | if (is_array($liste_langues)) { |
| 46 | 46 | $liste_langues = implode(',', $liste_langues); |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | - $liste_langues = ',' . $liste_langues . ','; |
|
| 49 | + $liste_langues = ','.$liste_langues.','; |
|
| 50 | 50 | |
| 51 | 51 | // Si la langue demandee n'existe pas, on essaie d'autres variantes |
| 52 | 52 | // Exemple : 'pt-br' => 'pt_br' => 'pt' |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | foreach ($langues as $l) { |
| 194 | 194 | $selected = ($l == $default) ? ' selected=\'selected\'' : ''; |
| 195 | - $ret .= "<option value='$l'$selected>[" . $l . '] ' . traduire_nom_langue($l) . "</option>\n"; |
|
| 195 | + $ret .= "<option value='$l'$selected>[".$l.'] '.traduire_nom_langue($l)."</option>\n"; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (!test_espace_prive()) { |
@@ -210,23 +210,21 @@ discard block |
||
| 210 | 210 | $base, |
| 211 | 211 | $cible, |
| 212 | 212 | (select_langues($nom_select, $change, $ret) |
| 213 | - . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='" . _T('bouton_changer') . "' /></div></noscript>"), |
|
| 213 | + . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='"._T('bouton_changer')."' /></div></noscript>"), |
|
| 214 | 214 | " method='post'" |
| 215 | 215 | ); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | function select_langues($nom_select, $change, $options, $label = '') { |
| 219 | 219 | static $cpt = 0; |
| 220 | - $id = 'menu_langues' . $cpt++; |
|
| 220 | + $id = 'menu_langues'.$cpt++; |
|
| 221 | 221 | |
| 222 | 222 | return |
| 223 | - "<label for='$id'>" . ($label ?: _T('info_langues')) . '</label> ' . |
|
| 223 | + "<label for='$id'>".($label ?: _T('info_langues')).'</label> '. |
|
| 224 | 224 | "<select name='$nom_select' id='$id' " |
| 225 | 225 | . ((!test_espace_prive()) ? |
| 226 | - ("class='forml menu_langues'") : |
|
| 227 | - (($nom_select == 'var_lang_ecrire') ? |
|
| 228 | - ("class='lang_ecrire'") : |
|
| 229 | - "class='fondl'")) |
|
| 226 | + ("class='forml menu_langues'") : (($nom_select == 'var_lang_ecrire') ? |
|
| 227 | + ("class='lang_ecrire'") : "class='fondl'")) |
|
| 230 | 228 | . $change |
| 231 | 229 | . ">\n" |
| 232 | 230 | . $options |
@@ -352,7 +350,7 @@ discard block |
||
| 352 | 350 | and (!isset($GLOBALS['spip_lang']) |
| 353 | 351 | or $GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site']) |
| 354 | 352 | ) { |
| 355 | - return changer_langue($GLOBALS['meta']['langue_site'], $liste_langues);//@:install |
|
| 353 | + return changer_langue($GLOBALS['meta']['langue_site'], $liste_langues); //@:install |
|
| 356 | 354 | } |
| 357 | 355 | // en theorie là, la globale est définie, sinon c'est un problème. |
| 358 | 356 | if (!isset($GLOBALS['spip_lang'])) { |
@@ -455,7 +453,7 @@ discard block |
||
| 455 | 453 | if (!isset($GLOBALS['meta']['langue_site'])) { |
| 456 | 454 | // Initialisation : le francais si dispo, sinon la premiere langue trouvee |
| 457 | 455 | $GLOBALS['meta']['langue_site'] = $tout = |
| 458 | - (!$all_langs or (strpos(',' . _LANGUE_PAR_DEFAUT . ',', (string) ",$all_langs,") !== false)) |
|
| 456 | + (!$all_langs or (strpos(','._LANGUE_PAR_DEFAUT.',', (string) ",$all_langs,") !== false)) |
|
| 459 | 457 | ? _LANGUE_PAR_DEFAUT : substr($all_langs, 0, strpos($all_langs, ',')); |
| 460 | 458 | ecrire_meta('langue_site', $tout); |
| 461 | 459 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @package SPIP\Core\Langue |
| 16 | 16 | **/ |
| 17 | 17 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 18 | - return; |
|
| 18 | + return; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | |
@@ -38,35 +38,35 @@ discard block |
||
| 38 | 38 | **/ |
| 39 | 39 | function changer_langue($lang, $liste_langues = null) { |
| 40 | 40 | |
| 41 | - if (is_null($liste_langues)) { |
|
| 42 | - $liste_langues = ($GLOBALS['meta']['langues_proposees'] ?? '') . ',' . ($GLOBALS['meta']['langues_multilingue'] ?? ''); |
|
| 43 | - } else { |
|
| 44 | - if (is_array($liste_langues)) { |
|
| 45 | - $liste_langues = implode(',', $liste_langues); |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - $liste_langues = ',' . $liste_langues . ','; |
|
| 49 | - |
|
| 50 | - // Si la langue demandee n'existe pas, on essaie d'autres variantes |
|
| 51 | - // Exemple : 'pt-br' => 'pt_br' => 'pt' |
|
| 52 | - $lang = str_replace('-', '_', trim($lang)); |
|
| 53 | - if (!$lang) { |
|
| 54 | - return false; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - if ( |
|
| 58 | - strpos($liste_langues, (string) ",$lang,") !== false |
|
| 59 | - or ($lang = preg_replace(',_.*,', '', $lang) |
|
| 60 | - and str_contains($liste_langues, (string) ",$lang,")) |
|
| 61 | - ) { |
|
| 62 | - $GLOBALS['spip_lang_rtl'] = lang_dir($lang, '', '_rtl'); |
|
| 63 | - $GLOBALS['spip_lang_right'] = $GLOBALS['spip_lang_rtl'] ? 'left' : 'right'; |
|
| 64 | - $GLOBALS['spip_lang_left'] = $GLOBALS['spip_lang_rtl'] ? 'right' : 'left'; |
|
| 65 | - |
|
| 66 | - return $GLOBALS['spip_lang'] = $lang; |
|
| 67 | - } else { |
|
| 68 | - return false; |
|
| 69 | - } |
|
| 41 | + if (is_null($liste_langues)) { |
|
| 42 | + $liste_langues = ($GLOBALS['meta']['langues_proposees'] ?? '') . ',' . ($GLOBALS['meta']['langues_multilingue'] ?? ''); |
|
| 43 | + } else { |
|
| 44 | + if (is_array($liste_langues)) { |
|
| 45 | + $liste_langues = implode(',', $liste_langues); |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + $liste_langues = ',' . $liste_langues . ','; |
|
| 49 | + |
|
| 50 | + // Si la langue demandee n'existe pas, on essaie d'autres variantes |
|
| 51 | + // Exemple : 'pt-br' => 'pt_br' => 'pt' |
|
| 52 | + $lang = str_replace('-', '_', trim($lang)); |
|
| 53 | + if (!$lang) { |
|
| 54 | + return false; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + if ( |
|
| 58 | + strpos($liste_langues, (string) ",$lang,") !== false |
|
| 59 | + or ($lang = preg_replace(',_.*,', '', $lang) |
|
| 60 | + and str_contains($liste_langues, (string) ",$lang,")) |
|
| 61 | + ) { |
|
| 62 | + $GLOBALS['spip_lang_rtl'] = lang_dir($lang, '', '_rtl'); |
|
| 63 | + $GLOBALS['spip_lang_right'] = $GLOBALS['spip_lang_rtl'] ? 'left' : 'right'; |
|
| 64 | + $GLOBALS['spip_lang_left'] = $GLOBALS['spip_lang_rtl'] ? 'right' : 'left'; |
|
| 65 | + |
|
| 66 | + return $GLOBALS['spip_lang'] = $lang; |
|
| 67 | + } else { |
|
| 68 | + return false; |
|
| 69 | + } |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | // par exemple le francais pour l'espagnol, l'anglais pour l'allemand, etc. |
| 80 | 80 | |
| 81 | 81 | function choisir_traduction($trads, $lang = '') { |
| 82 | - $k = approcher_langue($trads, $lang); |
|
| 82 | + $k = approcher_langue($trads, $lang); |
|
| 83 | 83 | |
| 84 | - return $k ? $trads[$k] : array_shift($trads); |
|
| 84 | + return $k ? $trads[$k] : array_shift($trads); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // retourne son 2e argument si c'est un index du premier |
@@ -89,21 +89,21 @@ discard block |
||
| 89 | 89 | // la langue X etant consideree comme une approche de X_Y |
| 90 | 90 | function approcher_langue($trads, $lang = '') { |
| 91 | 91 | |
| 92 | - if (!$lang) { |
|
| 93 | - $lang = $GLOBALS['spip_lang']; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - if (isset($trads[$lang])) { |
|
| 97 | - return $lang; |
|
| 98 | - } // cas des langues xx_yy |
|
| 99 | - else { |
|
| 100 | - $r = explode('_', $lang); |
|
| 101 | - if (isset($trads[$r[0]])) { |
|
| 102 | - return $r[0]; |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - return ''; |
|
| 92 | + if (!$lang) { |
|
| 93 | + $lang = $GLOBALS['spip_lang']; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + if (isset($trads[$lang])) { |
|
| 97 | + return $lang; |
|
| 98 | + } // cas des langues xx_yy |
|
| 99 | + else { |
|
| 100 | + $r = explode('_', $lang); |
|
| 101 | + if (isset($trads[$r[0]])) { |
|
| 102 | + return $r[0]; |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + return ''; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | * Nom de la langue, sinon son code. |
| 119 | 119 | **/ |
| 120 | 120 | function traduire_nom_langue($lang) { |
| 121 | - include_spip('inc/lang_liste'); |
|
| 122 | - include_spip('inc/charsets'); |
|
| 121 | + include_spip('inc/lang_liste'); |
|
| 122 | + include_spip('inc/charsets'); |
|
| 123 | 123 | |
| 124 | - return html2unicode($GLOBALS['codes_langues'][$lang] ?? $lang); |
|
| 124 | + return html2unicode($GLOBALS['codes_langues'][$lang] ?? $lang); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | // hebreu a priori), 'droitier' sinon. |
| 135 | 135 | // C'est utilise par #LANG_DIR, #LANG_LEFT, #LANG_RIGHT. |
| 136 | 136 | function lang_dir($lang = '', $droitier = 'ltr', $gaucher = 'rtl') { |
| 137 | - static $lang_rtl = ['ar', 'fa', 'ku', 'prs', 'ps', 'ur', 'he', 'heb', 'hbo', 'yi']; |
|
| 137 | + static $lang_rtl = ['ar', 'fa', 'ku', 'prs', 'ps', 'ur', 'he', 'heb', 'hbo', 'yi']; |
|
| 138 | 138 | |
| 139 | - return in_array(($lang ?: $GLOBALS['spip_lang']), $lang_rtl) ? |
|
| 140 | - $gaucher : $droitier; |
|
| 139 | + return in_array(($lang ?: $GLOBALS['spip_lang']), $lang_rtl) ? |
|
| 140 | + $gaucher : $droitier; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // typo francaise ou anglaise ? |
@@ -146,29 +146,29 @@ discard block |
||
| 146 | 146 | // sinon determiner la typo en fonction de la langue courante |
| 147 | 147 | |
| 148 | 148 | function lang_typo($lang = '') { |
| 149 | - if (!$lang) { |
|
| 150 | - $lang = $GLOBALS['lang_objet'] ?? $GLOBALS['spip_lang']; |
|
| 151 | - } |
|
| 152 | - if ( |
|
| 153 | - $lang == 'eo' |
|
| 154 | - or $lang == 'fr' |
|
| 155 | - or strncmp($lang, 'fr_', 3) == 0 |
|
| 156 | - or $lang == 'cpf' |
|
| 157 | - ) { |
|
| 158 | - return 'fr'; |
|
| 159 | - } else { |
|
| 160 | - return 'en'; |
|
| 161 | - } |
|
| 149 | + if (!$lang) { |
|
| 150 | + $lang = $GLOBALS['lang_objet'] ?? $GLOBALS['spip_lang']; |
|
| 151 | + } |
|
| 152 | + if ( |
|
| 153 | + $lang == 'eo' |
|
| 154 | + or $lang == 'fr' |
|
| 155 | + or strncmp($lang, 'fr_', 3) == 0 |
|
| 156 | + or $lang == 'cpf' |
|
| 157 | + ) { |
|
| 158 | + return 'fr'; |
|
| 159 | + } else { |
|
| 160 | + return 'en'; |
|
| 161 | + } |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // gestion de la globale $lang_objet pour que les textes soient affiches |
| 165 | 165 | // avec les memes typo et direction dans l'espace prive que dans le public |
| 166 | 166 | function changer_typo($lang = '') { |
| 167 | - if ($lang) { |
|
| 168 | - $GLOBALS['lang_objet'] = $lang; |
|
| 169 | - } else { |
|
| 170 | - unset($GLOBALS['lang_objet']); |
|
| 171 | - } |
|
| 167 | + if ($lang) { |
|
| 168 | + $GLOBALS['lang_objet'] = $lang; |
|
| 169 | + } else { |
|
| 170 | + unset($GLOBALS['lang_objet']); |
|
| 171 | + } |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // |
@@ -178,58 +178,58 @@ discard block |
||
| 178 | 178 | // pour 'changer_lang' (langue de l'article, espace prive), c'est en Ajax |
| 179 | 179 | // |
| 180 | 180 | function menu_langues($nom_select, $default = '') { |
| 181 | - include_spip('inc/actions'); |
|
| 182 | - |
|
| 183 | - $langues = liste_options_langues($nom_select); |
|
| 184 | - $ret = ''; |
|
| 185 | - if (!count($langues)) { |
|
| 186 | - return ''; |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - if (!$default) { |
|
| 190 | - $default = $GLOBALS['spip_lang']; |
|
| 191 | - } |
|
| 192 | - foreach ($langues as $l) { |
|
| 193 | - $selected = ($l == $default) ? ' selected=\'selected\'' : ''; |
|
| 194 | - $ret .= "<option value='$l'$selected>[" . $l . '] ' . traduire_nom_langue($l) . "</option>\n"; |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - if (!test_espace_prive()) { |
|
| 198 | - $cible = self(); |
|
| 199 | - $base = ''; |
|
| 200 | - } else { |
|
| 201 | - $cible = self(); |
|
| 202 | - $base = spip_connect() ? 'base' : ''; |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - $change = ' onchange="this.parentNode.parentNode.submit()"'; |
|
| 206 | - |
|
| 207 | - return generer_action_auteur( |
|
| 208 | - 'converser', |
|
| 209 | - $base, |
|
| 210 | - $cible, |
|
| 211 | - (select_langues($nom_select, $change, $ret) |
|
| 212 | - . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='" . _T('bouton_changer') . "' /></div></noscript>"), |
|
| 213 | - " method='post'" |
|
| 214 | - ); |
|
| 181 | + include_spip('inc/actions'); |
|
| 182 | + |
|
| 183 | + $langues = liste_options_langues($nom_select); |
|
| 184 | + $ret = ''; |
|
| 185 | + if (!count($langues)) { |
|
| 186 | + return ''; |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + if (!$default) { |
|
| 190 | + $default = $GLOBALS['spip_lang']; |
|
| 191 | + } |
|
| 192 | + foreach ($langues as $l) { |
|
| 193 | + $selected = ($l == $default) ? ' selected=\'selected\'' : ''; |
|
| 194 | + $ret .= "<option value='$l'$selected>[" . $l . '] ' . traduire_nom_langue($l) . "</option>\n"; |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + if (!test_espace_prive()) { |
|
| 198 | + $cible = self(); |
|
| 199 | + $base = ''; |
|
| 200 | + } else { |
|
| 201 | + $cible = self(); |
|
| 202 | + $base = spip_connect() ? 'base' : ''; |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + $change = ' onchange="this.parentNode.parentNode.submit()"'; |
|
| 206 | + |
|
| 207 | + return generer_action_auteur( |
|
| 208 | + 'converser', |
|
| 209 | + $base, |
|
| 210 | + $cible, |
|
| 211 | + (select_langues($nom_select, $change, $ret) |
|
| 212 | + . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='" . _T('bouton_changer') . "' /></div></noscript>"), |
|
| 213 | + " method='post'" |
|
| 214 | + ); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | function select_langues($nom_select, $change, $options, $label = '') { |
| 218 | - static $cpt = 0; |
|
| 219 | - $id = 'menu_langues' . $cpt++; |
|
| 220 | - |
|
| 221 | - return |
|
| 222 | - "<label for='$id'>" . ($label ?: _T('info_langues')) . '</label> ' . |
|
| 223 | - "<select name='$nom_select' id='$id' " |
|
| 224 | - . ((!test_espace_prive()) ? |
|
| 225 | - ("class='forml menu_langues'") : |
|
| 226 | - (($nom_select == 'var_lang_ecrire') ? |
|
| 227 | - ("class='lang_ecrire'") : |
|
| 228 | - "class='fondl'")) |
|
| 229 | - . $change |
|
| 230 | - . ">\n" |
|
| 231 | - . $options |
|
| 232 | - . '</select>'; |
|
| 218 | + static $cpt = 0; |
|
| 219 | + $id = 'menu_langues' . $cpt++; |
|
| 220 | + |
|
| 221 | + return |
|
| 222 | + "<label for='$id'>" . ($label ?: _T('info_langues')) . '</label> ' . |
|
| 223 | + "<select name='$nom_select' id='$id' " |
|
| 224 | + . ((!test_espace_prive()) ? |
|
| 225 | + ("class='forml menu_langues'") : |
|
| 226 | + (($nom_select == 'var_lang_ecrire') ? |
|
| 227 | + ("class='lang_ecrire'") : |
|
| 228 | + "class='fondl'")) |
|
| 229 | + . $change |
|
| 230 | + . ">\n" |
|
| 231 | + . $options |
|
| 232 | + . '</select>'; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -251,34 +251,34 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | function liste_options_langues($nom_select) { |
| 253 | 253 | |
| 254 | - switch ($nom_select) { |
|
| 255 | - # #MENU_LANG |
|
| 256 | - case 'var_lang': |
|
| 257 | - # menu de changement de la langue d'un article |
|
| 258 | - # les langues selectionnees dans la configuration "multilinguisme" |
|
| 259 | - case 'changer_lang': |
|
| 260 | - $langues = explode(',', $GLOBALS['meta']['langues_multilingue']); |
|
| 261 | - break; |
|
| 262 | - # menu de l'interface (privee, installation et panneau de login) |
|
| 263 | - # les langues presentes sous forme de fichiers de langue |
|
| 264 | - # on force la relecture du repertoire des langues pour etre synchrone. |
|
| 265 | - case 'var_lang_ecrire': |
|
| 266 | - default: |
|
| 267 | - $GLOBALS['meta']['langues_proposees'] = ''; |
|
| 268 | - init_langues(); |
|
| 269 | - $langues = explode(',', $GLOBALS['meta']['langues_proposees']); |
|
| 270 | - break; |
|
| 254 | + switch ($nom_select) { |
|
| 255 | + # #MENU_LANG |
|
| 256 | + case 'var_lang': |
|
| 257 | + # menu de changement de la langue d'un article |
|
| 258 | + # les langues selectionnees dans la configuration "multilinguisme" |
|
| 259 | + case 'changer_lang': |
|
| 260 | + $langues = explode(',', $GLOBALS['meta']['langues_multilingue']); |
|
| 261 | + break; |
|
| 262 | + # menu de l'interface (privee, installation et panneau de login) |
|
| 263 | + # les langues presentes sous forme de fichiers de langue |
|
| 264 | + # on force la relecture du repertoire des langues pour etre synchrone. |
|
| 265 | + case 'var_lang_ecrire': |
|
| 266 | + default: |
|
| 267 | + $GLOBALS['meta']['langues_proposees'] = ''; |
|
| 268 | + init_langues(); |
|
| 269 | + $langues = explode(',', $GLOBALS['meta']['langues_proposees']); |
|
| 270 | + break; |
|
| 271 | 271 | |
| 272 | 272 | # dernier choix possible : toutes les langues = langues_proposees |
| 273 | 273 | # + langues_multilingues ; mais, ne sert pas |
| 274 | 274 | # $langues = explode(',', $GLOBALS['all_langs']); |
| 275 | - } |
|
| 276 | - if (count($langues) <= 1) { |
|
| 277 | - return []; |
|
| 278 | - } |
|
| 279 | - sort($langues); |
|
| 275 | + } |
|
| 276 | + if (count($langues) <= 1) { |
|
| 277 | + return []; |
|
| 278 | + } |
|
| 279 | + sort($langues); |
|
| 280 | 280 | |
| 281 | - return $langues; |
|
| 281 | + return $langues; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | |
@@ -293,39 +293,39 @@ discard block |
||
| 293 | 293 | **/ |
| 294 | 294 | function verifier_lang_url() { |
| 295 | 295 | |
| 296 | - // quelle langue est demandee ? |
|
| 297 | - $lang_demandee = (test_espace_prive() ? $GLOBALS['spip_lang'] : $GLOBALS['meta']['langue_site']); |
|
| 298 | - if (isset($_COOKIE['spip_lang_ecrire'])) { |
|
| 299 | - $lang_demandee = $_COOKIE['spip_lang_ecrire']; |
|
| 300 | - } |
|
| 301 | - if (!test_espace_prive() and isset($_COOKIE['spip_lang'])) { |
|
| 302 | - $lang_demandee = $_COOKIE['spip_lang']; |
|
| 303 | - } |
|
| 304 | - if (isset($_GET['lang'])) { |
|
| 305 | - $lang_demandee = $_GET['lang']; |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - // Renvoyer si besoin (et si la langue demandee existe) |
|
| 309 | - if ( |
|
| 310 | - $GLOBALS['spip_lang'] != $lang_demandee |
|
| 311 | - and changer_langue($lang_demandee) |
|
| 312 | - and $lang_demandee != @$_GET['lang'] |
|
| 313 | - ) { |
|
| 314 | - $destination = parametre_url(self(), 'lang', $lang_demandee, '&'); |
|
| 315 | - // ici on a besoin des var_truc |
|
| 316 | - foreach ($_GET as $var => $val) { |
|
| 317 | - if (!strncmp('var_', $var, 4)) { |
|
| 318 | - $destination = parametre_url($destination, $var, $val, '&'); |
|
| 319 | - } |
|
| 320 | - } |
|
| 321 | - include_spip('inc/headers'); |
|
| 322 | - redirige_par_entete($destination); |
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - // Subtilite : si la langue demandee par cookie est la bonne |
|
| 326 | - // alors on fait comme si $lang etait passee dans l'URL |
|
| 327 | - // (pour criteres {lang}). |
|
| 328 | - $GLOBALS['lang'] = $_GET['lang'] = $GLOBALS['spip_lang']; |
|
| 296 | + // quelle langue est demandee ? |
|
| 297 | + $lang_demandee = (test_espace_prive() ? $GLOBALS['spip_lang'] : $GLOBALS['meta']['langue_site']); |
|
| 298 | + if (isset($_COOKIE['spip_lang_ecrire'])) { |
|
| 299 | + $lang_demandee = $_COOKIE['spip_lang_ecrire']; |
|
| 300 | + } |
|
| 301 | + if (!test_espace_prive() and isset($_COOKIE['spip_lang'])) { |
|
| 302 | + $lang_demandee = $_COOKIE['spip_lang']; |
|
| 303 | + } |
|
| 304 | + if (isset($_GET['lang'])) { |
|
| 305 | + $lang_demandee = $_GET['lang']; |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + // Renvoyer si besoin (et si la langue demandee existe) |
|
| 309 | + if ( |
|
| 310 | + $GLOBALS['spip_lang'] != $lang_demandee |
|
| 311 | + and changer_langue($lang_demandee) |
|
| 312 | + and $lang_demandee != @$_GET['lang'] |
|
| 313 | + ) { |
|
| 314 | + $destination = parametre_url(self(), 'lang', $lang_demandee, '&'); |
|
| 315 | + // ici on a besoin des var_truc |
|
| 316 | + foreach ($_GET as $var => $val) { |
|
| 317 | + if (!strncmp('var_', $var, 4)) { |
|
| 318 | + $destination = parametre_url($destination, $var, $val, '&'); |
|
| 319 | + } |
|
| 320 | + } |
|
| 321 | + include_spip('inc/headers'); |
|
| 322 | + redirige_par_entete($destination); |
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + // Subtilite : si la langue demandee par cookie est la bonne |
|
| 326 | + // alors on fait comme si $lang etait passee dans l'URL |
|
| 327 | + // (pour criteres {lang}). |
|
| 328 | + $GLOBALS['lang'] = $_GET['lang'] = $GLOBALS['spip_lang']; |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | |
@@ -343,22 +343,22 @@ discard block |
||
| 343 | 343 | * La langue sélectionnée |
| 344 | 344 | **/ |
| 345 | 345 | function utiliser_langue_site($liste_langues = null) { |
| 346 | - // s'il existe une langue du site (en gros tout le temps en théorie) |
|
| 347 | - if ( |
|
| 348 | - isset($GLOBALS['meta']['langue_site']) |
|
| 349 | - // et si spip_langue est pas encore définie (ce que va faire changer_langue()) |
|
| 350 | - // ou qu'elle n'est pas identique à la langue du site |
|
| 351 | - and (!isset($GLOBALS['spip_lang']) |
|
| 352 | - or $GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site']) |
|
| 353 | - ) { |
|
| 354 | - return changer_langue($GLOBALS['meta']['langue_site'], $liste_langues);//@:install |
|
| 355 | - } |
|
| 356 | - // en theorie là, la globale est définie, sinon c'est un problème. |
|
| 357 | - if (!isset($GLOBALS['spip_lang'])) { |
|
| 358 | - spip_log('La globale spip_lang est indéfinie dans utiliser_langue_site() !', _LOG_ERREUR); |
|
| 359 | - } |
|
| 360 | - |
|
| 361 | - return $GLOBALS['spip_lang']; |
|
| 346 | + // s'il existe une langue du site (en gros tout le temps en théorie) |
|
| 347 | + if ( |
|
| 348 | + isset($GLOBALS['meta']['langue_site']) |
|
| 349 | + // et si spip_langue est pas encore définie (ce que va faire changer_langue()) |
|
| 350 | + // ou qu'elle n'est pas identique à la langue du site |
|
| 351 | + and (!isset($GLOBALS['spip_lang']) |
|
| 352 | + or $GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site']) |
|
| 353 | + ) { |
|
| 354 | + return changer_langue($GLOBALS['meta']['langue_site'], $liste_langues);//@:install |
|
| 355 | + } |
|
| 356 | + // en theorie là, la globale est définie, sinon c'est un problème. |
|
| 357 | + if (!isset($GLOBALS['spip_lang'])) { |
|
| 358 | + spip_log('La globale spip_lang est indéfinie dans utiliser_langue_site() !', _LOG_ERREUR); |
|
| 359 | + } |
|
| 360 | + |
|
| 361 | + return $GLOBALS['spip_lang']; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | /** |
@@ -377,35 +377,35 @@ discard block |
||
| 377 | 377 | **/ |
| 378 | 378 | function utiliser_langue_visiteur($liste_langues = null) { |
| 379 | 379 | |
| 380 | - // si on est dans l'espace public et pas de $liste_langues : se limiter a la config langues_multilingue si définie |
|
| 381 | - if (is_null($liste_langues) and !test_espace_prive() and !empty($GLOBALS['meta']['langues_multilingue'])) { |
|
| 382 | - $liste_langues = $GLOBALS['meta']['langues_multilingue']; |
|
| 383 | - } |
|
| 384 | - |
|
| 385 | - $l = (!test_espace_prive() ? 'spip_lang' : 'spip_lang_ecrire'); |
|
| 386 | - if (isset($_COOKIE[$l])) { |
|
| 387 | - if (changer_langue($l = $_COOKIE[$l], $liste_langues)) { |
|
| 388 | - return $l; |
|
| 389 | - } |
|
| 390 | - } |
|
| 391 | - |
|
| 392 | - if (isset($GLOBALS['visiteur_session']['lang'])) { |
|
| 393 | - if (changer_langue($l = $GLOBALS['visiteur_session']['lang'], $liste_langues)) { |
|
| 394 | - return $l; |
|
| 395 | - } |
|
| 396 | - } |
|
| 397 | - |
|
| 398 | - if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
| 399 | - foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $s) { |
|
| 400 | - if (preg_match('#^([a-z]{2,3})(-[a-z]{2,3})?(;q=[0-9.]+)?$#i', trim($s), $r)) { |
|
| 401 | - if (changer_langue($l = strtolower($r[1]), $liste_langues)) { |
|
| 402 | - return $l; |
|
| 403 | - } |
|
| 404 | - } |
|
| 405 | - } |
|
| 406 | - } |
|
| 407 | - |
|
| 408 | - return utiliser_langue_site($liste_langues); |
|
| 380 | + // si on est dans l'espace public et pas de $liste_langues : se limiter a la config langues_multilingue si définie |
|
| 381 | + if (is_null($liste_langues) and !test_espace_prive() and !empty($GLOBALS['meta']['langues_multilingue'])) { |
|
| 382 | + $liste_langues = $GLOBALS['meta']['langues_multilingue']; |
|
| 383 | + } |
|
| 384 | + |
|
| 385 | + $l = (!test_espace_prive() ? 'spip_lang' : 'spip_lang_ecrire'); |
|
| 386 | + if (isset($_COOKIE[$l])) { |
|
| 387 | + if (changer_langue($l = $_COOKIE[$l], $liste_langues)) { |
|
| 388 | + return $l; |
|
| 389 | + } |
|
| 390 | + } |
|
| 391 | + |
|
| 392 | + if (isset($GLOBALS['visiteur_session']['lang'])) { |
|
| 393 | + if (changer_langue($l = $GLOBALS['visiteur_session']['lang'], $liste_langues)) { |
|
| 394 | + return $l; |
|
| 395 | + } |
|
| 396 | + } |
|
| 397 | + |
|
| 398 | + if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
| 399 | + foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $s) { |
|
| 400 | + if (preg_match('#^([a-z]{2,3})(-[a-z]{2,3})?(;q=[0-9.]+)?$#i', trim($s), $r)) { |
|
| 401 | + if (changer_langue($l = strtolower($r[1]), $liste_langues)) { |
|
| 402 | + return $l; |
|
| 403 | + } |
|
| 404 | + } |
|
| 405 | + } |
|
| 406 | + } |
|
| 407 | + |
|
| 408 | + return utiliser_langue_site($liste_langues); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | * @return int |
| 416 | 416 | */ |
| 417 | 417 | function match_langue($chaine) { |
| 418 | - return preg_match('/^[a-z]{2,3}(_[a-z]{2,3}){0,2}$/', $chaine); |
|
| 418 | + return preg_match('/^[a-z]{2,3}(_[a-z]{2,3}){0,2}$/', $chaine); |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | /** |
@@ -433,36 +433,36 @@ discard block |
||
| 433 | 433 | **/ |
| 434 | 434 | function init_langues() { |
| 435 | 435 | |
| 436 | - // liste des langues dans les meta, sauf a l'install |
|
| 437 | - $all_langs = $GLOBALS['meta']['langues_proposees'] ?? ''; |
|
| 438 | - |
|
| 439 | - $tout = []; |
|
| 440 | - if (!$all_langs) { |
|
| 441 | - // trouver tous les modules lang/spip_xx.php |
|
| 442 | - $modules = find_all_in_path('lang/', '/spip_([a-z_]+)\.php$'); |
|
| 443 | - foreach ($modules as $name => $path) { |
|
| 444 | - if (preg_match(',^spip_([a-z_]+)\.php$,', $name, $regs)) { |
|
| 445 | - if (match_langue($regs[1])) { |
|
| 446 | - $tout[] = $regs[1]; |
|
| 447 | - } |
|
| 448 | - } |
|
| 449 | - } |
|
| 450 | - sort($tout); |
|
| 451 | - $tout = join(',', $tout); |
|
| 452 | - // Si les langues n'ont pas change, ne rien faire |
|
| 453 | - if ($tout != $all_langs) { |
|
| 454 | - $GLOBALS['meta']['langues_proposees'] = $tout; |
|
| 455 | - include_spip('inc/meta'); |
|
| 456 | - ecrire_meta('langues_proposees', $tout); |
|
| 457 | - } |
|
| 458 | - } |
|
| 459 | - if (!isset($GLOBALS['meta']['langue_site'])) { |
|
| 460 | - // Initialisation : le francais si dispo, sinon la premiere langue trouvee |
|
| 461 | - $GLOBALS['meta']['langue_site'] = $tout = |
|
| 462 | - (!$all_langs or (strpos(',' . _LANGUE_PAR_DEFAUT . ',', (string) ",$all_langs,") !== false)) |
|
| 463 | - ? _LANGUE_PAR_DEFAUT : substr($all_langs, 0, strpos($all_langs, ',')); |
|
| 464 | - ecrire_meta('langue_site', $tout); |
|
| 465 | - } |
|
| 436 | + // liste des langues dans les meta, sauf a l'install |
|
| 437 | + $all_langs = $GLOBALS['meta']['langues_proposees'] ?? ''; |
|
| 438 | + |
|
| 439 | + $tout = []; |
|
| 440 | + if (!$all_langs) { |
|
| 441 | + // trouver tous les modules lang/spip_xx.php |
|
| 442 | + $modules = find_all_in_path('lang/', '/spip_([a-z_]+)\.php$'); |
|
| 443 | + foreach ($modules as $name => $path) { |
|
| 444 | + if (preg_match(',^spip_([a-z_]+)\.php$,', $name, $regs)) { |
|
| 445 | + if (match_langue($regs[1])) { |
|
| 446 | + $tout[] = $regs[1]; |
|
| 447 | + } |
|
| 448 | + } |
|
| 449 | + } |
|
| 450 | + sort($tout); |
|
| 451 | + $tout = join(',', $tout); |
|
| 452 | + // Si les langues n'ont pas change, ne rien faire |
|
| 453 | + if ($tout != $all_langs) { |
|
| 454 | + $GLOBALS['meta']['langues_proposees'] = $tout; |
|
| 455 | + include_spip('inc/meta'); |
|
| 456 | + ecrire_meta('langues_proposees', $tout); |
|
| 457 | + } |
|
| 458 | + } |
|
| 459 | + if (!isset($GLOBALS['meta']['langue_site'])) { |
|
| 460 | + // Initialisation : le francais si dispo, sinon la premiere langue trouvee |
|
| 461 | + $GLOBALS['meta']['langue_site'] = $tout = |
|
| 462 | + (!$all_langs or (strpos(',' . _LANGUE_PAR_DEFAUT . ',', (string) ",$all_langs,") !== false)) |
|
| 463 | + ? _LANGUE_PAR_DEFAUT : substr($all_langs, 0, strpos($all_langs, ',')); |
|
| 464 | + ecrire_meta('langue_site', $tout); |
|
| 465 | + } |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
@@ -476,10 +476,10 @@ discard block |
||
| 476 | 476 | * Code html de la balise <html> |
| 477 | 477 | **/ |
| 478 | 478 | function html_lang_attributes() { |
| 479 | - $lang = $GLOBALS['spip_lang']; |
|
| 480 | - $dir = lang_dir($lang); |
|
| 479 | + $lang = $GLOBALS['spip_lang']; |
|
| 480 | + $dir = lang_dir($lang); |
|
| 481 | 481 | |
| 482 | - return "<html class='$dir $lang no-js' xmlns='http://www.w3.org/1999/xhtml' lang='$lang' dir='$dir'>\n"; |
|
| 482 | + return "<html class='$dir $lang no-js' xmlns='http://www.w3.org/1999/xhtml' lang='$lang' dir='$dir'>\n"; |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * @return string |
| 494 | 494 | */ |
| 495 | 495 | function aide_lang_dir($spip_lang, $spip_lang_rtl) { |
| 496 | - return ($spip_lang <> 'he') ? $spip_lang_rtl : ''; |
|
| 496 | + return ($spip_lang <> 'he') ? $spip_lang_rtl : ''; |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | |
@@ -381,8 +381,7 @@ |
||
| 381 | 381 | function executer_balise_dynamique_dans_un_modele(...$args) { |
| 382 | 382 | if (test_espace_prive()) { |
| 383 | 383 | return executer_balise_dynamique(...$args); |
| 384 | - } |
|
| 385 | - else { |
|
| 384 | + } else { |
|
| 386 | 385 | $str_args = base64_encode(serialize($args)); |
| 387 | 386 | return "<?" . "php \$_zargs=unserialize(base64_decode('$str_args'));echo executer_balise_dynamique(...\$_zargs); ?".">\n"; |
| 388 | 387 | } |
@@ -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 | include_spip('inc/texte'); |
@@ -41,234 +41,234 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | function public_composer_dist($squelette, $mime_type, $gram, $source, string $connect = '') { |
| 43 | 43 | |
| 44 | - $skel = null; |
|
| 45 | - $boucle = null; |
|
| 46 | - $nom = calculer_nom_fonction_squel($squelette, $mime_type, $connect); |
|
| 47 | - |
|
| 48 | - // si deja en memoire (INCLURE a repetition) c'est bon. |
|
| 49 | - if (function_exists($nom)) { |
|
| 50 | - return $nom; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
|
| 54 | - $GLOBALS['debug_objets']['courant'] = $nom; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - $phpfile = sous_repertoire(_DIR_SKELS, '', false, true) . $nom . '.php'; |
|
| 58 | - |
|
| 59 | - // si squelette est deja compile et perenne, le charger |
|
| 60 | - if (!squelette_obsolete($phpfile, $source)) { |
|
| 61 | - include_once $phpfile; |
|
| 62 | - #if (!squelette_obsolete($phpfile, $source) |
|
| 63 | - # AND lire_fichier ($phpfile, $skel_code, |
|
| 64 | - # array('critique' => 'oui', 'phpcheck' => 'oui'))){ |
|
| 65 | - ## eval('?'.'>'.$skel_code); |
|
| 66 | - # spip_log($skel_code, 'comp') |
|
| 67 | - #} |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - if (file_exists($lib = $squelette . '_fonctions' . '.php')) { |
|
| 71 | - include_once $lib; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - // tester si le eval ci-dessus a mis le squelette en memoire |
|
| 75 | - |
|
| 76 | - if (function_exists($nom)) { |
|
| 77 | - return $nom; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - // charger le source, si possible, et compiler |
|
| 81 | - $skel_code = ''; |
|
| 82 | - if (lire_fichier($source, $skel)) { |
|
| 83 | - $compiler = charger_fonction('compiler', 'public'); |
|
| 84 | - $skel_code = $compiler($skel, $nom, $gram, $source, $connect); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - // Ne plus rien faire si le compilateur n'a pas pu operer. |
|
| 88 | - if (!$skel_code) { |
|
| 89 | - return false; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - foreach ($skel_code as $id => $boucle) { |
|
| 93 | - $f = $boucle->return; |
|
| 94 | - try { |
|
| 95 | - eval("return true; $f ;"); |
|
| 96 | - } catch (\ParseError $e) { |
|
| 97 | - // Code syntaxiquement faux (critere etc mal programme') |
|
| 98 | - $msg = _T('zbug_erreur_compilation') . ' | Line ' . $e->getLine() . ' : ' . $e->getMessage(); |
|
| 99 | - erreur_squelette($msg, $boucle); |
|
| 100 | - // continuer pour trouver d'autres fautes eventuelles |
|
| 101 | - // mais prevenir que c'est mort |
|
| 102 | - $nom = ''; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - // contexte de compil inutile a present |
|
| 106 | - // (mais la derniere valeur de $boucle est utilisee ci-dessous) |
|
| 107 | - $skel_code[$id] = $f; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - $code = ''; |
|
| 111 | - if ($nom) { |
|
| 112 | - // Si le code est bon, concatener et mettre en cache |
|
| 113 | - if (function_exists($nom)) { |
|
| 114 | - $code = squelette_traduit($skel, $source, $phpfile, $skel_code); |
|
| 115 | - } else { |
|
| 116 | - // code semantiquement faux: bug du compilateur |
|
| 117 | - // $boucle est en fait ici la fct principale du squelette |
|
| 118 | - $msg = _T('zbug_erreur_compilation'); |
|
| 119 | - erreur_squelette($msg, $boucle); |
|
| 120 | - $nom = ''; |
|
| 121 | - } |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
|
| 125 | - // Tracer ce qui vient d'etre compile |
|
| 126 | - $GLOBALS['debug_objets']['code'][$nom . 'tout'] = $code; |
|
| 127 | - |
|
| 128 | - // si c'est ce que demande le debusqueur, lui passer la main |
|
| 129 | - if ( |
|
| 130 | - $GLOBALS['debug_objets']['sourcefile'] |
|
| 131 | - and (_request('var_mode_objet') == $nom) |
|
| 132 | - and (_request('var_mode_affiche') == 'code') |
|
| 133 | - ) { |
|
| 134 | - erreur_squelette(); |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - return $nom ?: false; |
|
| 44 | + $skel = null; |
|
| 45 | + $boucle = null; |
|
| 46 | + $nom = calculer_nom_fonction_squel($squelette, $mime_type, $connect); |
|
| 47 | + |
|
| 48 | + // si deja en memoire (INCLURE a repetition) c'est bon. |
|
| 49 | + if (function_exists($nom)) { |
|
| 50 | + return $nom; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
|
| 54 | + $GLOBALS['debug_objets']['courant'] = $nom; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + $phpfile = sous_repertoire(_DIR_SKELS, '', false, true) . $nom . '.php'; |
|
| 58 | + |
|
| 59 | + // si squelette est deja compile et perenne, le charger |
|
| 60 | + if (!squelette_obsolete($phpfile, $source)) { |
|
| 61 | + include_once $phpfile; |
|
| 62 | + #if (!squelette_obsolete($phpfile, $source) |
|
| 63 | + # AND lire_fichier ($phpfile, $skel_code, |
|
| 64 | + # array('critique' => 'oui', 'phpcheck' => 'oui'))){ |
|
| 65 | + ## eval('?'.'>'.$skel_code); |
|
| 66 | + # spip_log($skel_code, 'comp') |
|
| 67 | + #} |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + if (file_exists($lib = $squelette . '_fonctions' . '.php')) { |
|
| 71 | + include_once $lib; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + // tester si le eval ci-dessus a mis le squelette en memoire |
|
| 75 | + |
|
| 76 | + if (function_exists($nom)) { |
|
| 77 | + return $nom; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + // charger le source, si possible, et compiler |
|
| 81 | + $skel_code = ''; |
|
| 82 | + if (lire_fichier($source, $skel)) { |
|
| 83 | + $compiler = charger_fonction('compiler', 'public'); |
|
| 84 | + $skel_code = $compiler($skel, $nom, $gram, $source, $connect); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + // Ne plus rien faire si le compilateur n'a pas pu operer. |
|
| 88 | + if (!$skel_code) { |
|
| 89 | + return false; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + foreach ($skel_code as $id => $boucle) { |
|
| 93 | + $f = $boucle->return; |
|
| 94 | + try { |
|
| 95 | + eval("return true; $f ;"); |
|
| 96 | + } catch (\ParseError $e) { |
|
| 97 | + // Code syntaxiquement faux (critere etc mal programme') |
|
| 98 | + $msg = _T('zbug_erreur_compilation') . ' | Line ' . $e->getLine() . ' : ' . $e->getMessage(); |
|
| 99 | + erreur_squelette($msg, $boucle); |
|
| 100 | + // continuer pour trouver d'autres fautes eventuelles |
|
| 101 | + // mais prevenir que c'est mort |
|
| 102 | + $nom = ''; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + // contexte de compil inutile a present |
|
| 106 | + // (mais la derniere valeur de $boucle est utilisee ci-dessous) |
|
| 107 | + $skel_code[$id] = $f; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + $code = ''; |
|
| 111 | + if ($nom) { |
|
| 112 | + // Si le code est bon, concatener et mettre en cache |
|
| 113 | + if (function_exists($nom)) { |
|
| 114 | + $code = squelette_traduit($skel, $source, $phpfile, $skel_code); |
|
| 115 | + } else { |
|
| 116 | + // code semantiquement faux: bug du compilateur |
|
| 117 | + // $boucle est en fait ici la fct principale du squelette |
|
| 118 | + $msg = _T('zbug_erreur_compilation'); |
|
| 119 | + erreur_squelette($msg, $boucle); |
|
| 120 | + $nom = ''; |
|
| 121 | + } |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
|
| 125 | + // Tracer ce qui vient d'etre compile |
|
| 126 | + $GLOBALS['debug_objets']['code'][$nom . 'tout'] = $code; |
|
| 127 | + |
|
| 128 | + // si c'est ce que demande le debusqueur, lui passer la main |
|
| 129 | + if ( |
|
| 130 | + $GLOBALS['debug_objets']['sourcefile'] |
|
| 131 | + and (_request('var_mode_objet') == $nom) |
|
| 132 | + and (_request('var_mode_affiche') == 'code') |
|
| 133 | + ) { |
|
| 134 | + erreur_squelette(); |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + return $nom ?: false; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | function squelette_traduit($squelette, $sourcefile, $phpfile, $boucles) { |
| 142 | 142 | |
| 143 | - $code = null; |
|
| 144 | - // Le dernier index est '' (fonction principale) |
|
| 145 | - $noms = substr(join(', ', array_keys($boucles)), 0, -2); |
|
| 146 | - if (CODE_COMMENTE) { |
|
| 147 | - $code = " |
|
| 143 | + $code = null; |
|
| 144 | + // Le dernier index est '' (fonction principale) |
|
| 145 | + $noms = substr(join(', ', array_keys($boucles)), 0, -2); |
|
| 146 | + if (CODE_COMMENTE) { |
|
| 147 | + $code = " |
|
| 148 | 148 | /* |
| 149 | 149 | * Squelette : $sourcefile |
| 150 | 150 | * Date : " . gmdate('D, d M Y H:i:s', @filemtime($sourcefile)) . ' GMT |
| 151 | 151 | * Compile : ' . gmdate('D, d M Y H:i:s', time()) . ' GMT |
| 152 | 152 | * ' . (!$boucles ? 'Pas de boucle' : ('Boucles : ' . $noms)) . ' |
| 153 | 153 | */ '; |
| 154 | - } |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - $code = '<' . "?php\n" . $code . join('', $boucles) . "\n"; |
|
| 157 | - if (!defined('_VAR_NOCACHE') or !_VAR_NOCACHE) { |
|
| 158 | - ecrire_fichier($phpfile, $code); |
|
| 159 | - } |
|
| 156 | + $code = '<' . "?php\n" . $code . join('', $boucles) . "\n"; |
|
| 157 | + if (!defined('_VAR_NOCACHE') or !_VAR_NOCACHE) { |
|
| 158 | + ecrire_fichier($phpfile, $code); |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - return $code; |
|
| 161 | + return $code; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // Le squelette compile est-il trop vieux ? |
| 165 | 165 | function squelette_obsolete($skel, $squelette) { |
| 166 | - static $date_change = null; |
|
| 167 | - // ne verifier la date de mes_fonctions et mes_options qu'une seule fois |
|
| 168 | - // par hit |
|
| 169 | - if (is_null($date_change)) { |
|
| 170 | - if (@file_exists($fonc = 'mes_fonctions.php')) { |
|
| 171 | - $date_change = @filemtime($fonc); |
|
| 172 | - } # compatibilite |
|
| 173 | - if (defined('_FILE_OPTIONS')) { |
|
| 174 | - $date_change = max($date_change, @filemtime(_FILE_OPTIONS)); |
|
| 175 | - } |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - return ( |
|
| 179 | - (defined('_VAR_MODE') and in_array(_VAR_MODE, ['recalcul', 'preview', 'debug'])) |
|
| 180 | - or !@file_exists($skel) |
|
| 181 | - or ((@file_exists($squelette) ? @filemtime($squelette) : 0) |
|
| 182 | - > ($date = @filemtime($skel))) |
|
| 183 | - or ($date_change > $date) |
|
| 184 | - ); |
|
| 166 | + static $date_change = null; |
|
| 167 | + // ne verifier la date de mes_fonctions et mes_options qu'une seule fois |
|
| 168 | + // par hit |
|
| 169 | + if (is_null($date_change)) { |
|
| 170 | + if (@file_exists($fonc = 'mes_fonctions.php')) { |
|
| 171 | + $date_change = @filemtime($fonc); |
|
| 172 | + } # compatibilite |
|
| 173 | + if (defined('_FILE_OPTIONS')) { |
|
| 174 | + $date_change = max($date_change, @filemtime(_FILE_OPTIONS)); |
|
| 175 | + } |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + return ( |
|
| 179 | + (defined('_VAR_MODE') and in_array(_VAR_MODE, ['recalcul', 'preview', 'debug'])) |
|
| 180 | + or !@file_exists($skel) |
|
| 181 | + or ((@file_exists($squelette) ? @filemtime($squelette) : 0) |
|
| 182 | + > ($date = @filemtime($skel))) |
|
| 183 | + or ($date_change > $date) |
|
| 184 | + ); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | // Activer l'invalideur de session |
| 188 | 188 | function invalideur_session(&$Cache, $code = null) { |
| 189 | - $Cache['session'] = spip_session(); |
|
| 189 | + $Cache['session'] = spip_session(); |
|
| 190 | 190 | |
| 191 | - return $code; |
|
| 191 | + return $code; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | function analyse_resultat_skel($nom, $cache, $corps, $source = '') { |
| 196 | - static $filtres = []; |
|
| 197 | - $headers = []; |
|
| 198 | - $corps ??= ''; |
|
| 199 | - |
|
| 200 | - // Recupere les < ?php header('Xx: y'); ? > pour $page['headers'] |
|
| 201 | - // note: on essaie d'attrapper aussi certains de ces entetes codes |
|
| 202 | - // "a la main" dans les squelettes, mais evidemment sans exhaustivite |
|
| 203 | - if ( |
|
| 204 | - stripos($corps, 'header') !== false |
|
| 205 | - and preg_match_all( |
|
| 206 | - '/(<[?]php\s+)@?header\s*\(\s*.([^:\'"]*):?\s*([^)]*)[^)]\s*\)\s*[;]?\s*[?]>/ims', |
|
| 207 | - $corps, |
|
| 208 | - $regs, |
|
| 209 | - PREG_SET_ORDER |
|
| 210 | - ) |
|
| 211 | - ) { |
|
| 212 | - foreach ($regs as $r) { |
|
| 213 | - $corps = str_replace($r[0], '', $corps); |
|
| 214 | - # $j = Content-Type, et pas content-TYPE. |
|
| 215 | - $j = join('-', array_map('ucwords', explode('-', strtolower($r[2])))); |
|
| 216 | - |
|
| 217 | - if ($j == 'X-Spip-Filtre' and isset($headers[$j])) { |
|
| 218 | - $headers[$j] .= '|' . $r[3]; |
|
| 219 | - } else { |
|
| 220 | - $headers[$j] = str_replace(['\\\\',"\\'",'\\"'], ['\\',"'",'"'], $r[3]); |
|
| 221 | - } |
|
| 222 | - } |
|
| 223 | - } |
|
| 224 | - // S'agit-il d'un resultat constant ou contenant du code php |
|
| 225 | - $process_ins = ( |
|
| 226 | - strpos($corps, '<' . '?') === false |
|
| 227 | - or |
|
| 228 | - (strpos($corps, '<' . '?xml') !== false and |
|
| 229 | - strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 230 | - ) |
|
| 231 | - ? 'html' |
|
| 232 | - : 'php'; |
|
| 233 | - |
|
| 234 | - $skel = [ |
|
| 235 | - 'squelette' => $nom, |
|
| 236 | - 'source' => $source, |
|
| 237 | - 'process_ins' => $process_ins, |
|
| 238 | - 'invalideurs' => $cache, |
|
| 239 | - 'entetes' => $headers, |
|
| 240 | - 'duree' => isset($headers['X-Spip-Cache']) ? intval($headers['X-Spip-Cache']) : 0 |
|
| 241 | - ]; |
|
| 242 | - |
|
| 243 | - // traiter #FILTRE{} et filtres |
|
| 244 | - if (!isset($filtres[$nom])) { |
|
| 245 | - $filtres[$nom] = pipeline('declarer_filtres_squelettes', ['args' => $skel, 'data' => []]); |
|
| 246 | - } |
|
| 247 | - $filtres_headers = []; |
|
| 248 | - if (isset($headers['X-Spip-Filtre']) and strlen($headers['X-Spip-Filtre'])) { |
|
| 249 | - $filtres_headers = array_filter(explode('|', $headers['X-Spip-Filtre'])); |
|
| 250 | - unset($headers['X-Spip-Filtre']); |
|
| 251 | - } |
|
| 252 | - if (is_array($filtres[$nom]) || $filtres[$nom] instanceof \Countable ? count($filtres[$nom]) : 0 or count($filtres_headers)) { |
|
| 253 | - include_spip('public/sandbox'); |
|
| 254 | - $corps = sandbox_filtrer_squelette($skel, $corps, $filtres_headers, $filtres[$nom]); |
|
| 255 | - |
|
| 256 | - if ($process_ins == 'html') { |
|
| 257 | - $skel['process_ins'] = ( |
|
| 258 | - strpos($corps, '<' . '?') === false |
|
| 259 | - or |
|
| 260 | - (strpos($corps, '<' . '?xml') !== false and |
|
| 261 | - strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 262 | - ) |
|
| 263 | - ? 'html' |
|
| 264 | - : 'php'; |
|
| 265 | - } |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - $skel['entetes'] = $headers; |
|
| 269 | - $skel['texte'] = $corps; |
|
| 270 | - |
|
| 271 | - return $skel; |
|
| 196 | + static $filtres = []; |
|
| 197 | + $headers = []; |
|
| 198 | + $corps ??= ''; |
|
| 199 | + |
|
| 200 | + // Recupere les < ?php header('Xx: y'); ? > pour $page['headers'] |
|
| 201 | + // note: on essaie d'attrapper aussi certains de ces entetes codes |
|
| 202 | + // "a la main" dans les squelettes, mais evidemment sans exhaustivite |
|
| 203 | + if ( |
|
| 204 | + stripos($corps, 'header') !== false |
|
| 205 | + and preg_match_all( |
|
| 206 | + '/(<[?]php\s+)@?header\s*\(\s*.([^:\'"]*):?\s*([^)]*)[^)]\s*\)\s*[;]?\s*[?]>/ims', |
|
| 207 | + $corps, |
|
| 208 | + $regs, |
|
| 209 | + PREG_SET_ORDER |
|
| 210 | + ) |
|
| 211 | + ) { |
|
| 212 | + foreach ($regs as $r) { |
|
| 213 | + $corps = str_replace($r[0], '', $corps); |
|
| 214 | + # $j = Content-Type, et pas content-TYPE. |
|
| 215 | + $j = join('-', array_map('ucwords', explode('-', strtolower($r[2])))); |
|
| 216 | + |
|
| 217 | + if ($j == 'X-Spip-Filtre' and isset($headers[$j])) { |
|
| 218 | + $headers[$j] .= '|' . $r[3]; |
|
| 219 | + } else { |
|
| 220 | + $headers[$j] = str_replace(['\\\\',"\\'",'\\"'], ['\\',"'",'"'], $r[3]); |
|
| 221 | + } |
|
| 222 | + } |
|
| 223 | + } |
|
| 224 | + // S'agit-il d'un resultat constant ou contenant du code php |
|
| 225 | + $process_ins = ( |
|
| 226 | + strpos($corps, '<' . '?') === false |
|
| 227 | + or |
|
| 228 | + (strpos($corps, '<' . '?xml') !== false and |
|
| 229 | + strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 230 | + ) |
|
| 231 | + ? 'html' |
|
| 232 | + : 'php'; |
|
| 233 | + |
|
| 234 | + $skel = [ |
|
| 235 | + 'squelette' => $nom, |
|
| 236 | + 'source' => $source, |
|
| 237 | + 'process_ins' => $process_ins, |
|
| 238 | + 'invalideurs' => $cache, |
|
| 239 | + 'entetes' => $headers, |
|
| 240 | + 'duree' => isset($headers['X-Spip-Cache']) ? intval($headers['X-Spip-Cache']) : 0 |
|
| 241 | + ]; |
|
| 242 | + |
|
| 243 | + // traiter #FILTRE{} et filtres |
|
| 244 | + if (!isset($filtres[$nom])) { |
|
| 245 | + $filtres[$nom] = pipeline('declarer_filtres_squelettes', ['args' => $skel, 'data' => []]); |
|
| 246 | + } |
|
| 247 | + $filtres_headers = []; |
|
| 248 | + if (isset($headers['X-Spip-Filtre']) and strlen($headers['X-Spip-Filtre'])) { |
|
| 249 | + $filtres_headers = array_filter(explode('|', $headers['X-Spip-Filtre'])); |
|
| 250 | + unset($headers['X-Spip-Filtre']); |
|
| 251 | + } |
|
| 252 | + if (is_array($filtres[$nom]) || $filtres[$nom] instanceof \Countable ? count($filtres[$nom]) : 0 or count($filtres_headers)) { |
|
| 253 | + include_spip('public/sandbox'); |
|
| 254 | + $corps = sandbox_filtrer_squelette($skel, $corps, $filtres_headers, $filtres[$nom]); |
|
| 255 | + |
|
| 256 | + if ($process_ins == 'html') { |
|
| 257 | + $skel['process_ins'] = ( |
|
| 258 | + strpos($corps, '<' . '?') === false |
|
| 259 | + or |
|
| 260 | + (strpos($corps, '<' . '?xml') !== false and |
|
| 261 | + strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 262 | + ) |
|
| 263 | + ? 'html' |
|
| 264 | + : 'php'; |
|
| 265 | + } |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + $skel['entetes'] = $headers; |
|
| 269 | + $skel['texte'] = $corps; |
|
| 270 | + |
|
| 271 | + return $skel; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | // |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | inserer_balise_dynamique(balise_%s_dyn(%s), array(%s)); |
| 283 | 283 | if ($lang_select) lang_select(); |
| 284 | 284 | ?' |
| 285 | - . '>'); |
|
| 285 | + . '>'); |
|
| 286 | 286 | |
| 287 | 287 | /** |
| 288 | 288 | * Synthétise une balise dynamique : crée l'appel à l'inclusion |
@@ -302,35 +302,35 @@ discard block |
||
| 302 | 302 | * Code PHP pour inclure le squelette de la balise dynamique |
| 303 | 303 | **/ |
| 304 | 304 | function synthetiser_balise_dynamique($nom, $args, $file, $context_compil) { |
| 305 | - if ( |
|
| 306 | - strncmp($file, '/', 1) !== 0 |
|
| 307 | - // pas de lien symbolique sous Windows |
|
| 308 | - and !(stristr(PHP_OS, 'WIN') and str_contains($file, ':')) |
|
| 309 | - ) { |
|
| 310 | - $file = './" . _DIR_RACINE . "' . $file; |
|
| 311 | - } |
|
| 312 | - |
|
| 313 | - $lang = $context_compil[4]; |
|
| 314 | - if (preg_match(',\W,', $lang)) { |
|
| 315 | - $lang = ''; |
|
| 316 | - } |
|
| 317 | - |
|
| 318 | - $args = array_map('argumenter_squelette', $args); |
|
| 319 | - if (!empty($context_compil['appel_php_depuis_modele'])) { |
|
| 320 | - $args[0] = 'arguments_balise_dyn_depuis_modele(' . $args[0] . ')'; |
|
| 321 | - } |
|
| 322 | - $args = join(', ', $args); |
|
| 323 | - |
|
| 324 | - $r = sprintf( |
|
| 325 | - CODE_INCLURE_BALISE, |
|
| 326 | - $file, |
|
| 327 | - $lang, |
|
| 328 | - $nom, |
|
| 329 | - $args, |
|
| 330 | - join(', ', array_map('_q', $context_compil)) |
|
| 331 | - ); |
|
| 332 | - |
|
| 333 | - return $r; |
|
| 305 | + if ( |
|
| 306 | + strncmp($file, '/', 1) !== 0 |
|
| 307 | + // pas de lien symbolique sous Windows |
|
| 308 | + and !(stristr(PHP_OS, 'WIN') and str_contains($file, ':')) |
|
| 309 | + ) { |
|
| 310 | + $file = './" . _DIR_RACINE . "' . $file; |
|
| 311 | + } |
|
| 312 | + |
|
| 313 | + $lang = $context_compil[4]; |
|
| 314 | + if (preg_match(',\W,', $lang)) { |
|
| 315 | + $lang = ''; |
|
| 316 | + } |
|
| 317 | + |
|
| 318 | + $args = array_map('argumenter_squelette', $args); |
|
| 319 | + if (!empty($context_compil['appel_php_depuis_modele'])) { |
|
| 320 | + $args[0] = 'arguments_balise_dyn_depuis_modele(' . $args[0] . ')'; |
|
| 321 | + } |
|
| 322 | + $args = join(', ', $args); |
|
| 323 | + |
|
| 324 | + $r = sprintf( |
|
| 325 | + CODE_INCLURE_BALISE, |
|
| 326 | + $file, |
|
| 327 | + $lang, |
|
| 328 | + $nom, |
|
| 329 | + $args, |
|
| 330 | + join(', ', array_map('_q', $context_compil)) |
|
| 331 | + ); |
|
| 332 | + |
|
| 333 | + return $r; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | /** |
@@ -348,18 +348,18 @@ discard block |
||
| 348 | 348 | **/ |
| 349 | 349 | function argumenter_squelette($v) { |
| 350 | 350 | |
| 351 | - if (is_object($v)) { |
|
| 352 | - return var_export($v, true); |
|
| 353 | - } elseif (!is_array($v)) { |
|
| 354 | - return "'" . texte_script((string) $v) . "'"; |
|
| 355 | - } else { |
|
| 356 | - $out = []; |
|
| 357 | - foreach ($v as $k => $val) { |
|
| 358 | - $out [] = argumenter_squelette($k) . '=>' . argumenter_squelette($val); |
|
| 359 | - } |
|
| 360 | - |
|
| 361 | - return 'array(' . join(', ', $out) . ')'; |
|
| 362 | - } |
|
| 351 | + if (is_object($v)) { |
|
| 352 | + return var_export($v, true); |
|
| 353 | + } elseif (!is_array($v)) { |
|
| 354 | + return "'" . texte_script((string) $v) . "'"; |
|
| 355 | + } else { |
|
| 356 | + $out = []; |
|
| 357 | + foreach ($v as $k => $val) { |
|
| 358 | + $out [] = argumenter_squelette($k) . '=>' . argumenter_squelette($val); |
|
| 359 | + } |
|
| 360 | + |
|
| 361 | + return 'array(' . join(', ', $out) . ')'; |
|
| 362 | + } |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /** |
@@ -378,13 +378,13 @@ discard block |
||
| 378 | 378 | * @return string |
| 379 | 379 | */ |
| 380 | 380 | function executer_balise_dynamique_dans_un_modele(...$args) { |
| 381 | - if (test_espace_prive()) { |
|
| 382 | - return executer_balise_dynamique(...$args); |
|
| 383 | - } |
|
| 384 | - else { |
|
| 385 | - $str_args = base64_encode(serialize($args)); |
|
| 386 | - return "<?" . "php \$_zargs=unserialize(base64_decode('$str_args'));echo executer_balise_dynamique(...\$_zargs); ?".">\n"; |
|
| 387 | - } |
|
| 381 | + if (test_espace_prive()) { |
|
| 382 | + return executer_balise_dynamique(...$args); |
|
| 383 | + } |
|
| 384 | + else { |
|
| 385 | + $str_args = base64_encode(serialize($args)); |
|
| 386 | + return "<?" . "php \$_zargs=unserialize(base64_decode('$str_args'));echo executer_balise_dynamique(...\$_zargs); ?".">\n"; |
|
| 387 | + } |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | |
@@ -415,87 +415,87 @@ discard block |
||
| 415 | 415 | * Code PHP d'exécutant l'inclusion du squelette (ou texte) de la balise dynamique |
| 416 | 416 | **/ |
| 417 | 417 | function executer_balise_dynamique($nom, $args, $context_compil) { |
| 418 | - /** @var string Nom de la balise à charger (balise demandée ou balise générique) */ |
|
| 419 | - $nom_balise = $nom; |
|
| 420 | - /** @var string Nom de la balise générique (si utilisée) */ |
|
| 421 | - $nom_balise_generique = ''; |
|
| 422 | - |
|
| 423 | - $appel_php_depuis_modele = false; |
|
| 424 | - if ( |
|
| 425 | - is_array($context_compil) |
|
| 426 | - and !is_numeric($context_compil[3]) |
|
| 427 | - and empty($context_compil[0]) |
|
| 428 | - and empty($context_compil[1]) |
|
| 429 | - and empty($context_compil[2]) |
|
| 430 | - and empty($context_compil[3]) |
|
| 431 | - ) { |
|
| 432 | - $appel_php_depuis_modele = true; |
|
| 433 | - } |
|
| 434 | - |
|
| 435 | - if (!$fonction_balise = charger_fonction($nom_balise, 'balise', true)) { |
|
| 436 | - // Calculer un nom générique (ie. 'formulaire_' dans 'formulaire_editer_article') |
|
| 437 | - if ($balise_generique = chercher_balise_generique($nom)) { |
|
| 438 | - // injecter en premier arg le nom de la balise |
|
| 439 | - array_unshift($args, $nom); |
|
| 440 | - $nom_balise_generique = $balise_generique['nom_generique']; |
|
| 441 | - $fonction_balise = $balise_generique['fonction_generique']; |
|
| 442 | - $nom_balise = $nom_balise_generique; |
|
| 443 | - } |
|
| 444 | - unset($balise_generique); |
|
| 445 | - } |
|
| 446 | - |
|
| 447 | - if (!$fonction_balise) { |
|
| 448 | - $msg = ['zbug_balise_inexistante', ['from' => 'CVT', 'balise' => $nom]]; |
|
| 449 | - erreur_squelette($msg, $context_compil); |
|
| 450 | - |
|
| 451 | - return ''; |
|
| 452 | - } |
|
| 453 | - |
|
| 454 | - // retrouver le fichier qui a déclaré la fonction |
|
| 455 | - // même si la fonction dynamique est déclarée dans un fichier de fonctions. |
|
| 456 | - // Attention sous windows, getFileName() retourne un antislash. |
|
| 457 | - $reflector = new ReflectionFunction($fonction_balise); |
|
| 458 | - $file = str_replace('\\', '/', $reflector->getFileName()); |
|
| 459 | - if (strncmp($file, str_replace('\\', '/', _ROOT_RACINE), strlen(_ROOT_RACINE)) === 0) { |
|
| 460 | - $file = substr($file, strlen(_ROOT_RACINE)); |
|
| 461 | - } |
|
| 462 | - |
|
| 463 | - // Y a-t-il une fonction de traitement des arguments ? |
|
| 464 | - $f = 'balise_' . $nom_balise . '_stat'; |
|
| 465 | - |
|
| 466 | - $r = !function_exists($f) ? $args : $f($args, $context_compil); |
|
| 467 | - |
|
| 468 | - if (!is_array($r)) { |
|
| 469 | - return $r; |
|
| 470 | - } |
|
| 471 | - |
|
| 472 | - // verifier que la fonction dyn est la, |
|
| 473 | - // sinon se replier sur la generique si elle existe |
|
| 474 | - if (!function_exists('balise_' . $nom_balise . '_dyn')) { |
|
| 475 | - if ( |
|
| 476 | - $balise_generique = chercher_balise_generique($nom) |
|
| 477 | - and $nom_balise_generique = $balise_generique['nom_generique'] |
|
| 478 | - and $file = include_spip('balise/' . strtolower($nom_balise_generique)) |
|
| 479 | - and function_exists('balise_' . $nom_balise_generique . '_dyn') |
|
| 480 | - ) { |
|
| 481 | - // et lui injecter en premier arg le nom de la balise |
|
| 482 | - array_unshift($r, $nom); |
|
| 483 | - $nom_balise = $nom_balise_generique; |
|
| 484 | - if (!_DIR_RESTREINT) { |
|
| 485 | - $file = _DIR_RESTREINT_ABS . $file; |
|
| 486 | - } |
|
| 487 | - } else { |
|
| 488 | - $msg = ['zbug_balise_inexistante', ['from' => 'CVT', 'balise' => $nom]]; |
|
| 489 | - erreur_squelette($msg, $context_compil); |
|
| 490 | - |
|
| 491 | - return ''; |
|
| 492 | - } |
|
| 493 | - } |
|
| 494 | - |
|
| 495 | - if ($appel_php_depuis_modele) { |
|
| 496 | - $context_compil['appel_php_depuis_modele'] = true; |
|
| 497 | - } |
|
| 498 | - return synthetiser_balise_dynamique($nom_balise, $r, $file, $context_compil); |
|
| 418 | + /** @var string Nom de la balise à charger (balise demandée ou balise générique) */ |
|
| 419 | + $nom_balise = $nom; |
|
| 420 | + /** @var string Nom de la balise générique (si utilisée) */ |
|
| 421 | + $nom_balise_generique = ''; |
|
| 422 | + |
|
| 423 | + $appel_php_depuis_modele = false; |
|
| 424 | + if ( |
|
| 425 | + is_array($context_compil) |
|
| 426 | + and !is_numeric($context_compil[3]) |
|
| 427 | + and empty($context_compil[0]) |
|
| 428 | + and empty($context_compil[1]) |
|
| 429 | + and empty($context_compil[2]) |
|
| 430 | + and empty($context_compil[3]) |
|
| 431 | + ) { |
|
| 432 | + $appel_php_depuis_modele = true; |
|
| 433 | + } |
|
| 434 | + |
|
| 435 | + if (!$fonction_balise = charger_fonction($nom_balise, 'balise', true)) { |
|
| 436 | + // Calculer un nom générique (ie. 'formulaire_' dans 'formulaire_editer_article') |
|
| 437 | + if ($balise_generique = chercher_balise_generique($nom)) { |
|
| 438 | + // injecter en premier arg le nom de la balise |
|
| 439 | + array_unshift($args, $nom); |
|
| 440 | + $nom_balise_generique = $balise_generique['nom_generique']; |
|
| 441 | + $fonction_balise = $balise_generique['fonction_generique']; |
|
| 442 | + $nom_balise = $nom_balise_generique; |
|
| 443 | + } |
|
| 444 | + unset($balise_generique); |
|
| 445 | + } |
|
| 446 | + |
|
| 447 | + if (!$fonction_balise) { |
|
| 448 | + $msg = ['zbug_balise_inexistante', ['from' => 'CVT', 'balise' => $nom]]; |
|
| 449 | + erreur_squelette($msg, $context_compil); |
|
| 450 | + |
|
| 451 | + return ''; |
|
| 452 | + } |
|
| 453 | + |
|
| 454 | + // retrouver le fichier qui a déclaré la fonction |
|
| 455 | + // même si la fonction dynamique est déclarée dans un fichier de fonctions. |
|
| 456 | + // Attention sous windows, getFileName() retourne un antislash. |
|
| 457 | + $reflector = new ReflectionFunction($fonction_balise); |
|
| 458 | + $file = str_replace('\\', '/', $reflector->getFileName()); |
|
| 459 | + if (strncmp($file, str_replace('\\', '/', _ROOT_RACINE), strlen(_ROOT_RACINE)) === 0) { |
|
| 460 | + $file = substr($file, strlen(_ROOT_RACINE)); |
|
| 461 | + } |
|
| 462 | + |
|
| 463 | + // Y a-t-il une fonction de traitement des arguments ? |
|
| 464 | + $f = 'balise_' . $nom_balise . '_stat'; |
|
| 465 | + |
|
| 466 | + $r = !function_exists($f) ? $args : $f($args, $context_compil); |
|
| 467 | + |
|
| 468 | + if (!is_array($r)) { |
|
| 469 | + return $r; |
|
| 470 | + } |
|
| 471 | + |
|
| 472 | + // verifier que la fonction dyn est la, |
|
| 473 | + // sinon se replier sur la generique si elle existe |
|
| 474 | + if (!function_exists('balise_' . $nom_balise . '_dyn')) { |
|
| 475 | + if ( |
|
| 476 | + $balise_generique = chercher_balise_generique($nom) |
|
| 477 | + and $nom_balise_generique = $balise_generique['nom_generique'] |
|
| 478 | + and $file = include_spip('balise/' . strtolower($nom_balise_generique)) |
|
| 479 | + and function_exists('balise_' . $nom_balise_generique . '_dyn') |
|
| 480 | + ) { |
|
| 481 | + // et lui injecter en premier arg le nom de la balise |
|
| 482 | + array_unshift($r, $nom); |
|
| 483 | + $nom_balise = $nom_balise_generique; |
|
| 484 | + if (!_DIR_RESTREINT) { |
|
| 485 | + $file = _DIR_RESTREINT_ABS . $file; |
|
| 486 | + } |
|
| 487 | + } else { |
|
| 488 | + $msg = ['zbug_balise_inexistante', ['from' => 'CVT', 'balise' => $nom]]; |
|
| 489 | + erreur_squelette($msg, $context_compil); |
|
| 490 | + |
|
| 491 | + return ''; |
|
| 492 | + } |
|
| 493 | + } |
|
| 494 | + |
|
| 495 | + if ($appel_php_depuis_modele) { |
|
| 496 | + $context_compil['appel_php_depuis_modele'] = true; |
|
| 497 | + } |
|
| 498 | + return synthetiser_balise_dynamique($nom_balise, $r, $file, $context_compil); |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | /** |
@@ -510,23 +510,23 @@ discard block |
||
| 510 | 510 | * @return array|null |
| 511 | 511 | */ |
| 512 | 512 | function chercher_balise_generique($nom) { |
| 513 | - if (!str_contains($nom, '_')) { |
|
| 514 | - return null; |
|
| 515 | - } |
|
| 516 | - $nom_generique = $nom; |
|
| 517 | - while (false !== ($p = strrpos($nom_generique, '_'))) { |
|
| 518 | - $nom_generique = substr($nom_generique, 0, $p + 1); |
|
| 519 | - $fonction_generique = charger_fonction($nom_generique, 'balise', true); |
|
| 520 | - if ($fonction_generique) { |
|
| 521 | - return [ |
|
| 522 | - 'nom' => $nom, |
|
| 523 | - 'nom_generique' => $nom_generique, |
|
| 524 | - 'fonction_generique' => $fonction_generique, |
|
| 525 | - ]; |
|
| 526 | - } |
|
| 527 | - $nom_generique = substr($nom_generique, 0, -1); |
|
| 528 | - } |
|
| 529 | - return null; |
|
| 513 | + if (!str_contains($nom, '_')) { |
|
| 514 | + return null; |
|
| 515 | + } |
|
| 516 | + $nom_generique = $nom; |
|
| 517 | + while (false !== ($p = strrpos($nom_generique, '_'))) { |
|
| 518 | + $nom_generique = substr($nom_generique, 0, $p + 1); |
|
| 519 | + $fonction_generique = charger_fonction($nom_generique, 'balise', true); |
|
| 520 | + if ($fonction_generique) { |
|
| 521 | + return [ |
|
| 522 | + 'nom' => $nom, |
|
| 523 | + 'nom_generique' => $nom_generique, |
|
| 524 | + 'fonction_generique' => $fonction_generique, |
|
| 525 | + ]; |
|
| 526 | + } |
|
| 527 | + $nom_generique = substr($nom_generique, 0, -1); |
|
| 528 | + } |
|
| 529 | + return null; |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | |
@@ -550,50 +550,50 @@ discard block |
||
| 550 | 550 | * @return null; |
| 551 | 551 | **/ |
| 552 | 552 | function lang_select_public($lang, $lang_select, $titre = null) { |
| 553 | - // Cas 1. forcer_lang = true et pas de critere {lang_select} |
|
| 554 | - if ( |
|
| 555 | - isset($GLOBALS['forcer_lang']) and $GLOBALS['forcer_lang'] |
|
| 556 | - and $lang_select !== 'oui' |
|
| 557 | - ) { |
|
| 558 | - $lang = $GLOBALS['spip_lang']; |
|
| 559 | - } // Cas 2. l'objet n'a pas de langue definie (ou definie a '') |
|
| 560 | - elseif (!strlen($lang)) { |
|
| 561 | - $lang = $GLOBALS['spip_lang']; |
|
| 562 | - } // Cas 3. l'objet est multilingue ! |
|
| 563 | - elseif ( |
|
| 564 | - $lang_select !== 'oui' |
|
| 565 | - and strlen($titre) > 10 |
|
| 566 | - and str_contains($titre, '<multi>') |
|
| 567 | - and str_contains(echappe_html($titre), '<multi>') |
|
| 568 | - ) { |
|
| 569 | - $lang = $GLOBALS['spip_lang']; |
|
| 570 | - } |
|
| 571 | - |
|
| 572 | - // faire un lang_select() eventuellement sur la langue inchangee |
|
| 573 | - lang_select($lang); |
|
| 574 | - |
|
| 575 | - return; |
|
| 553 | + // Cas 1. forcer_lang = true et pas de critere {lang_select} |
|
| 554 | + if ( |
|
| 555 | + isset($GLOBALS['forcer_lang']) and $GLOBALS['forcer_lang'] |
|
| 556 | + and $lang_select !== 'oui' |
|
| 557 | + ) { |
|
| 558 | + $lang = $GLOBALS['spip_lang']; |
|
| 559 | + } // Cas 2. l'objet n'a pas de langue definie (ou definie a '') |
|
| 560 | + elseif (!strlen($lang)) { |
|
| 561 | + $lang = $GLOBALS['spip_lang']; |
|
| 562 | + } // Cas 3. l'objet est multilingue ! |
|
| 563 | + elseif ( |
|
| 564 | + $lang_select !== 'oui' |
|
| 565 | + and strlen($titre) > 10 |
|
| 566 | + and str_contains($titre, '<multi>') |
|
| 567 | + and str_contains(echappe_html($titre), '<multi>') |
|
| 568 | + ) { |
|
| 569 | + $lang = $GLOBALS['spip_lang']; |
|
| 570 | + } |
|
| 571 | + |
|
| 572 | + // faire un lang_select() eventuellement sur la langue inchangee |
|
| 573 | + lang_select($lang); |
|
| 574 | + |
|
| 575 | + return; |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | |
| 579 | 579 | // Si un tableau &doublons[articles] est passe en parametre, |
| 580 | 580 | // il faut le nettoyer car il pourrait etre injecte en SQL |
| 581 | 581 | function nettoyer_env_doublons($envd) { |
| 582 | - foreach ($envd as $table => $liste) { |
|
| 583 | - $n = ''; |
|
| 584 | - foreach (explode(',', $liste) as $val) { |
|
| 585 | - if ($a = intval($val) and $val === strval($a)) { |
|
| 586 | - $n .= ',' . $val; |
|
| 587 | - } |
|
| 588 | - } |
|
| 589 | - if (strlen($n)) { |
|
| 590 | - $envd[$table] = $n; |
|
| 591 | - } else { |
|
| 592 | - unset($envd[$table]); |
|
| 593 | - } |
|
| 594 | - } |
|
| 595 | - |
|
| 596 | - return $envd; |
|
| 582 | + foreach ($envd as $table => $liste) { |
|
| 583 | + $n = ''; |
|
| 584 | + foreach (explode(',', $liste) as $val) { |
|
| 585 | + if ($a = intval($val) and $val === strval($a)) { |
|
| 586 | + $n .= ',' . $val; |
|
| 587 | + } |
|
| 588 | + } |
|
| 589 | + if (strlen($n)) { |
|
| 590 | + $envd[$table] = $n; |
|
| 591 | + } else { |
|
| 592 | + unset($envd[$table]); |
|
| 593 | + } |
|
| 594 | + } |
|
| 595 | + |
|
| 596 | + return $envd; |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | /** |
@@ -612,21 +612,21 @@ discard block |
||
| 612 | 612 | * Opérateur trouvé (SELF ou SUBSELECT) sinon false. |
| 613 | 613 | **/ |
| 614 | 614 | function match_self($w) { |
| 615 | - if (is_string($w)) { |
|
| 616 | - return false; |
|
| 617 | - } |
|
| 618 | - if (is_array($w)) { |
|
| 619 | - if (in_array(reset($w), ['SELF', 'SUBSELECT'])) { |
|
| 620 | - return $w; |
|
| 621 | - } |
|
| 622 | - foreach (array_filter($w, 'is_array') as $sw) { |
|
| 623 | - if ($m = match_self($sw)) { |
|
| 624 | - return $m; |
|
| 625 | - } |
|
| 626 | - } |
|
| 627 | - } |
|
| 628 | - |
|
| 629 | - return false; |
|
| 615 | + if (is_string($w)) { |
|
| 616 | + return false; |
|
| 617 | + } |
|
| 618 | + if (is_array($w)) { |
|
| 619 | + if (in_array(reset($w), ['SELF', 'SUBSELECT'])) { |
|
| 620 | + return $w; |
|
| 621 | + } |
|
| 622 | + foreach (array_filter($w, 'is_array') as $sw) { |
|
| 623 | + if ($m = match_self($sw)) { |
|
| 624 | + return $m; |
|
| 625 | + } |
|
| 626 | + } |
|
| 627 | + } |
|
| 628 | + |
|
| 629 | + return false; |
|
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | /** |
@@ -642,16 +642,16 @@ discard block |
||
| 642 | 642 | * est remplacée par son code. |
| 643 | 643 | **/ |
| 644 | 644 | function remplace_sous_requete($w, $sousrequete) { |
| 645 | - if (is_array($w)) { |
|
| 646 | - if (in_array(reset($w), ['SELF', 'SUBSELECT'])) { |
|
| 647 | - return $sousrequete; |
|
| 648 | - } |
|
| 649 | - foreach ($w as $k => $sw) { |
|
| 650 | - $w[$k] = remplace_sous_requete($sw, $sousrequete); |
|
| 651 | - } |
|
| 652 | - } |
|
| 653 | - |
|
| 654 | - return $w; |
|
| 645 | + if (is_array($w)) { |
|
| 646 | + if (in_array(reset($w), ['SELF', 'SUBSELECT'])) { |
|
| 647 | + return $sousrequete; |
|
| 648 | + } |
|
| 649 | + foreach ($w as $k => $sw) { |
|
| 650 | + $w[$k] = remplace_sous_requete($sw, $sousrequete); |
|
| 651 | + } |
|
| 652 | + } |
|
| 653 | + |
|
| 654 | + return $w; |
|
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | /** |
@@ -665,17 +665,17 @@ discard block |
||
| 665 | 665 | * - Conditions avec des sous requêtes |
| 666 | 666 | **/ |
| 667 | 667 | function trouver_sous_requetes($where) { |
| 668 | - $where_simples = []; |
|
| 669 | - $where_sous = []; |
|
| 670 | - foreach ($where as $k => $w) { |
|
| 671 | - if (match_self($w)) { |
|
| 672 | - $where_sous[$k] = $w; |
|
| 673 | - } else { |
|
| 674 | - $where_simples[$k] = $w; |
|
| 675 | - } |
|
| 676 | - } |
|
| 677 | - |
|
| 678 | - return [$where_simples, $where_sous]; |
|
| 668 | + $where_simples = []; |
|
| 669 | + $where_sous = []; |
|
| 670 | + foreach ($where as $k => $w) { |
|
| 671 | + if (match_self($w)) { |
|
| 672 | + $where_sous[$k] = $w; |
|
| 673 | + } else { |
|
| 674 | + $where_simples[$k] = $w; |
|
| 675 | + } |
|
| 676 | + } |
|
| 677 | + |
|
| 678 | + return [$where_simples, $where_sous]; |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | |
@@ -701,292 +701,292 @@ discard block |
||
| 701 | 701 | * @return resource |
| 702 | 702 | */ |
| 703 | 703 | function calculer_select( |
| 704 | - $select = [], |
|
| 705 | - $from = [], |
|
| 706 | - $from_type = [], |
|
| 707 | - $where = [], |
|
| 708 | - $join = [], |
|
| 709 | - $groupby = [], |
|
| 710 | - $orderby = [], |
|
| 711 | - $limit = '', |
|
| 712 | - $having = [], |
|
| 713 | - $table = '', |
|
| 714 | - $id = '', |
|
| 715 | - $serveur = '', |
|
| 716 | - $requeter = true |
|
| 704 | + $select = [], |
|
| 705 | + $from = [], |
|
| 706 | + $from_type = [], |
|
| 707 | + $where = [], |
|
| 708 | + $join = [], |
|
| 709 | + $groupby = [], |
|
| 710 | + $orderby = [], |
|
| 711 | + $limit = '', |
|
| 712 | + $having = [], |
|
| 713 | + $table = '', |
|
| 714 | + $id = '', |
|
| 715 | + $serveur = '', |
|
| 716 | + $requeter = true |
|
| 717 | 717 | ) { |
| 718 | 718 | |
| 719 | - // retirer les criteres vides: |
|
| 720 | - // {X ?} avec X absent de l'URL |
|
| 721 | - // {par #ENV{X}} avec X absent de l'URL |
|
| 722 | - // IN sur collection vide (ce dernier devrait pouvoir etre fait a la compil) |
|
| 723 | - $menage = false; |
|
| 724 | - foreach ($where as $k => $v) { |
|
| 725 | - if (is_array($v) and count($v)) { |
|
| 726 | - if ((count($v) >= 2) && ($v[0] == 'REGEXP') && ($v[2] == "'.*'")) { |
|
| 727 | - $op = false; |
|
| 728 | - } elseif ((count($v) >= 2) && ($v[0] == 'LIKE') && ($v[2] == "'%'")) { |
|
| 729 | - $op = false; |
|
| 730 | - } else { |
|
| 731 | - $op = $v[0] ?: $v; |
|
| 732 | - } |
|
| 733 | - } else { |
|
| 734 | - $op = $v; |
|
| 735 | - } |
|
| 736 | - if ((!$op) or ($op == 1) or ($op == '0=0')) { |
|
| 737 | - unset($where[$k]); |
|
| 738 | - $menage = true; |
|
| 739 | - } |
|
| 740 | - } |
|
| 741 | - |
|
| 742 | - // evacuer les eventuels groupby vide issus d'un calcul dynamique |
|
| 743 | - $groupby = array_diff($groupby, ['']); |
|
| 744 | - |
|
| 745 | - // remplacer les sous requetes recursives au calcul |
|
| 746 | - [$where_simples, $where_sous] = trouver_sous_requetes($where); |
|
| 747 | - foreach ($where_sous as $k => $w) { |
|
| 748 | - $menage = true; |
|
| 749 | - // on recupere la sous requete |
|
| 750 | - $sous = match_self($w); |
|
| 751 | - if ($sous[0] == 'SELF') { |
|
| 752 | - // c'est une sous requete identique a elle meme sous la forme (SELF,$select,$where) |
|
| 753 | - array_push($where_simples, $sous[2]); |
|
| 754 | - $wheresub = [ |
|
| 755 | - $sous[2], |
|
| 756 | - '0=0' |
|
| 757 | - ]; // pour accepter une string et forcer a faire le menage car on a surement simplifie select et where |
|
| 758 | - $jsub = $join; |
|
| 759 | - // trouver les jointures utiles a |
|
| 760 | - // reinjecter dans le where de la sous requete les conditions supplementaires des jointures qui y sont mentionnees |
|
| 761 | - // ie L1.objet='article' |
|
| 762 | - // on construit le where une fois, puis on ajoute les where complentaires si besoin, et on reconstruit le where en fonction |
|
| 763 | - $i = 0; |
|
| 764 | - do { |
|
| 765 | - $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 766 | - [$sous[1] . ' AS id'], |
|
| 767 | - $from, |
|
| 768 | - $from_type, |
|
| 769 | - $wheresub, |
|
| 770 | - $jsub, |
|
| 771 | - [], |
|
| 772 | - [], |
|
| 773 | - '', |
|
| 774 | - $having, |
|
| 775 | - $table, |
|
| 776 | - $id, |
|
| 777 | - $serveur, |
|
| 778 | - false |
|
| 779 | - ) . ')'); |
|
| 780 | - if (!$i) { |
|
| 781 | - $i = 1; |
|
| 782 | - $wherestring = calculer_where_to_string($where[$k]); |
|
| 783 | - foreach ($join as $cle => $wj) { |
|
| 784 | - if ( |
|
| 785 | - (is_countable($wj) ? count($wj) : 0) == 4 |
|
| 786 | - and str_contains($wherestring, (string) "{$cle}.") |
|
| 787 | - ) { |
|
| 788 | - $i = 0; |
|
| 789 | - $wheresub[] = $wj[3]; |
|
| 790 | - unset($jsub[$cle][3]); |
|
| 791 | - } |
|
| 792 | - } |
|
| 793 | - } |
|
| 794 | - } while ($i++ < 1); |
|
| 795 | - } |
|
| 796 | - if ($sous[0] == 'SUBSELECT') { |
|
| 797 | - // c'est une sous requete explicite sous la forme identique a sql_select : (SUBSELECT,$select,$from,$where,$groupby,$orderby,$limit,$having) |
|
| 798 | - array_push($where_simples, $sous[3]); // est-ce utile dans ce cas ? |
|
| 799 | - $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 800 | - $sous[1], # select |
|
| 801 | - $sous[2], #from |
|
| 802 | - [], #from_type |
|
| 803 | - $sous[3] ? (is_array($sous[3]) ? $sous[3] : [$sous[3]]) : [], |
|
| 804 | - #where, qui peut etre de la forme string comme dans sql_select |
|
| 805 | - [], #join |
|
| 806 | - $sous[4] ?: [], #groupby |
|
| 807 | - $sous[5] ?: [], #orderby |
|
| 808 | - $sous[6], #limit |
|
| 809 | - $sous[7] ?: [], #having |
|
| 810 | - $table, |
|
| 811 | - $id, |
|
| 812 | - $serveur, |
|
| 813 | - false |
|
| 814 | - ) . ')'); |
|
| 815 | - } |
|
| 816 | - array_pop($where_simples); |
|
| 817 | - } |
|
| 818 | - |
|
| 819 | - foreach ($having as $k => $v) { |
|
| 820 | - if ((!$v) or ($v == 1) or ($v == '0=0')) { |
|
| 821 | - unset($having[$k]); |
|
| 822 | - } |
|
| 823 | - } |
|
| 824 | - |
|
| 825 | - // Installer les jointures. |
|
| 826 | - // Retirer celles seulement utiles aux criteres finalement absents mais |
|
| 827 | - // parcourir de la plus recente a la moins recente pour pouvoir eliminer Ln |
|
| 828 | - // si elle est seulement utile a Ln+1 elle meme inutile |
|
| 829 | - |
|
| 830 | - $afrom = []; |
|
| 831 | - $equiv = []; |
|
| 832 | - $k = count($join); |
|
| 833 | - foreach (array_reverse($join, true) as $cledef => $j) { |
|
| 834 | - $cle = $cledef; |
|
| 835 | - // le format de join est : |
|
| 836 | - // array(table depart, cle depart [,cle arrivee[,condition optionnelle and ...]]) |
|
| 837 | - $join[$cle] = array_values($join[$cle]); // recalculer les cles car des unset ont pu perturber |
|
| 838 | - if (count($join[$cle]) == 2) { |
|
| 839 | - $join[$cle][] = $join[$cle][1]; |
|
| 840 | - } |
|
| 841 | - if ((is_array($join[$cle]) || $join[$cle] instanceof \Countable ? count($join[$cle]) : 0) == 3) { |
|
| 842 | - $join[$cle][] = ''; |
|
| 843 | - } |
|
| 844 | - [$t, $c, $carr, $and] = $join[$cle]; |
|
| 845 | - // si le nom de la jointure n'a pas ete specifiee, on prend Lx avec x sont rang dans la liste |
|
| 846 | - // pour compat avec ancienne convention |
|
| 847 | - if (is_numeric($cle)) { |
|
| 848 | - $cle = "L$k"; |
|
| 849 | - } |
|
| 850 | - $cle_where_lie = "JOIN-$cle"; |
|
| 851 | - if ( |
|
| 852 | - !$menage |
|
| 853 | - or isset($afrom[$cle]) |
|
| 854 | - or calculer_jointnul($cle, $select) |
|
| 855 | - or calculer_jointnul($cle, array_diff_key($join, [$cle => $join[$cle]])) |
|
| 856 | - or calculer_jointnul($cle, $having) |
|
| 857 | - or calculer_jointnul($cle, array_diff_key($where_simples, [$cle_where_lie => ''])) |
|
| 858 | - ) { |
|
| 859 | - // corriger les references non explicites dans select |
|
| 860 | - // ou groupby |
|
| 861 | - foreach ($select as $i => $s) { |
|
| 862 | - if ($s == $c) { |
|
| 863 | - $select[$i] = "$cle.$c AS $c"; |
|
| 864 | - break; |
|
| 865 | - } |
|
| 866 | - } |
|
| 867 | - foreach ($groupby as $i => $g) { |
|
| 868 | - if ($g == $c) { |
|
| 869 | - $groupby[$i] = "$cle.$c"; |
|
| 870 | - break; |
|
| 871 | - } |
|
| 872 | - } |
|
| 873 | - // on garde une ecriture decomposee pour permettre une simplification ulterieure si besoin |
|
| 874 | - // sans recours a preg_match |
|
| 875 | - // un implode(' ',..) est fait dans reinjecte_joint un peu plus bas |
|
| 876 | - $afrom[$t][$cle] = [ |
|
| 877 | - "\n" . |
|
| 878 | - ($from_type[$cle] ?? 'INNER') . ' JOIN', |
|
| 879 | - $from[$cle], |
|
| 880 | - "AS $cle", |
|
| 881 | - 'ON (', |
|
| 882 | - "$cle.$c", |
|
| 883 | - '=', |
|
| 884 | - "$t.$carr", |
|
| 885 | - ($and ? 'AND ' . $and : '') . |
|
| 886 | - ')' |
|
| 887 | - ]; |
|
| 888 | - if (isset($afrom[$cle])) { |
|
| 889 | - $afrom[$t] = $afrom[$t] + $afrom[$cle]; |
|
| 890 | - unset($afrom[$cle]); |
|
| 891 | - } |
|
| 892 | - $equiv[] = $carr; |
|
| 893 | - } else { |
|
| 894 | - unset($join[$cledef]); |
|
| 895 | - if (isset($where_simples[$cle_where_lie])) { |
|
| 896 | - unset($where_simples[$cle_where_lie]); |
|
| 897 | - unset($where[$cle_where_lie]); |
|
| 898 | - } |
|
| 899 | - } |
|
| 900 | - unset($from[$cle]); |
|
| 901 | - $k--; |
|
| 902 | - } |
|
| 903 | - |
|
| 904 | - if (count($afrom)) { |
|
| 905 | - // Regarder si la table principale ne sert finalement a rien comme dans |
|
| 906 | - //<BOUCLE3(MOTS){id_article}{id_mot}> class='on'</BOUCLE3> |
|
| 907 | - //<BOUCLE2(MOTS){id_article} />#TOTAL_BOUCLE<//B2> |
|
| 908 | - //<BOUCLE5(RUBRIQUES){id_mot}{tout} />#TOTAL_BOUCLE<//B5> |
|
| 909 | - // ou dans |
|
| 910 | - //<BOUCLE8(HIERARCHIE){id_rubrique}{tout}{type='Squelette'}{inverse}{0,1}{lang_select=non} />#TOTAL_BOUCLE<//B8> |
|
| 911 | - // qui comporte plusieurs jointures |
|
| 912 | - // ou dans |
|
| 913 | - // <BOUCLE6(ARTICLES){id_mot=2}{statut==.*} />#TOTAL_BOUCLE<//B6> |
|
| 914 | - // <BOUCLE7(ARTICLES){id_mot>0}{statut?} />#TOTAL_BOUCLE<//B7> |
|
| 915 | - // penser a regarder aussi la clause orderby pour ne pas simplifier abusivement |
|
| 916 | - // <BOUCLE9(ARTICLES){recherche truc}{par titre}>#ID_ARTICLE</BOUCLE9> |
|
| 917 | - // penser a regarder aussi la clause groubpy pour ne pas simplifier abusivement |
|
| 918 | - // <BOUCLE10(EVENEMENTS){id_rubrique} />#TOTAL_BOUCLE<//B10> |
|
| 919 | - |
|
| 920 | - $t = key($from); |
|
| 921 | - $c = current($from); |
|
| 922 | - reset($from); |
|
| 923 | - $e = '/\b(' . "$t\\." . join('|' . $t . '\.', $equiv) . ')\b/'; |
|
| 924 | - if ( |
|
| 925 | - !(strpos($t, ' ') or // jointure des le depart cf boucle_doc |
|
| 926 | - calculer_jointnul($t, $select, $e) or |
|
| 927 | - calculer_jointnul($t, $join, $e) or |
|
| 928 | - calculer_jointnul($t, $where, $e) or |
|
| 929 | - calculer_jointnul($t, $orderby, $e) or |
|
| 930 | - calculer_jointnul($t, $groupby, $e) or |
|
| 931 | - calculer_jointnul($t, $having, $e)) |
|
| 932 | - && count($afrom[$t]) |
|
| 933 | - ) { |
|
| 934 | - $nfrom = reset($afrom[$t]); |
|
| 935 | - $nt = array_key_first($afrom[$t]); |
|
| 936 | - unset($from[$t]); |
|
| 937 | - $from[$nt] = $nfrom[1]; |
|
| 938 | - unset($afrom[$t][$nt]); |
|
| 939 | - $afrom[$nt] = $afrom[$t]; |
|
| 940 | - unset($afrom[$t]); |
|
| 941 | - $e = '/\b' . preg_quote($nfrom[6]) . '\b/'; |
|
| 942 | - $t = $nfrom[4]; |
|
| 943 | - $alias = ''; |
|
| 944 | - // verifier que les deux cles sont homonymes, sinon installer un alias dans le select |
|
| 945 | - $oldcle = explode('.', $nfrom[6]); |
|
| 946 | - $oldcle = end($oldcle); |
|
| 947 | - $newcle = explode('.', $nfrom[4]); |
|
| 948 | - $newcle = end($newcle); |
|
| 949 | - if ($newcle != $oldcle) { |
|
| 950 | - // si l'ancienne cle etait deja dans le select avec un AS |
|
| 951 | - // reprendre simplement ce AS |
|
| 952 | - $as = '/\b' . preg_quote($nfrom[6]) . '\s+(AS\s+\w+)\b/'; |
|
| 953 | - if (preg_match($as, implode(',', $select), $m)) { |
|
| 954 | - $alias = ''; |
|
| 955 | - } else { |
|
| 956 | - $alias = ', ' . $nfrom[4] . " AS $oldcle"; |
|
| 957 | - } |
|
| 958 | - } |
|
| 959 | - $select = remplacer_jointnul($t . $alias, $select, $e); |
|
| 960 | - $join = remplacer_jointnul($t, $join, $e); |
|
| 961 | - $where = remplacer_jointnul($t, $where, $e); |
|
| 962 | - $having = remplacer_jointnul($t, $having, $e); |
|
| 963 | - $groupby = remplacer_jointnul($t, $groupby, $e); |
|
| 964 | - $orderby = remplacer_jointnul($t, $orderby, $e); |
|
| 965 | - } |
|
| 966 | - $from = reinjecte_joint($afrom, $from); |
|
| 967 | - } |
|
| 968 | - if (empty($GLOBALS['debug']) or !is_array($GLOBALS['debug'])) { |
|
| 969 | - $wasdebug = empty($GLOBALS['debug']) ? false : $GLOBALS['debug']; |
|
| 970 | - $GLOBALS['debug'] = []; |
|
| 971 | - if ($wasdebug) { |
|
| 972 | - $GLOBALS['debug']['debug'] = true; |
|
| 973 | - } |
|
| 974 | - } |
|
| 975 | - $GLOBALS['debug']['aucasou'] = [$table, $id, $serveur, $requeter]; |
|
| 976 | - $r = sql_select( |
|
| 977 | - $select, |
|
| 978 | - $from, |
|
| 979 | - $where, |
|
| 980 | - $groupby, |
|
| 981 | - array_filter($orderby), |
|
| 982 | - $limit, |
|
| 983 | - $having, |
|
| 984 | - $serveur, |
|
| 985 | - $requeter |
|
| 986 | - ); |
|
| 987 | - unset($GLOBALS['debug']['aucasou']); |
|
| 988 | - |
|
| 989 | - return $r; |
|
| 719 | + // retirer les criteres vides: |
|
| 720 | + // {X ?} avec X absent de l'URL |
|
| 721 | + // {par #ENV{X}} avec X absent de l'URL |
|
| 722 | + // IN sur collection vide (ce dernier devrait pouvoir etre fait a la compil) |
|
| 723 | + $menage = false; |
|
| 724 | + foreach ($where as $k => $v) { |
|
| 725 | + if (is_array($v) and count($v)) { |
|
| 726 | + if ((count($v) >= 2) && ($v[0] == 'REGEXP') && ($v[2] == "'.*'")) { |
|
| 727 | + $op = false; |
|
| 728 | + } elseif ((count($v) >= 2) && ($v[0] == 'LIKE') && ($v[2] == "'%'")) { |
|
| 729 | + $op = false; |
|
| 730 | + } else { |
|
| 731 | + $op = $v[0] ?: $v; |
|
| 732 | + } |
|
| 733 | + } else { |
|
| 734 | + $op = $v; |
|
| 735 | + } |
|
| 736 | + if ((!$op) or ($op == 1) or ($op == '0=0')) { |
|
| 737 | + unset($where[$k]); |
|
| 738 | + $menage = true; |
|
| 739 | + } |
|
| 740 | + } |
|
| 741 | + |
|
| 742 | + // evacuer les eventuels groupby vide issus d'un calcul dynamique |
|
| 743 | + $groupby = array_diff($groupby, ['']); |
|
| 744 | + |
|
| 745 | + // remplacer les sous requetes recursives au calcul |
|
| 746 | + [$where_simples, $where_sous] = trouver_sous_requetes($where); |
|
| 747 | + foreach ($where_sous as $k => $w) { |
|
| 748 | + $menage = true; |
|
| 749 | + // on recupere la sous requete |
|
| 750 | + $sous = match_self($w); |
|
| 751 | + if ($sous[0] == 'SELF') { |
|
| 752 | + // c'est une sous requete identique a elle meme sous la forme (SELF,$select,$where) |
|
| 753 | + array_push($where_simples, $sous[2]); |
|
| 754 | + $wheresub = [ |
|
| 755 | + $sous[2], |
|
| 756 | + '0=0' |
|
| 757 | + ]; // pour accepter une string et forcer a faire le menage car on a surement simplifie select et where |
|
| 758 | + $jsub = $join; |
|
| 759 | + // trouver les jointures utiles a |
|
| 760 | + // reinjecter dans le where de la sous requete les conditions supplementaires des jointures qui y sont mentionnees |
|
| 761 | + // ie L1.objet='article' |
|
| 762 | + // on construit le where une fois, puis on ajoute les where complentaires si besoin, et on reconstruit le where en fonction |
|
| 763 | + $i = 0; |
|
| 764 | + do { |
|
| 765 | + $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 766 | + [$sous[1] . ' AS id'], |
|
| 767 | + $from, |
|
| 768 | + $from_type, |
|
| 769 | + $wheresub, |
|
| 770 | + $jsub, |
|
| 771 | + [], |
|
| 772 | + [], |
|
| 773 | + '', |
|
| 774 | + $having, |
|
| 775 | + $table, |
|
| 776 | + $id, |
|
| 777 | + $serveur, |
|
| 778 | + false |
|
| 779 | + ) . ')'); |
|
| 780 | + if (!$i) { |
|
| 781 | + $i = 1; |
|
| 782 | + $wherestring = calculer_where_to_string($where[$k]); |
|
| 783 | + foreach ($join as $cle => $wj) { |
|
| 784 | + if ( |
|
| 785 | + (is_countable($wj) ? count($wj) : 0) == 4 |
|
| 786 | + and str_contains($wherestring, (string) "{$cle}.") |
|
| 787 | + ) { |
|
| 788 | + $i = 0; |
|
| 789 | + $wheresub[] = $wj[3]; |
|
| 790 | + unset($jsub[$cle][3]); |
|
| 791 | + } |
|
| 792 | + } |
|
| 793 | + } |
|
| 794 | + } while ($i++ < 1); |
|
| 795 | + } |
|
| 796 | + if ($sous[0] == 'SUBSELECT') { |
|
| 797 | + // c'est une sous requete explicite sous la forme identique a sql_select : (SUBSELECT,$select,$from,$where,$groupby,$orderby,$limit,$having) |
|
| 798 | + array_push($where_simples, $sous[3]); // est-ce utile dans ce cas ? |
|
| 799 | + $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 800 | + $sous[1], # select |
|
| 801 | + $sous[2], #from |
|
| 802 | + [], #from_type |
|
| 803 | + $sous[3] ? (is_array($sous[3]) ? $sous[3] : [$sous[3]]) : [], |
|
| 804 | + #where, qui peut etre de la forme string comme dans sql_select |
|
| 805 | + [], #join |
|
| 806 | + $sous[4] ?: [], #groupby |
|
| 807 | + $sous[5] ?: [], #orderby |
|
| 808 | + $sous[6], #limit |
|
| 809 | + $sous[7] ?: [], #having |
|
| 810 | + $table, |
|
| 811 | + $id, |
|
| 812 | + $serveur, |
|
| 813 | + false |
|
| 814 | + ) . ')'); |
|
| 815 | + } |
|
| 816 | + array_pop($where_simples); |
|
| 817 | + } |
|
| 818 | + |
|
| 819 | + foreach ($having as $k => $v) { |
|
| 820 | + if ((!$v) or ($v == 1) or ($v == '0=0')) { |
|
| 821 | + unset($having[$k]); |
|
| 822 | + } |
|
| 823 | + } |
|
| 824 | + |
|
| 825 | + // Installer les jointures. |
|
| 826 | + // Retirer celles seulement utiles aux criteres finalement absents mais |
|
| 827 | + // parcourir de la plus recente a la moins recente pour pouvoir eliminer Ln |
|
| 828 | + // si elle est seulement utile a Ln+1 elle meme inutile |
|
| 829 | + |
|
| 830 | + $afrom = []; |
|
| 831 | + $equiv = []; |
|
| 832 | + $k = count($join); |
|
| 833 | + foreach (array_reverse($join, true) as $cledef => $j) { |
|
| 834 | + $cle = $cledef; |
|
| 835 | + // le format de join est : |
|
| 836 | + // array(table depart, cle depart [,cle arrivee[,condition optionnelle and ...]]) |
|
| 837 | + $join[$cle] = array_values($join[$cle]); // recalculer les cles car des unset ont pu perturber |
|
| 838 | + if (count($join[$cle]) == 2) { |
|
| 839 | + $join[$cle][] = $join[$cle][1]; |
|
| 840 | + } |
|
| 841 | + if ((is_array($join[$cle]) || $join[$cle] instanceof \Countable ? count($join[$cle]) : 0) == 3) { |
|
| 842 | + $join[$cle][] = ''; |
|
| 843 | + } |
|
| 844 | + [$t, $c, $carr, $and] = $join[$cle]; |
|
| 845 | + // si le nom de la jointure n'a pas ete specifiee, on prend Lx avec x sont rang dans la liste |
|
| 846 | + // pour compat avec ancienne convention |
|
| 847 | + if (is_numeric($cle)) { |
|
| 848 | + $cle = "L$k"; |
|
| 849 | + } |
|
| 850 | + $cle_where_lie = "JOIN-$cle"; |
|
| 851 | + if ( |
|
| 852 | + !$menage |
|
| 853 | + or isset($afrom[$cle]) |
|
| 854 | + or calculer_jointnul($cle, $select) |
|
| 855 | + or calculer_jointnul($cle, array_diff_key($join, [$cle => $join[$cle]])) |
|
| 856 | + or calculer_jointnul($cle, $having) |
|
| 857 | + or calculer_jointnul($cle, array_diff_key($where_simples, [$cle_where_lie => ''])) |
|
| 858 | + ) { |
|
| 859 | + // corriger les references non explicites dans select |
|
| 860 | + // ou groupby |
|
| 861 | + foreach ($select as $i => $s) { |
|
| 862 | + if ($s == $c) { |
|
| 863 | + $select[$i] = "$cle.$c AS $c"; |
|
| 864 | + break; |
|
| 865 | + } |
|
| 866 | + } |
|
| 867 | + foreach ($groupby as $i => $g) { |
|
| 868 | + if ($g == $c) { |
|
| 869 | + $groupby[$i] = "$cle.$c"; |
|
| 870 | + break; |
|
| 871 | + } |
|
| 872 | + } |
|
| 873 | + // on garde une ecriture decomposee pour permettre une simplification ulterieure si besoin |
|
| 874 | + // sans recours a preg_match |
|
| 875 | + // un implode(' ',..) est fait dans reinjecte_joint un peu plus bas |
|
| 876 | + $afrom[$t][$cle] = [ |
|
| 877 | + "\n" . |
|
| 878 | + ($from_type[$cle] ?? 'INNER') . ' JOIN', |
|
| 879 | + $from[$cle], |
|
| 880 | + "AS $cle", |
|
| 881 | + 'ON (', |
|
| 882 | + "$cle.$c", |
|
| 883 | + '=', |
|
| 884 | + "$t.$carr", |
|
| 885 | + ($and ? 'AND ' . $and : '') . |
|
| 886 | + ')' |
|
| 887 | + ]; |
|
| 888 | + if (isset($afrom[$cle])) { |
|
| 889 | + $afrom[$t] = $afrom[$t] + $afrom[$cle]; |
|
| 890 | + unset($afrom[$cle]); |
|
| 891 | + } |
|
| 892 | + $equiv[] = $carr; |
|
| 893 | + } else { |
|
| 894 | + unset($join[$cledef]); |
|
| 895 | + if (isset($where_simples[$cle_where_lie])) { |
|
| 896 | + unset($where_simples[$cle_where_lie]); |
|
| 897 | + unset($where[$cle_where_lie]); |
|
| 898 | + } |
|
| 899 | + } |
|
| 900 | + unset($from[$cle]); |
|
| 901 | + $k--; |
|
| 902 | + } |
|
| 903 | + |
|
| 904 | + if (count($afrom)) { |
|
| 905 | + // Regarder si la table principale ne sert finalement a rien comme dans |
|
| 906 | + //<BOUCLE3(MOTS){id_article}{id_mot}> class='on'</BOUCLE3> |
|
| 907 | + //<BOUCLE2(MOTS){id_article} />#TOTAL_BOUCLE<//B2> |
|
| 908 | + //<BOUCLE5(RUBRIQUES){id_mot}{tout} />#TOTAL_BOUCLE<//B5> |
|
| 909 | + // ou dans |
|
| 910 | + //<BOUCLE8(HIERARCHIE){id_rubrique}{tout}{type='Squelette'}{inverse}{0,1}{lang_select=non} />#TOTAL_BOUCLE<//B8> |
|
| 911 | + // qui comporte plusieurs jointures |
|
| 912 | + // ou dans |
|
| 913 | + // <BOUCLE6(ARTICLES){id_mot=2}{statut==.*} />#TOTAL_BOUCLE<//B6> |
|
| 914 | + // <BOUCLE7(ARTICLES){id_mot>0}{statut?} />#TOTAL_BOUCLE<//B7> |
|
| 915 | + // penser a regarder aussi la clause orderby pour ne pas simplifier abusivement |
|
| 916 | + // <BOUCLE9(ARTICLES){recherche truc}{par titre}>#ID_ARTICLE</BOUCLE9> |
|
| 917 | + // penser a regarder aussi la clause groubpy pour ne pas simplifier abusivement |
|
| 918 | + // <BOUCLE10(EVENEMENTS){id_rubrique} />#TOTAL_BOUCLE<//B10> |
|
| 919 | + |
|
| 920 | + $t = key($from); |
|
| 921 | + $c = current($from); |
|
| 922 | + reset($from); |
|
| 923 | + $e = '/\b(' . "$t\\." . join('|' . $t . '\.', $equiv) . ')\b/'; |
|
| 924 | + if ( |
|
| 925 | + !(strpos($t, ' ') or // jointure des le depart cf boucle_doc |
|
| 926 | + calculer_jointnul($t, $select, $e) or |
|
| 927 | + calculer_jointnul($t, $join, $e) or |
|
| 928 | + calculer_jointnul($t, $where, $e) or |
|
| 929 | + calculer_jointnul($t, $orderby, $e) or |
|
| 930 | + calculer_jointnul($t, $groupby, $e) or |
|
| 931 | + calculer_jointnul($t, $having, $e)) |
|
| 932 | + && count($afrom[$t]) |
|
| 933 | + ) { |
|
| 934 | + $nfrom = reset($afrom[$t]); |
|
| 935 | + $nt = array_key_first($afrom[$t]); |
|
| 936 | + unset($from[$t]); |
|
| 937 | + $from[$nt] = $nfrom[1]; |
|
| 938 | + unset($afrom[$t][$nt]); |
|
| 939 | + $afrom[$nt] = $afrom[$t]; |
|
| 940 | + unset($afrom[$t]); |
|
| 941 | + $e = '/\b' . preg_quote($nfrom[6]) . '\b/'; |
|
| 942 | + $t = $nfrom[4]; |
|
| 943 | + $alias = ''; |
|
| 944 | + // verifier que les deux cles sont homonymes, sinon installer un alias dans le select |
|
| 945 | + $oldcle = explode('.', $nfrom[6]); |
|
| 946 | + $oldcle = end($oldcle); |
|
| 947 | + $newcle = explode('.', $nfrom[4]); |
|
| 948 | + $newcle = end($newcle); |
|
| 949 | + if ($newcle != $oldcle) { |
|
| 950 | + // si l'ancienne cle etait deja dans le select avec un AS |
|
| 951 | + // reprendre simplement ce AS |
|
| 952 | + $as = '/\b' . preg_quote($nfrom[6]) . '\s+(AS\s+\w+)\b/'; |
|
| 953 | + if (preg_match($as, implode(',', $select), $m)) { |
|
| 954 | + $alias = ''; |
|
| 955 | + } else { |
|
| 956 | + $alias = ', ' . $nfrom[4] . " AS $oldcle"; |
|
| 957 | + } |
|
| 958 | + } |
|
| 959 | + $select = remplacer_jointnul($t . $alias, $select, $e); |
|
| 960 | + $join = remplacer_jointnul($t, $join, $e); |
|
| 961 | + $where = remplacer_jointnul($t, $where, $e); |
|
| 962 | + $having = remplacer_jointnul($t, $having, $e); |
|
| 963 | + $groupby = remplacer_jointnul($t, $groupby, $e); |
|
| 964 | + $orderby = remplacer_jointnul($t, $orderby, $e); |
|
| 965 | + } |
|
| 966 | + $from = reinjecte_joint($afrom, $from); |
|
| 967 | + } |
|
| 968 | + if (empty($GLOBALS['debug']) or !is_array($GLOBALS['debug'])) { |
|
| 969 | + $wasdebug = empty($GLOBALS['debug']) ? false : $GLOBALS['debug']; |
|
| 970 | + $GLOBALS['debug'] = []; |
|
| 971 | + if ($wasdebug) { |
|
| 972 | + $GLOBALS['debug']['debug'] = true; |
|
| 973 | + } |
|
| 974 | + } |
|
| 975 | + $GLOBALS['debug']['aucasou'] = [$table, $id, $serveur, $requeter]; |
|
| 976 | + $r = sql_select( |
|
| 977 | + $select, |
|
| 978 | + $from, |
|
| 979 | + $where, |
|
| 980 | + $groupby, |
|
| 981 | + array_filter($orderby), |
|
| 982 | + $limit, |
|
| 983 | + $having, |
|
| 984 | + $serveur, |
|
| 985 | + $requeter |
|
| 986 | + ); |
|
| 987 | + unset($GLOBALS['debug']['aucasou']); |
|
| 988 | + |
|
| 989 | + return $r; |
|
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | /** |
@@ -997,79 +997,79 @@ discard block |
||
| 997 | 997 | * @return string |
| 998 | 998 | */ |
| 999 | 999 | function calculer_where_to_string($v, $join = 'AND') { |
| 1000 | - if (empty($v)) { |
|
| 1001 | - return ''; |
|
| 1002 | - } |
|
| 1003 | - |
|
| 1004 | - if (!is_array($v)) { |
|
| 1005 | - return $v; |
|
| 1006 | - } else { |
|
| 1007 | - $exp = ''; |
|
| 1008 | - if (strtoupper($join) === 'AND') { |
|
| 1009 | - return $exp . join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 1010 | - } else { |
|
| 1011 | - return $exp . join($join, $v); |
|
| 1012 | - } |
|
| 1013 | - } |
|
| 1000 | + if (empty($v)) { |
|
| 1001 | + return ''; |
|
| 1002 | + } |
|
| 1003 | + |
|
| 1004 | + if (!is_array($v)) { |
|
| 1005 | + return $v; |
|
| 1006 | + } else { |
|
| 1007 | + $exp = ''; |
|
| 1008 | + if (strtoupper($join) === 'AND') { |
|
| 1009 | + return $exp . join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 1010 | + } else { |
|
| 1011 | + return $exp . join($join, $v); |
|
| 1012 | + } |
|
| 1013 | + } |
|
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | 1016 | |
| 1017 | 1017 | //condition suffisante (mais non necessaire) pour qu'une table soit utile |
| 1018 | 1018 | |
| 1019 | 1019 | function calculer_jointnul($cle, $exp, $equiv = '') { |
| 1020 | - if (!is_array($exp)) { |
|
| 1021 | - if ($equiv) { |
|
| 1022 | - $exp = preg_replace($equiv, '', $exp); |
|
| 1023 | - } |
|
| 1024 | - |
|
| 1025 | - return preg_match("/\\b$cle\\./", $exp); |
|
| 1026 | - } else { |
|
| 1027 | - foreach ($exp as $v) { |
|
| 1028 | - if (calculer_jointnul($cle, $v, $equiv)) { |
|
| 1029 | - return true; |
|
| 1030 | - } |
|
| 1031 | - } |
|
| 1032 | - |
|
| 1033 | - return false; |
|
| 1034 | - } |
|
| 1020 | + if (!is_array($exp)) { |
|
| 1021 | + if ($equiv) { |
|
| 1022 | + $exp = preg_replace($equiv, '', $exp); |
|
| 1023 | + } |
|
| 1024 | + |
|
| 1025 | + return preg_match("/\\b$cle\\./", $exp); |
|
| 1026 | + } else { |
|
| 1027 | + foreach ($exp as $v) { |
|
| 1028 | + if (calculer_jointnul($cle, $v, $equiv)) { |
|
| 1029 | + return true; |
|
| 1030 | + } |
|
| 1031 | + } |
|
| 1032 | + |
|
| 1033 | + return false; |
|
| 1034 | + } |
|
| 1035 | 1035 | } |
| 1036 | 1036 | |
| 1037 | 1037 | function reinjecte_joint($afrom, $from) { |
| 1038 | - $from_synth = []; |
|
| 1039 | - foreach ($from as $k => $v) { |
|
| 1040 | - $from_synth[$k] = $from[$k]; |
|
| 1041 | - if (isset($afrom[$k])) { |
|
| 1042 | - foreach ($afrom[$k] as $kk => $vv) { |
|
| 1043 | - $afrom[$k][$kk] = implode(' ', $afrom[$k][$kk]); |
|
| 1044 | - } |
|
| 1045 | - $from_synth["$k@"] = implode(' ', $afrom[$k]); |
|
| 1046 | - unset($afrom[$k]); |
|
| 1047 | - } |
|
| 1048 | - } |
|
| 1049 | - |
|
| 1050 | - return $from_synth; |
|
| 1038 | + $from_synth = []; |
|
| 1039 | + foreach ($from as $k => $v) { |
|
| 1040 | + $from_synth[$k] = $from[$k]; |
|
| 1041 | + if (isset($afrom[$k])) { |
|
| 1042 | + foreach ($afrom[$k] as $kk => $vv) { |
|
| 1043 | + $afrom[$k][$kk] = implode(' ', $afrom[$k][$kk]); |
|
| 1044 | + } |
|
| 1045 | + $from_synth["$k@"] = implode(' ', $afrom[$k]); |
|
| 1046 | + unset($afrom[$k]); |
|
| 1047 | + } |
|
| 1048 | + } |
|
| 1049 | + |
|
| 1050 | + return $from_synth; |
|
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | function remplacer_jointnul($cle, $exp, $equiv = '') { |
| 1054 | - if (!is_array($exp)) { |
|
| 1055 | - return preg_replace($equiv, $cle, $exp); |
|
| 1056 | - } else { |
|
| 1057 | - foreach ($exp as $k => $v) { |
|
| 1058 | - $exp[$k] = remplacer_jointnul($cle, $v, $equiv); |
|
| 1059 | - } |
|
| 1060 | - |
|
| 1061 | - return $exp; |
|
| 1062 | - } |
|
| 1054 | + if (!is_array($exp)) { |
|
| 1055 | + return preg_replace($equiv, $cle, $exp); |
|
| 1056 | + } else { |
|
| 1057 | + foreach ($exp as $k => $v) { |
|
| 1058 | + $exp[$k] = remplacer_jointnul($cle, $v, $equiv); |
|
| 1059 | + } |
|
| 1060 | + |
|
| 1061 | + return $exp; |
|
| 1062 | + } |
|
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | 1065 | // calcul du nom du squelette |
| 1066 | 1066 | function calculer_nom_fonction_squel($skel, $mime_type = 'html', string $connect = '') { |
| 1067 | - // ne pas doublonner les squelette selon qu'ils sont calcules depuis ecrire/ ou depuis la racine |
|
| 1068 | - if ($l = strlen(_DIR_RACINE) and strncmp($skel, _DIR_RACINE, $l) == 0) { |
|
| 1069 | - $skel = substr($skel, strlen(_DIR_RACINE)); |
|
| 1070 | - } |
|
| 1071 | - |
|
| 1072 | - return $mime_type |
|
| 1073 | - . (!$connect ? '' : preg_replace('/\W/', '_', $connect)) . '_' |
|
| 1074 | - . md5($GLOBALS['spip_version_code'] . ' * ' . $skel . (isset($GLOBALS['marqueur_skel']) ? '*' . $GLOBALS['marqueur_skel'] : '')); |
|
| 1067 | + // ne pas doublonner les squelette selon qu'ils sont calcules depuis ecrire/ ou depuis la racine |
|
| 1068 | + if ($l = strlen(_DIR_RACINE) and strncmp($skel, _DIR_RACINE, $l) == 0) { |
|
| 1069 | + $skel = substr($skel, strlen(_DIR_RACINE)); |
|
| 1070 | + } |
|
| 1071 | + |
|
| 1072 | + return $mime_type |
|
| 1073 | + . (!$connect ? '' : preg_replace('/\W/', '_', $connect)) . '_' |
|
| 1074 | + . md5($GLOBALS['spip_version_code'] . ' * ' . $skel . (isset($GLOBALS['marqueur_skel']) ? '*' . $GLOBALS['marqueur_skel'] : '')); |
|
| 1075 | 1075 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $GLOBALS['debug_objets']['courant'] = $nom; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $phpfile = sous_repertoire(_DIR_SKELS, '', false, true) . $nom . '.php'; |
|
| 57 | + $phpfile = sous_repertoire(_DIR_SKELS, '', false, true).$nom.'.php'; |
|
| 58 | 58 | |
| 59 | 59 | // si squelette est deja compile et perenne, le charger |
| 60 | 60 | if (!squelette_obsolete($phpfile, $source)) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | #} |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if (file_exists($lib = $squelette . '_fonctions' . '.php')) { |
|
| 70 | + if (file_exists($lib = $squelette.'_fonctions'.'.php')) { |
|
| 71 | 71 | include_once $lib; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | eval("return true; $f ;"); |
| 96 | 96 | } catch (\ParseError $e) { |
| 97 | 97 | // Code syntaxiquement faux (critere etc mal programme') |
| 98 | - $msg = _T('zbug_erreur_compilation') . ' | Line ' . $e->getLine() . ' : ' . $e->getMessage(); |
|
| 98 | + $msg = _T('zbug_erreur_compilation').' | Line '.$e->getLine().' : '.$e->getMessage(); |
|
| 99 | 99 | erreur_squelette($msg, $boucle); |
| 100 | 100 | // continuer pour trouver d'autres fautes eventuelles |
| 101 | 101 | // mais prevenir que c'est mort |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
| 125 | 125 | // Tracer ce qui vient d'etre compile |
| 126 | - $GLOBALS['debug_objets']['code'][$nom . 'tout'] = $code; |
|
| 126 | + $GLOBALS['debug_objets']['code'][$nom.'tout'] = $code; |
|
| 127 | 127 | |
| 128 | 128 | // si c'est ce que demande le debusqueur, lui passer la main |
| 129 | 129 | if ( |
@@ -147,13 +147,13 @@ discard block |
||
| 147 | 147 | $code = " |
| 148 | 148 | /* |
| 149 | 149 | * Squelette : $sourcefile |
| 150 | - * Date : " . gmdate('D, d M Y H:i:s', @filemtime($sourcefile)) . ' GMT |
|
| 151 | - * Compile : ' . gmdate('D, d M Y H:i:s', time()) . ' GMT |
|
| 152 | - * ' . (!$boucles ? 'Pas de boucle' : ('Boucles : ' . $noms)) . ' |
|
| 150 | + * Date : ".gmdate('D, d M Y H:i:s', @filemtime($sourcefile)).' GMT |
|
| 151 | + * Compile : ' . gmdate('D, d M Y H:i:s', time()).' GMT |
|
| 152 | + * ' . (!$boucles ? 'Pas de boucle' : ('Boucles : '.$noms)).' |
|
| 153 | 153 | */ '; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - $code = '<' . "?php\n" . $code . join('', $boucles) . "\n"; |
|
| 156 | + $code = '<'."?php\n".$code.join('', $boucles)."\n"; |
|
| 157 | 157 | if (!defined('_VAR_NOCACHE') or !_VAR_NOCACHE) { |
| 158 | 158 | ecrire_fichier($phpfile, $code); |
| 159 | 159 | } |
@@ -215,18 +215,18 @@ discard block |
||
| 215 | 215 | $j = join('-', array_map('ucwords', explode('-', strtolower($r[2])))); |
| 216 | 216 | |
| 217 | 217 | if ($j == 'X-Spip-Filtre' and isset($headers[$j])) { |
| 218 | - $headers[$j] .= '|' . $r[3]; |
|
| 218 | + $headers[$j] .= '|'.$r[3]; |
|
| 219 | 219 | } else { |
| 220 | - $headers[$j] = str_replace(['\\\\',"\\'",'\\"'], ['\\',"'",'"'], $r[3]); |
|
| 220 | + $headers[$j] = str_replace(['\\\\', "\\'", '\\"'], ['\\', "'", '"'], $r[3]); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | // S'agit-il d'un resultat constant ou contenant du code php |
| 225 | 225 | $process_ins = ( |
| 226 | - strpos($corps, '<' . '?') === false |
|
| 226 | + strpos($corps, '<'.'?') === false |
|
| 227 | 227 | or |
| 228 | - (strpos($corps, '<' . '?xml') !== false and |
|
| 229 | - strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 228 | + (strpos($corps, '<'.'?xml') !== false and |
|
| 229 | + strpos(str_replace('<'.'?xml', '', $corps), '<'.'?') === false) |
|
| 230 | 230 | ) |
| 231 | 231 | ? 'html' |
| 232 | 232 | : 'php'; |
@@ -255,10 +255,10 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | if ($process_ins == 'html') { |
| 257 | 257 | $skel['process_ins'] = ( |
| 258 | - strpos($corps, '<' . '?') === false |
|
| 258 | + strpos($corps, '<'.'?') === false |
|
| 259 | 259 | or |
| 260 | - (strpos($corps, '<' . '?xml') !== false and |
|
| 261 | - strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 260 | + (strpos($corps, '<'.'?xml') !== false and |
|
| 261 | + strpos(str_replace('<'.'?xml', '', $corps), '<'.'?') === false) |
|
| 262 | 262 | ) |
| 263 | 263 | ? 'html' |
| 264 | 264 | : 'php'; |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | // |
| 277 | 277 | |
| 278 | 278 | /** Code PHP pour inclure une balise dynamique à l'exécution d'une page */ |
| 279 | -define('CODE_INCLURE_BALISE', '<' . '?php |
|
| 279 | +define('CODE_INCLURE_BALISE', '<'.'?php |
|
| 280 | 280 | include_once("%s"); |
| 281 | 281 | if ($lang_select = "%s") $lang_select = lang_select($lang_select); |
| 282 | 282 | inserer_balise_dynamique(balise_%s_dyn(%s), array(%s)); |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | // pas de lien symbolique sous Windows |
| 308 | 308 | and !(stristr(PHP_OS, 'WIN') and str_contains($file, ':')) |
| 309 | 309 | ) { |
| 310 | - $file = './" . _DIR_RACINE . "' . $file; |
|
| 310 | + $file = './" . _DIR_RACINE . "'.$file; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | $lang = $context_compil[4]; |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | $args = array_map('argumenter_squelette', $args); |
| 319 | 319 | if (!empty($context_compil['appel_php_depuis_modele'])) { |
| 320 | - $args[0] = 'arguments_balise_dyn_depuis_modele(' . $args[0] . ')'; |
|
| 320 | + $args[0] = 'arguments_balise_dyn_depuis_modele('.$args[0].')'; |
|
| 321 | 321 | } |
| 322 | 322 | $args = join(', ', $args); |
| 323 | 323 | |
@@ -351,14 +351,14 @@ discard block |
||
| 351 | 351 | if (is_object($v)) { |
| 352 | 352 | return var_export($v, true); |
| 353 | 353 | } elseif (!is_array($v)) { |
| 354 | - return "'" . texte_script((string) $v) . "'"; |
|
| 354 | + return "'".texte_script((string) $v)."'"; |
|
| 355 | 355 | } else { |
| 356 | 356 | $out = []; |
| 357 | 357 | foreach ($v as $k => $val) { |
| 358 | - $out [] = argumenter_squelette($k) . '=>' . argumenter_squelette($val); |
|
| 358 | + $out [] = argumenter_squelette($k).'=>'.argumenter_squelette($val); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - return 'array(' . join(', ', $out) . ')'; |
|
| 361 | + return 'array('.join(', ', $out).')'; |
|
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | else { |
| 385 | 385 | $str_args = base64_encode(serialize($args)); |
| 386 | - return "<?" . "php \$_zargs=unserialize(base64_decode('$str_args'));echo executer_balise_dynamique(...\$_zargs); ?".">\n"; |
|
| 386 | + return "<?"."php \$_zargs=unserialize(base64_decode('$str_args'));echo executer_balise_dynamique(...\$_zargs); ?".">\n"; |
|
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | // Y a-t-il une fonction de traitement des arguments ? |
| 464 | - $f = 'balise_' . $nom_balise . '_stat'; |
|
| 464 | + $f = 'balise_'.$nom_balise.'_stat'; |
|
| 465 | 465 | |
| 466 | 466 | $r = !function_exists($f) ? $args : $f($args, $context_compil); |
| 467 | 467 | |
@@ -471,18 +471,18 @@ discard block |
||
| 471 | 471 | |
| 472 | 472 | // verifier que la fonction dyn est la, |
| 473 | 473 | // sinon se replier sur la generique si elle existe |
| 474 | - if (!function_exists('balise_' . $nom_balise . '_dyn')) { |
|
| 474 | + if (!function_exists('balise_'.$nom_balise.'_dyn')) { |
|
| 475 | 475 | if ( |
| 476 | 476 | $balise_generique = chercher_balise_generique($nom) |
| 477 | 477 | and $nom_balise_generique = $balise_generique['nom_generique'] |
| 478 | - and $file = include_spip('balise/' . strtolower($nom_balise_generique)) |
|
| 479 | - and function_exists('balise_' . $nom_balise_generique . '_dyn') |
|
| 478 | + and $file = include_spip('balise/'.strtolower($nom_balise_generique)) |
|
| 479 | + and function_exists('balise_'.$nom_balise_generique.'_dyn') |
|
| 480 | 480 | ) { |
| 481 | 481 | // et lui injecter en premier arg le nom de la balise |
| 482 | 482 | array_unshift($r, $nom); |
| 483 | 483 | $nom_balise = $nom_balise_generique; |
| 484 | 484 | if (!_DIR_RESTREINT) { |
| 485 | - $file = _DIR_RESTREINT_ABS . $file; |
|
| 485 | + $file = _DIR_RESTREINT_ABS.$file; |
|
| 486 | 486 | } |
| 487 | 487 | } else { |
| 488 | 488 | $msg = ['zbug_balise_inexistante', ['from' => 'CVT', 'balise' => $nom]]; |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | $n = ''; |
| 584 | 584 | foreach (explode(',', $liste) as $val) { |
| 585 | 585 | if ($a = intval($val) and $val === strval($a)) { |
| 586 | - $n .= ',' . $val; |
|
| 586 | + $n .= ','.$val; |
|
| 587 | 587 | } |
| 588 | 588 | } |
| 589 | 589 | if (strlen($n)) { |
@@ -762,8 +762,8 @@ discard block |
||
| 762 | 762 | // on construit le where une fois, puis on ajoute les where complentaires si besoin, et on reconstruit le where en fonction |
| 763 | 763 | $i = 0; |
| 764 | 764 | do { |
| 765 | - $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 766 | - [$sous[1] . ' AS id'], |
|
| 765 | + $where[$k] = remplace_sous_requete($w, '('.calculer_select( |
|
| 766 | + [$sous[1].' AS id'], |
|
| 767 | 767 | $from, |
| 768 | 768 | $from_type, |
| 769 | 769 | $wheresub, |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | $id, |
| 777 | 777 | $serveur, |
| 778 | 778 | false |
| 779 | - ) . ')'); |
|
| 779 | + ).')'); |
|
| 780 | 780 | if (!$i) { |
| 781 | 781 | $i = 1; |
| 782 | 782 | $wherestring = calculer_where_to_string($where[$k]); |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | if ($sous[0] == 'SUBSELECT') { |
| 797 | 797 | // c'est une sous requete explicite sous la forme identique a sql_select : (SUBSELECT,$select,$from,$where,$groupby,$orderby,$limit,$having) |
| 798 | 798 | array_push($where_simples, $sous[3]); // est-ce utile dans ce cas ? |
| 799 | - $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 799 | + $where[$k] = remplace_sous_requete($w, '('.calculer_select( |
|
| 800 | 800 | $sous[1], # select |
| 801 | 801 | $sous[2], #from |
| 802 | 802 | [], #from_type |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | $id, |
| 812 | 812 | $serveur, |
| 813 | 813 | false |
| 814 | - ) . ')'); |
|
| 814 | + ).')'); |
|
| 815 | 815 | } |
| 816 | 816 | array_pop($where_simples); |
| 817 | 817 | } |
@@ -874,15 +874,15 @@ discard block |
||
| 874 | 874 | // sans recours a preg_match |
| 875 | 875 | // un implode(' ',..) est fait dans reinjecte_joint un peu plus bas |
| 876 | 876 | $afrom[$t][$cle] = [ |
| 877 | - "\n" . |
|
| 878 | - ($from_type[$cle] ?? 'INNER') . ' JOIN', |
|
| 877 | + "\n". |
|
| 878 | + ($from_type[$cle] ?? 'INNER').' JOIN', |
|
| 879 | 879 | $from[$cle], |
| 880 | 880 | "AS $cle", |
| 881 | 881 | 'ON (', |
| 882 | 882 | "$cle.$c", |
| 883 | 883 | '=', |
| 884 | 884 | "$t.$carr", |
| 885 | - ($and ? 'AND ' . $and : '') . |
|
| 885 | + ($and ? 'AND '.$and : ''). |
|
| 886 | 886 | ')' |
| 887 | 887 | ]; |
| 888 | 888 | if (isset($afrom[$cle])) { |
@@ -920,7 +920,7 @@ discard block |
||
| 920 | 920 | $t = key($from); |
| 921 | 921 | $c = current($from); |
| 922 | 922 | reset($from); |
| 923 | - $e = '/\b(' . "$t\\." . join('|' . $t . '\.', $equiv) . ')\b/'; |
|
| 923 | + $e = '/\b('."$t\\.".join('|'.$t.'\.', $equiv).')\b/'; |
|
| 924 | 924 | if ( |
| 925 | 925 | !(strpos($t, ' ') or // jointure des le depart cf boucle_doc |
| 926 | 926 | calculer_jointnul($t, $select, $e) or |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | unset($afrom[$t][$nt]); |
| 939 | 939 | $afrom[$nt] = $afrom[$t]; |
| 940 | 940 | unset($afrom[$t]); |
| 941 | - $e = '/\b' . preg_quote($nfrom[6]) . '\b/'; |
|
| 941 | + $e = '/\b'.preg_quote($nfrom[6]).'\b/'; |
|
| 942 | 942 | $t = $nfrom[4]; |
| 943 | 943 | $alias = ''; |
| 944 | 944 | // verifier que les deux cles sont homonymes, sinon installer un alias dans le select |
@@ -949,14 +949,14 @@ discard block |
||
| 949 | 949 | if ($newcle != $oldcle) { |
| 950 | 950 | // si l'ancienne cle etait deja dans le select avec un AS |
| 951 | 951 | // reprendre simplement ce AS |
| 952 | - $as = '/\b' . preg_quote($nfrom[6]) . '\s+(AS\s+\w+)\b/'; |
|
| 952 | + $as = '/\b'.preg_quote($nfrom[6]).'\s+(AS\s+\w+)\b/'; |
|
| 953 | 953 | if (preg_match($as, implode(',', $select), $m)) { |
| 954 | 954 | $alias = ''; |
| 955 | 955 | } else { |
| 956 | - $alias = ', ' . $nfrom[4] . " AS $oldcle"; |
|
| 956 | + $alias = ', '.$nfrom[4]." AS $oldcle"; |
|
| 957 | 957 | } |
| 958 | 958 | } |
| 959 | - $select = remplacer_jointnul($t . $alias, $select, $e); |
|
| 959 | + $select = remplacer_jointnul($t.$alias, $select, $e); |
|
| 960 | 960 | $join = remplacer_jointnul($t, $join, $e); |
| 961 | 961 | $where = remplacer_jointnul($t, $where, $e); |
| 962 | 962 | $having = remplacer_jointnul($t, $having, $e); |
@@ -1006,9 +1006,9 @@ discard block |
||
| 1006 | 1006 | } else { |
| 1007 | 1007 | $exp = ''; |
| 1008 | 1008 | if (strtoupper($join) === 'AND') { |
| 1009 | - return $exp . join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 1009 | + return $exp.join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 1010 | 1010 | } else { |
| 1011 | - return $exp . join($join, $v); |
|
| 1011 | + return $exp.join($join, $v); |
|
| 1012 | 1012 | } |
| 1013 | 1013 | } |
| 1014 | 1014 | } |
@@ -1070,6 +1070,6 @@ discard block |
||
| 1070 | 1070 | } |
| 1071 | 1071 | |
| 1072 | 1072 | return $mime_type |
| 1073 | - . (!$connect ? '' : preg_replace('/\W/', '_', $connect)) . '_' |
|
| 1074 | - . md5($GLOBALS['spip_version_code'] . ' * ' . $skel . (isset($GLOBALS['marqueur_skel']) ? '*' . $GLOBALS['marqueur_skel'] : '')); |
|
| 1073 | + . (!$connect ? '' : preg_replace('/\W/', '_', $connect)).'_' |
|
| 1074 | + . md5($GLOBALS['spip_version_code'].' * '.$skel.(isset($GLOBALS['marqueur_skel']) ? '*'.$GLOBALS['marqueur_skel'] : '')); |
|
| 1075 | 1075 | } |
@@ -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 = $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 = [(is_countable($erreurs) ? count($erreurs) : 0) . ' ' . _T('zbug_erreur_squelette')]; |
|
| 187 | + $n = [(is_countable($erreurs) ? count($erreurs) : 0).' '._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 = []; |
| 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((string) entites_html($nom)) |
|
| 238 | - . '</strong></td><td>: ' . nl2br((string) entites_html($valeur)) |
|
| 237 | + $res .= "\n<tr><td><strong>".nl2br((string) entites_html($nom)) |
|
| 238 | + . '</strong></td><td>: '.nl2br((string) entites_html($valeur)) |
|
| 239 | 239 | . "</td></tr>\n"; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | if ($ligne) { |
| 261 | 261 | $msg .= " L$ligne"; |
| 262 | 262 | } |
| 263 | - spip_log($msg, "debusquer" . _LOG_ERREUR); |
|
| 263 | + spip_log($msg, "debusquer"._LOG_ERREUR); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
@@ -285,10 +285,10 @@ discard block |
||
| 285 | 285 | $nom_code = $lieu->descr['nom']; |
| 286 | 286 | $skel = $lieu->descr['sourcefile']; |
| 287 | 287 | $h2 = parametre_url($href, 'var_mode_objet', $nom_code); |
| 288 | - $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette') . '#L' . $ligne; |
|
| 288 | + $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette').'#L'.$ligne; |
|
| 289 | 289 | $skel = "<a href='$h3'><b>$skel</b></a>"; |
| 290 | 290 | if ($boucle) { |
| 291 | - $h3 = parametre_url($h2 . $boucle, 'var_mode_affiche', 'boucle'); |
|
| 291 | + $h3 = parametre_url($h2.$boucle, 'var_mode_affiche', 'boucle'); |
|
| 292 | 292 | $boucle = "<a href='$h3'><b>$boucle</b></a>"; |
| 293 | 293 | } |
| 294 | 294 | } |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | // Requete erronee |
| 380 | - $err = '<b>' . _T('avis_erreur_mysql') . " $errno</b><br /><tt>\n" |
|
| 380 | + $err = '<b>'._T('avis_erreur_mysql')." $errno</b><br /><tt>\n" |
|
| 381 | 381 | . spip_htmlspecialchars($msg) |
| 382 | 382 | . "\n<br /><span style='color: red'><b>" |
| 383 | 383 | . spip_htmlspecialchars($query) |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | |
| 392 | 392 | function trouve_boucle_debug($n, $nom, $debut = 0, $boucle = '') { |
| 393 | 393 | |
| 394 | - $id = $nom . $boucle; |
|
| 394 | + $id = $nom.$boucle; |
|
| 395 | 395 | if (is_array($GLOBALS['debug_objets']['sequence'][$id])) { |
| 396 | 396 | foreach ($GLOBALS['debug_objets']['sequence'][$id] as $v) { |
| 397 | 397 | if (!preg_match('/^(.*)(<\?.*\?>)(.*)$/s', $v[0], $r)) { |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | - $incl = ',' . $reg[1] . '[.]\w$,'; |
|
| 440 | + $incl = ','.$reg[1].'[.]\w$,'; |
|
| 441 | 441 | |
| 442 | 442 | foreach ($GLOBALS['debug_objets']['sourcefile'] as $k => $v) { |
| 443 | 443 | if (preg_match($incl, $v)) { |
@@ -452,16 +452,13 @@ discard block |
||
| 452 | 452 | [$skel, $boucle, $ligne] = trouve_boucle_debug($n, $nom); |
| 453 | 453 | |
| 454 | 454 | if (!$boucle) { |
| 455 | - return !$ligne ? '' : |
|
| 456 | - (' (' . |
|
| 457 | - (($nom != $skel) ? _T('squelette_inclus_ligne') : |
|
| 458 | - _T('squelette_ligne')) . |
|
| 455 | + return !$ligne ? '' : (' ('. |
|
| 456 | + (($nom != $skel) ? _T('squelette_inclus_ligne') : _T('squelette_ligne')). |
|
| 459 | 457 | " <a href='$self&var_mode_objet=$skel&var_mode_affiche=squelette&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"); |
| 460 | 458 | } else { |
| 461 | 459 | $self .= "&var_mode_objet=$skel$boucle&var_mode_affiche=boucle"; |
| 462 | 460 | |
| 463 | - return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : |
|
| 464 | - " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 461 | + 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>)"; |
|
| 465 | 462 | } |
| 466 | 463 | } |
| 467 | 464 | |
@@ -483,14 +480,14 @@ discard block |
||
| 483 | 480 | |
| 484 | 481 | $s = preg_replace( |
| 485 | 482 | ',<(\w[^<>]*)>([^<]*)<br />([^<]*)</\1>,', |
| 486 | - '<\1>\2</\1><br />' . "\n" . '<\1>\3</\1>', |
|
| 483 | + '<\1>\2</\1><br />'."\n".'<\1>\3</\1>', |
|
| 487 | 484 | $s |
| 488 | 485 | ); |
| 489 | 486 | |
| 490 | 487 | |
| 491 | 488 | $tableau = explode('<br />', $s); |
| 492 | 489 | |
| 493 | - $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"; |
|
| 490 | + $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"; |
|
| 494 | 491 | |
| 495 | 492 | $format10 = str_replace('white', 'lightgrey', $format); |
| 496 | 493 | $formaterr = 'color: red;'; |
@@ -534,7 +531,7 @@ discard block |
||
| 534 | 531 | . '" style="cursor: pointer;">' |
| 535 | 532 | . ($nocpt ? '' : _T('info_numero_abbreviation')) |
| 536 | 533 | . '</div> |
| 537 | - ' . $res . "</div>\n"; |
|
| 534 | + ' . $res."</div>\n"; |
|
| 538 | 535 | } |
| 539 | 536 | |
| 540 | 537 | // l'environnement graphique du debuggueur |
@@ -556,14 +553,14 @@ discard block |
||
| 556 | 553 | if (!empty($GLOBALS['debug_objets'][$mode][$fonc])) { |
| 557 | 554 | [$legend, $texte, $res2] = debusquer_source($fonc, $mode); |
| 558 | 555 | $texte .= $res2; |
| 559 | - } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc . 'tout'])) { |
|
| 560 | - $legend = _T('zbug_' . $mode); |
|
| 561 | - $texte = $GLOBALS['debug_objets'][$mode][$fonc . 'tout']; |
|
| 556 | + } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc.'tout'])) { |
|
| 557 | + $legend = _T('zbug_'.$mode); |
|
| 558 | + $texte = $GLOBALS['debug_objets'][$mode][$fonc.'tout']; |
|
| 562 | 559 | $texte = ancre_texte($texte, ['', '']); |
| 563 | 560 | } |
| 564 | 561 | } else { |
| 565 | 562 | if (strlen(trim($res))) { |
| 566 | - 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>"; |
|
| 563 | + 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>"; |
|
| 567 | 564 | } else { |
| 568 | 565 | // cas de l'appel sur erreur: montre la page |
| 569 | 566 | return $GLOBALS['debug_objets']['resultat']['tout'] ?? ''; |
@@ -571,7 +568,7 @@ discard block |
||
| 571 | 568 | } |
| 572 | 569 | } else { |
| 573 | 570 | $valider = charger_fonction('valider', 'xml'); |
| 574 | - $val = $valider($GLOBALS['debug_objets']['validation'][$fonc . 'tout']); |
|
| 571 | + $val = $valider($GLOBALS['debug_objets']['validation'][$fonc.'tout']); |
|
| 575 | 572 | // Si erreur, signaler leur nombre dans le formulaire admin |
| 576 | 573 | $GLOBALS['debug_objets']['validation'] = $val->err ? count($val->err) : ''; |
| 577 | 574 | [$texte, $err] = emboite_texte($val, $fonc, $self); |
@@ -582,14 +579,14 @@ discard block |
||
| 582 | 579 | } else { |
| 583 | 580 | $err = ": $err"; |
| 584 | 581 | } |
| 585 | - $legend = _T('validation') . ' ' . $err; |
|
| 582 | + $legend = _T('validation').' '.$err; |
|
| 586 | 583 | $res = $id = ''; |
| 587 | 584 | } |
| 588 | 585 | |
| 589 | 586 | return !trim($texte) ? '' : ( |
| 590 | - "<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" |
|
| 587 | + "<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" |
|
| 591 | 588 | . "<div id='debug_boucle'><fieldset$id><legend>" |
| 592 | - . "<a href='" . $self . '#f_' . substr($fonc, 0, 37) . "'> ↑ " |
|
| 589 | + . "<a href='".$self.'#f_'.substr($fonc, 0, 37)."'> ↑ " |
|
| 593 | 590 | . ($legend ?: $mode) |
| 594 | 591 | . '</a></legend>' |
| 595 | 592 | . $texte |
@@ -600,7 +597,7 @@ discard block |
||
| 600 | 597 | |
| 601 | 598 | function emboite_texte($res, $fonc = '', $self = '') { |
| 602 | 599 | $errs = $res->err; |
| 603 | - $texte = $res->entete . ($errs ? '' : $res->page); |
|
| 600 | + $texte = $res->entete.($errs ? '' : $res->page); |
|
| 604 | 601 | |
| 605 | 602 | if (!$texte and !$errs) { |
| 606 | 603 | return [ancre_texte('', ['', '']), false]; |
@@ -656,7 +653,7 @@ discard block |
||
| 656 | 653 | $err = "<h2 style='text-align: center'>" |
| 657 | 654 | . $i |
| 658 | 655 | . "<a href='#fin_err'>" |
| 659 | - . ' ' . _T('erreur_texte') |
|
| 656 | + . ' '._T('erreur_texte') |
|
| 660 | 657 | . "</a></h2><table id='debut_err' style='width: 100%'>" |
| 661 | 658 | . $err |
| 662 | 659 | . " </table><a id='fin_err'></a>"; |
@@ -666,9 +663,9 @@ discard block |
||
| 666 | 663 | [$msg, $fermant, $ouvrant] = $errs[0]; |
| 667 | 664 | $rf = reference_boucle_debug($fermant, $fonc, $self); |
| 668 | 665 | $ro = reference_boucle_debug($ouvrant, $fonc, $self); |
| 669 | - $err = $msg . |
|
| 670 | - "<a href='#L" . $fermant . "'>$fermant</a>$rf<br />" . |
|
| 671 | - "<a href='#L" . $ouvrant . "'>$ouvrant</a>$ro"; |
|
| 666 | + $err = $msg. |
|
| 667 | + "<a href='#L".$fermant."'>$fermant</a>$rf<br />". |
|
| 668 | + "<a href='#L".$ouvrant."'>$ouvrant</a>$ro"; |
|
| 672 | 669 | |
| 673 | 670 | return [ancre_texte($texte, [[$ouvrant], [$fermant]]), $err]; |
| 674 | 671 | } |
@@ -701,7 +698,7 @@ discard block |
||
| 701 | 698 | ['time' => $GLOBALS['debug_objets']['profile'][$sourcefile]] |
| 702 | 699 | ); |
| 703 | 700 | |
| 704 | - $res .= "<fieldset id='f_" . $nom . "'><legend>" |
|
| 701 | + $res .= "<fieldset id='f_".$nom."'><legend>" |
|
| 705 | 702 | . $t_skel |
| 706 | 703 | . ' ' |
| 707 | 704 | . $sourcefile |
@@ -716,7 +713,7 @@ discard block |
||
| 716 | 713 | . "'>" |
| 717 | 714 | . _T('zbug_calcul') |
| 718 | 715 | . '</a></legend>' |
| 719 | - . (!$temps ? '' : ("\n<span style='display:block;float:" . $GLOBALS['spip_lang_right'] . "'>$temps</span><br />")) |
|
| 716 | + . (!$temps ? '' : ("\n<span style='display:block;float:".$GLOBALS['spip_lang_right']."'>$temps</span><br />")) |
|
| 720 | 717 | . debusquer_contexte($contexte[$sourcefile]) |
| 721 | 718 | . (!$nav ? '' : ("<table width='100%'>\n$nav</table>\n")) |
| 722 | 719 | . "</fieldset>\n"; |
@@ -737,33 +734,33 @@ discard block |
||
| 737 | 734 | $nom = $boucle->id_boucle; |
| 738 | 735 | $req = $boucle->type_requete; |
| 739 | 736 | $crit = public_decompiler($boucle, $gram, 0, 'criteres'); |
| 740 | - $self2 = $self . '&var_mode_objet=' . $objet; |
|
| 741 | - |
|
| 742 | - $res .= "\n<tr style='background-color: " . |
|
| 743 | - ($i % 2 ? '#e0e0f0' : '#f8f8ff') . |
|
| 744 | - "'><td align='right'>$i</td><td>\n" . |
|
| 745 | - "<a class='debug_link_boucle' href='" . |
|
| 746 | - $self2 . |
|
| 747 | - "&var_mode_affiche=boucle#f_$nom_skel'>" . |
|
| 748 | - _T('zbug_boucle') . |
|
| 749 | - "</a></td><td>\n<a class='debug_link_boucle' href='" . |
|
| 750 | - $self2 . |
|
| 751 | - "&var_mode_affiche=resultat#f_$nom_skel'>" . |
|
| 752 | - _T('zbug_resultat') . |
|
| 753 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 754 | - $self2 . |
|
| 755 | - "&var_mode_affiche=code#f_$nom_skel'>" . |
|
| 756 | - _T('zbug_code') . |
|
| 757 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 758 | - str_replace('var_mode=', 'var_profile=', $self2) . |
|
| 759 | - "'>" . |
|
| 760 | - _T('zbug_calcul') . |
|
| 761 | - "</a></td><td>\n" . |
|
| 762 | - (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom) . |
|
| 763 | - "</td><td>\n" . |
|
| 764 | - $req . |
|
| 765 | - "</td><td>\n" . |
|
| 766 | - spip_htmlspecialchars($crit) . |
|
| 737 | + $self2 = $self.'&var_mode_objet='.$objet; |
|
| 738 | + |
|
| 739 | + $res .= "\n<tr style='background-color: ". |
|
| 740 | + ($i % 2 ? '#e0e0f0' : '#f8f8ff'). |
|
| 741 | + "'><td align='right'>$i</td><td>\n". |
|
| 742 | + "<a class='debug_link_boucle' href='". |
|
| 743 | + $self2. |
|
| 744 | + "&var_mode_affiche=boucle#f_$nom_skel'>". |
|
| 745 | + _T('zbug_boucle'). |
|
| 746 | + "</a></td><td>\n<a class='debug_link_boucle' href='". |
|
| 747 | + $self2. |
|
| 748 | + "&var_mode_affiche=resultat#f_$nom_skel'>". |
|
| 749 | + _T('zbug_resultat'). |
|
| 750 | + "</a></td><td>\n<a class='debug_link_resultat' href='". |
|
| 751 | + $self2. |
|
| 752 | + "&var_mode_affiche=code#f_$nom_skel'>". |
|
| 753 | + _T('zbug_code'). |
|
| 754 | + "</a></td><td>\n<a class='debug_link_resultat' href='". |
|
| 755 | + str_replace('var_mode=', 'var_profile=', $self2). |
|
| 756 | + "'>". |
|
| 757 | + _T('zbug_calcul'). |
|
| 758 | + "</a></td><td>\n". |
|
| 759 | + (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom). |
|
| 760 | + "</td><td>\n". |
|
| 761 | + $req. |
|
| 762 | + "</td><td>\n". |
|
| 763 | + spip_htmlspecialchars($crit). |
|
| 767 | 764 | '</td></tr>'; |
| 768 | 765 | } |
| 769 | 766 | } |
@@ -790,7 +787,7 @@ discard block |
||
| 790 | 787 | } |
| 791 | 788 | // permettre le copier/coller facile |
| 792 | 789 | // $res = ancre_texte($req, array(), true); |
| 793 | - $res = "<div id='T" . md5($req) . "'>\n<pre>\n" . $req . "</pre>\n</div>\n"; |
|
| 790 | + $res = "<div id='T".md5($req)."'>\n<pre>\n".$req."</pre>\n</div>\n"; |
|
| 794 | 791 | // formatage et affichage des resultats bruts de la requete |
| 795 | 792 | $ress_req = spip_query($req); |
| 796 | 793 | $brut_sql = ''; |
@@ -800,10 +797,10 @@ discard block |
||
| 800 | 797 | $max_aff = defined('_MAX_DEBUG_AFF') ? _MAX_DEBUG_AFF : 50; |
| 801 | 798 | while ($retours_sql = sql_fetch($ress_req)) { |
| 802 | 799 | if ($num <= $max_aff) { |
| 803 | - $brut_sql .= '<h3>' . ($num == 1 ? $num . ' sur ' . sql_count($ress_req) : $num) . '</h3>'; |
|
| 800 | + $brut_sql .= '<h3>'.($num == 1 ? $num.' sur '.sql_count($ress_req) : $num).'</h3>'; |
|
| 804 | 801 | $brut_sql .= '<p>'; |
| 805 | 802 | foreach ($retours_sql as $key => $val) { |
| 806 | - $brut_sql .= '<strong>' . $key . '</strong> => ' . spip_htmlspecialchars(couper($val, 150)) . "<br />\n"; |
|
| 803 | + $brut_sql .= '<strong>'.$key.'</strong> => '.spip_htmlspecialchars(couper($val, 150))."<br />\n"; |
|
| 807 | 804 | } |
| 808 | 805 | $brut_sql .= '</p>'; |
| 809 | 806 | } |
@@ -814,14 +811,14 @@ discard block |
||
| 814 | 811 | // ne pas afficher les $contexte_inclus |
| 815 | 812 | $view = preg_replace(',<\?php.+\?[>],Uims', '', $view); |
| 816 | 813 | if ($view) { |
| 817 | - $res2 .= "\n<br /><fieldset>" . interdire_scripts($view) . '</fieldset>'; |
|
| 814 | + $res2 .= "\n<br /><fieldset>".interdire_scripts($view).'</fieldset>'; |
|
| 818 | 815 | } |
| 819 | 816 | } |
| 820 | 817 | } elseif ($affiche == 'code') { |
| 821 | 818 | $legend = $nom; |
| 822 | - $res = ancre_texte('<' . "?php\n" . $quoi . "\n?" . '>'); |
|
| 819 | + $res = ancre_texte('<'."?php\n".$quoi."\n?".'>'); |
|
| 823 | 820 | } elseif ($affiche == 'boucle') { |
| 824 | - $legend = _T('zbug_boucle') . ' ' . $nom; |
|
| 821 | + $legend = _T('zbug_boucle').' '.$nom; |
|
| 825 | 822 | // Le compilateur prefixe le nom des boucles par l'extension du fichier source. |
| 826 | 823 | $gram = preg_match('/^([^_]+)_/', $objet, $r) ? $r[1] : ''; |
| 827 | 824 | $res = ancre_texte(public_decompiler($quoi, $gram, 0, 'boucle')); |
@@ -839,23 +836,23 @@ discard block |
||
| 839 | 836 | include_spip('public/assembler'); // pour inclure_balise_dynamique |
| 840 | 837 | include_spip('inc/texte'); // pour corriger_typo |
| 841 | 838 | |
| 842 | - return _DOCTYPE_ECRIRE . |
|
| 843 | - html_lang_attributes() . |
|
| 844 | - "<head>\n<title>" . |
|
| 845 | - ('SPIP ' . $GLOBALS['spip_version_affichee'] . ' ' . |
|
| 846 | - _T('admin_debug') . ' ' . spip_htmlspecialchars($titre) . ' (' . |
|
| 847 | - supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))) . |
|
| 848 | - ")</title>\n" . |
|
| 849 | - "<meta http-equiv='Content-Type' content='text/html" . |
|
| 850 | - (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : '') . |
|
| 851 | - "' />\n" . |
|
| 839 | + return _DOCTYPE_ECRIRE. |
|
| 840 | + html_lang_attributes(). |
|
| 841 | + "<head>\n<title>". |
|
| 842 | + ('SPIP '.$GLOBALS['spip_version_affichee'].' '. |
|
| 843 | + _T('admin_debug').' '.spip_htmlspecialchars($titre).' ('. |
|
| 844 | + supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))). |
|
| 845 | + ")</title>\n". |
|
| 846 | + "<meta http-equiv='Content-Type' content='text/html". |
|
| 847 | + (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : ''). |
|
| 848 | + "' />\n". |
|
| 852 | 849 | http_script('', 'jquery.js') |
| 853 | - . "<link rel='stylesheet' href='" . url_absolue(find_in_path('spip_admin.css')) |
|
| 854 | - . "' type='text/css' />" . |
|
| 855 | - "</head>\n" . |
|
| 856 | - "<body style='margin:0 10px;'>\n" . |
|
| 857 | - "<div id='spip-debug-header'>" . |
|
| 858 | - $corps . |
|
| 859 | - inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false) . |
|
| 850 | + . "<link rel='stylesheet' href='".url_absolue(find_in_path('spip_admin.css')) |
|
| 851 | + . "' type='text/css' />". |
|
| 852 | + "</head>\n". |
|
| 853 | + "<body style='margin:0 10px;'>\n". |
|
| 854 | + "<div id='spip-debug-header'>". |
|
| 855 | + $corps. |
|
| 856 | + inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false). |
|
| 860 | 857 | '</div></body></html>'; |
| 861 | 858 | } |
@@ -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'); |
@@ -68,133 +68,133 @@ discard block |
||
| 68 | 68 | * - true si $opt 'erreurs' = 'reset' |
| 69 | 69 | **/ |
| 70 | 70 | function public_debusquer_dist($message = '', $lieu = '', $opt = []) { |
| 71 | - static $should_log; |
|
| 72 | - static $tableau_des_erreurs = []; |
|
| 73 | - |
|
| 74 | - // Pour des tests unitaires, pouvoir récupérer les erreurs générées |
|
| 75 | - if (isset($opt['erreurs'])) { |
|
| 76 | - if ($opt['erreurs'] == 'get') { |
|
| 77 | - return $tableau_des_erreurs; |
|
| 78 | - } |
|
| 79 | - if ($opt['erreurs'] == 'reset') { |
|
| 80 | - $tableau_des_erreurs = []; |
|
| 81 | - |
|
| 82 | - return true; |
|
| 83 | - } |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - if (is_null($should_log)) { |
|
| 87 | - $should_log = (empty($GLOBALS['visiteur_session']) || !include_spip('inc/autoriser') || !autoriser('debug')); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - // Erreur ou appel final ? |
|
| 91 | - if ($message) { |
|
| 92 | - $message = debusquer_compose_message($message); |
|
| 93 | - $tableau_des_erreurs[] = [$message, $lieu]; |
|
| 94 | - set_request('var_mode', 'debug'); |
|
| 95 | - $GLOBALS['bouton_admin_debug'] = true; |
|
| 96 | - // Permettre a la compil de continuer |
|
| 97 | - if (is_object($lieu) and (!isset($lieu->code) or !$lieu->code)) { |
|
| 98 | - $lieu->code = "''"; |
|
| 99 | - } |
|
| 100 | - // loger si personne ne verra l'erreur |
|
| 101 | - if ($should_log) { |
|
| 102 | - debusquer_loger_erreur($message, $lieu); |
|
| 103 | - } |
|
| 104 | - // forcer l'appel au debusqueur en cas de boucles infernales |
|
| 105 | - $urgence = (_DEBUG_MAX_SQUELETTE_ERREURS and (is_countable($tableau_des_erreurs) ? count($tableau_des_erreurs) : 0) > _DEBUG_MAX_SQUELETTE_ERREURS); |
|
| 106 | - if (!$urgence) { |
|
| 107 | - return; |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - if (empty($GLOBALS['debug_objets']['principal'])) { |
|
| 111 | - // espace public ? |
|
| 112 | - if (isset($GLOBALS['fond'])) { |
|
| 113 | - $GLOBALS['debug_objets']['principal'] = $GLOBALS['fond']; |
|
| 114 | - } |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - include_spip('inc/autoriser'); |
|
| 118 | - if (!autoriser('debug')) { |
|
| 119 | - return; |
|
| 120 | - } |
|
| 121 | - include_spip('inc/headers'); |
|
| 122 | - include_spip('inc/filtres'); |
|
| 123 | - |
|
| 124 | - lang_select($GLOBALS['visiteur_session']['lang'] ?? null); |
|
| 125 | - $fonc = preg_replace(',\W,', '_', _request('var_mode_objet') ?? ''); |
|
| 126 | - $mode = preg_replace(',\W,', '_', _request('var_mode_affiche') ?? ''); |
|
| 127 | - |
|
| 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_response_code(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; |
|
| 71 | + static $should_log; |
|
| 72 | + static $tableau_des_erreurs = []; |
|
| 73 | + |
|
| 74 | + // Pour des tests unitaires, pouvoir récupérer les erreurs générées |
|
| 75 | + if (isset($opt['erreurs'])) { |
|
| 76 | + if ($opt['erreurs'] == 'get') { |
|
| 77 | + return $tableau_des_erreurs; |
|
| 78 | + } |
|
| 79 | + if ($opt['erreurs'] == 'reset') { |
|
| 80 | + $tableau_des_erreurs = []; |
|
| 81 | + |
|
| 82 | + return true; |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + if (is_null($should_log)) { |
|
| 87 | + $should_log = (empty($GLOBALS['visiteur_session']) || !include_spip('inc/autoriser') || !autoriser('debug')); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + // Erreur ou appel final ? |
|
| 91 | + if ($message) { |
|
| 92 | + $message = debusquer_compose_message($message); |
|
| 93 | + $tableau_des_erreurs[] = [$message, $lieu]; |
|
| 94 | + set_request('var_mode', 'debug'); |
|
| 95 | + $GLOBALS['bouton_admin_debug'] = true; |
|
| 96 | + // Permettre a la compil de continuer |
|
| 97 | + if (is_object($lieu) and (!isset($lieu->code) or !$lieu->code)) { |
|
| 98 | + $lieu->code = "''"; |
|
| 99 | + } |
|
| 100 | + // loger si personne ne verra l'erreur |
|
| 101 | + if ($should_log) { |
|
| 102 | + debusquer_loger_erreur($message, $lieu); |
|
| 103 | + } |
|
| 104 | + // forcer l'appel au debusqueur en cas de boucles infernales |
|
| 105 | + $urgence = (_DEBUG_MAX_SQUELETTE_ERREURS and (is_countable($tableau_des_erreurs) ? count($tableau_des_erreurs) : 0) > _DEBUG_MAX_SQUELETTE_ERREURS); |
|
| 106 | + if (!$urgence) { |
|
| 107 | + return; |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | + if (empty($GLOBALS['debug_objets']['principal'])) { |
|
| 111 | + // espace public ? |
|
| 112 | + if (isset($GLOBALS['fond'])) { |
|
| 113 | + $GLOBALS['debug_objets']['principal'] = $GLOBALS['fond']; |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + include_spip('inc/autoriser'); |
|
| 118 | + if (!autoriser('debug')) { |
|
| 119 | + return; |
|
| 120 | + } |
|
| 121 | + include_spip('inc/headers'); |
|
| 122 | + include_spip('inc/filtres'); |
|
| 123 | + |
|
| 124 | + lang_select($GLOBALS['visiteur_session']['lang'] ?? null); |
|
| 125 | + $fonc = preg_replace(',\W,', '_', _request('var_mode_objet') ?? ''); |
|
| 126 | + $mode = preg_replace(',\W,', '_', _request('var_mode_affiche') ?? ''); |
|
| 127 | + |
|
| 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_response_code(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 = $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 = $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 = [(is_countable($erreurs) ? count($erreurs) : 0) . ' ' . _T('zbug_erreur_squelette')]; |
|
| 186 | + if (!empty($erreurs)) { |
|
| 187 | + $n = [(is_countable($erreurs) ? count($erreurs) : 0) . ' ' . _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 | - [$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 | + [$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,63 +204,63 @@ 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 = []; |
|
| 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((string) entites_html($nom)) |
|
| 238 | - . '</strong></td><td>: ' . nl2br((string) 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 = []; |
|
| 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((string) entites_html($nom)) |
|
| 238 | + . '</strong></td><td>: ' . nl2br((string) 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 | |
| 246 | 246 | function debusquer_loger_erreur($msg, $lieu) { |
| 247 | - $boucle = $ligne = $skel = ''; |
|
| 248 | - if (is_object($lieu)) { |
|
| 249 | - $ligne = ($lieu->ligne ?? ''); |
|
| 250 | - $boucle = ($lieu->id_boucle ?? ''); |
|
| 251 | - $skel = ($lieu->descr['sourcefile'] ?? ''); |
|
| 252 | - } |
|
| 253 | - $msg = (is_array($msg) ? implode('', $msg) : $msg); |
|
| 254 | - if ($skel) { |
|
| 255 | - $msg .= " Squelette $skel"; |
|
| 256 | - } |
|
| 257 | - if ($boucle) { |
|
| 258 | - $msg .= " Boucle $boucle"; |
|
| 259 | - } |
|
| 260 | - if ($ligne) { |
|
| 261 | - $msg .= " L$ligne"; |
|
| 262 | - } |
|
| 263 | - spip_log($msg, "debusquer" . _LOG_ERREUR); |
|
| 247 | + $boucle = $ligne = $skel = ''; |
|
| 248 | + if (is_object($lieu)) { |
|
| 249 | + $ligne = ($lieu->ligne ?? ''); |
|
| 250 | + $boucle = ($lieu->id_boucle ?? ''); |
|
| 251 | + $skel = ($lieu->descr['sourcefile'] ?? ''); |
|
| 252 | + } |
|
| 253 | + $msg = (is_array($msg) ? implode('', $msg) : $msg); |
|
| 254 | + if ($skel) { |
|
| 255 | + $msg .= " Squelette $skel"; |
|
| 256 | + } |
|
| 257 | + if ($boucle) { |
|
| 258 | + $msg .= " Boucle $boucle"; |
|
| 259 | + } |
|
| 260 | + if ($ligne) { |
|
| 261 | + $msg .= " L$ligne"; |
|
| 262 | + } |
|
| 263 | + spip_log($msg, "debusquer" . _LOG_ERREUR); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
@@ -269,66 +269,66 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | function debusquer_navigation($tableau, $caption = [], $id = 'debug-nav') { |
| 271 | 271 | |
| 272 | - if (_request('exec') == 'valider_xml') { |
|
| 273 | - return ''; |
|
| 274 | - } |
|
| 275 | - $GLOBALS['bouton_admin_debug'] = true; |
|
| 276 | - $res = ''; |
|
| 277 | - $href = quote_amp(parametre_url($GLOBALS['REQUEST_URI'], 'var_mode', 'debug')); |
|
| 278 | - foreach ($tableau as $i => $err) { |
|
| 279 | - $boucle = $ligne = $skel = ''; |
|
| 280 | - [$msg, $lieu] = $err; |
|
| 281 | - if (is_object($lieu)) { |
|
| 282 | - $ligne = $lieu->ligne; |
|
| 283 | - $boucle = !empty($lieu->id_boucle) ? $lieu->id_boucle : ''; |
|
| 284 | - if (isset($lieu->descr['nom'])) { |
|
| 285 | - $nom_code = $lieu->descr['nom']; |
|
| 286 | - $skel = $lieu->descr['sourcefile']; |
|
| 287 | - $h2 = parametre_url($href, 'var_mode_objet', $nom_code); |
|
| 288 | - $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette') . '#L' . $ligne; |
|
| 289 | - $skel = "<a href='$h3'><b>$skel</b></a>"; |
|
| 290 | - if ($boucle) { |
|
| 291 | - $h3 = parametre_url($h2 . $boucle, 'var_mode_affiche', 'boucle'); |
|
| 292 | - $boucle = "<a href='$h3'><b>$boucle</b></a>"; |
|
| 293 | - } |
|
| 294 | - } |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - $j = ($i + 1); |
|
| 298 | - $res .= "<tr id='req$j'><td style='text-align: right'>" |
|
| 299 | - . $j |
|
| 300 | - . " </td><td style='text-align: left'>" |
|
| 301 | - . (is_array($msg) ? implode('', $msg) : $msg) |
|
| 302 | - . "</td><td style='text-align: left'>" |
|
| 303 | - . ($skel ?: ' / ') |
|
| 304 | - . "</td><td class='spip-debug-arg' style='text-align: left'>" |
|
| 305 | - . ($boucle ?: ' / ') |
|
| 306 | - . "</td><td style='text-align: right'>" |
|
| 307 | - . $ligne |
|
| 308 | - . "</td></tr>\n"; |
|
| 309 | - } |
|
| 310 | - |
|
| 311 | - return "\n<table id='$id'>" |
|
| 312 | - . "<caption onclick=\"x = document.getElementById('$id'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\">" |
|
| 313 | - . $caption[0] |
|
| 272 | + if (_request('exec') == 'valider_xml') { |
|
| 273 | + return ''; |
|
| 274 | + } |
|
| 275 | + $GLOBALS['bouton_admin_debug'] = true; |
|
| 276 | + $res = ''; |
|
| 277 | + $href = quote_amp(parametre_url($GLOBALS['REQUEST_URI'], 'var_mode', 'debug')); |
|
| 278 | + foreach ($tableau as $i => $err) { |
|
| 279 | + $boucle = $ligne = $skel = ''; |
|
| 280 | + [$msg, $lieu] = $err; |
|
| 281 | + if (is_object($lieu)) { |
|
| 282 | + $ligne = $lieu->ligne; |
|
| 283 | + $boucle = !empty($lieu->id_boucle) ? $lieu->id_boucle : ''; |
|
| 284 | + if (isset($lieu->descr['nom'])) { |
|
| 285 | + $nom_code = $lieu->descr['nom']; |
|
| 286 | + $skel = $lieu->descr['sourcefile']; |
|
| 287 | + $h2 = parametre_url($href, 'var_mode_objet', $nom_code); |
|
| 288 | + $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette') . '#L' . $ligne; |
|
| 289 | + $skel = "<a href='$h3'><b>$skel</b></a>"; |
|
| 290 | + if ($boucle) { |
|
| 291 | + $h3 = parametre_url($h2 . $boucle, 'var_mode_affiche', 'boucle'); |
|
| 292 | + $boucle = "<a href='$h3'><b>$boucle</b></a>"; |
|
| 293 | + } |
|
| 294 | + } |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + $j = ($i + 1); |
|
| 298 | + $res .= "<tr id='req$j'><td style='text-align: right'>" |
|
| 299 | + . $j |
|
| 300 | + . " </td><td style='text-align: left'>" |
|
| 301 | + . (is_array($msg) ? implode('', $msg) : $msg) |
|
| 302 | + . "</td><td style='text-align: left'>" |
|
| 303 | + . ($skel ?: ' / ') |
|
| 304 | + . "</td><td class='spip-debug-arg' style='text-align: left'>" |
|
| 305 | + . ($boucle ?: ' / ') |
|
| 306 | + . "</td><td style='text-align: right'>" |
|
| 307 | + . $ligne |
|
| 308 | + . "</td></tr>\n"; |
|
| 309 | + } |
|
| 310 | + |
|
| 311 | + return "\n<table id='$id'>" |
|
| 312 | + . "<caption onclick=\"x = document.getElementById('$id'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\">" |
|
| 313 | + . $caption[0] |
|
| 314 | 314 | ## aide locale courte a ecrire, avec lien vers une grosse page de documentation |
| 315 | 315 | # aider('erreur_compilation'), |
| 316 | - . '</caption>' |
|
| 317 | - // fausse caption du chrono (mais vraie nav) |
|
| 318 | - . (!empty($caption[1]) ? $caption[1] : '') |
|
| 319 | - . '<tr><th>' |
|
| 320 | - . _T('numero') |
|
| 321 | - . '</th><th>' |
|
| 322 | - . _T('public:message') |
|
| 323 | - . '</th><th>' |
|
| 324 | - . _T('squelette') |
|
| 325 | - . '</th><th>' |
|
| 326 | - . _T('zbug_boucle') |
|
| 327 | - . '</th><th>' |
|
| 328 | - . _T('ligne') |
|
| 329 | - . '</th></tr>' |
|
| 330 | - . $res |
|
| 331 | - . '</table>'; |
|
| 316 | + . '</caption>' |
|
| 317 | + // fausse caption du chrono (mais vraie nav) |
|
| 318 | + . (!empty($caption[1]) ? $caption[1] : '') |
|
| 319 | + . '<tr><th>' |
|
| 320 | + . _T('numero') |
|
| 321 | + . '</th><th>' |
|
| 322 | + . _T('public:message') |
|
| 323 | + . '</th><th>' |
|
| 324 | + . _T('squelette') |
|
| 325 | + . '</th><th>' |
|
| 326 | + . _T('zbug_boucle') |
|
| 327 | + . '</th><th>' |
|
| 328 | + . _T('ligne') |
|
| 329 | + . '</th></tr>' |
|
| 330 | + . $res |
|
| 331 | + . '</table>'; |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | |
@@ -348,514 +348,514 @@ discard block |
||
| 348 | 348 | * ou un tableau si l'erreur est critique |
| 349 | 349 | **/ |
| 350 | 350 | function debusquer_requete($message) { |
| 351 | - [$errno, $msg, $query] = $message; |
|
| 352 | - |
|
| 353 | - // FIXME: ces écritures mélangent divers syntaxe des moteurs SQL |
|
| 354 | - // il serait plus prudent certainement d'avoir une fonction d'analyse par moteur |
|
| 355 | - if (preg_match(',err(no|code):?[[:space:]]*([0-9]+),i', $msg, $regs)) { |
|
| 356 | - $errno = $regs[2]; |
|
| 357 | - } elseif ( |
|
| 358 | - is_numeric($errno) and ($errno == 1030 or $errno <= 1026) |
|
| 359 | - and preg_match(',[^[:alnum:]]([0-9]+)[^[:alnum:]],', $msg, $regs) |
|
| 360 | - ) { |
|
| 361 | - $errno = $regs[1]; |
|
| 362 | - } |
|
| 363 | - |
|
| 364 | - // Erreur systeme |
|
| 365 | - if (is_numeric($errno) and $errno > 0 and $errno < 200) { |
|
| 366 | - $retour = '<tt><br /><br /><blink>' |
|
| 367 | - . _T('info_erreur_systeme', ['errsys' => $errno]) |
|
| 368 | - . "</blink><br />\n<b>" |
|
| 369 | - . _T( |
|
| 370 | - 'info_erreur_systeme2', |
|
| 371 | - ['script' => generer_url_ecrire('base_repair')] |
|
| 372 | - ) |
|
| 373 | - . '</b><br />'; |
|
| 374 | - spip_log("Erreur systeme $errno"); |
|
| 375 | - |
|
| 376 | - return [$retour, '']; |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - // Requete erronee |
|
| 380 | - $err = '<b>' . _T('avis_erreur_mysql') . " $errno</b><br /><tt>\n" |
|
| 381 | - . spip_htmlspecialchars($msg) |
|
| 382 | - . "\n<br /><span style='color: red'><b>" |
|
| 383 | - . spip_htmlspecialchars($query) |
|
| 384 | - . '</b></span></tt><br />'; |
|
| 385 | - |
|
| 386 | - //. aider('erreur_mysql'); |
|
| 387 | - |
|
| 388 | - return $err; |
|
| 351 | + [$errno, $msg, $query] = $message; |
|
| 352 | + |
|
| 353 | + // FIXME: ces écritures mélangent divers syntaxe des moteurs SQL |
|
| 354 | + // il serait plus prudent certainement d'avoir une fonction d'analyse par moteur |
|
| 355 | + if (preg_match(',err(no|code):?[[:space:]]*([0-9]+),i', $msg, $regs)) { |
|
| 356 | + $errno = $regs[2]; |
|
| 357 | + } elseif ( |
|
| 358 | + is_numeric($errno) and ($errno == 1030 or $errno <= 1026) |
|
| 359 | + and preg_match(',[^[:alnum:]]([0-9]+)[^[:alnum:]],', $msg, $regs) |
|
| 360 | + ) { |
|
| 361 | + $errno = $regs[1]; |
|
| 362 | + } |
|
| 363 | + |
|
| 364 | + // Erreur systeme |
|
| 365 | + if (is_numeric($errno) and $errno > 0 and $errno < 200) { |
|
| 366 | + $retour = '<tt><br /><br /><blink>' |
|
| 367 | + . _T('info_erreur_systeme', ['errsys' => $errno]) |
|
| 368 | + . "</blink><br />\n<b>" |
|
| 369 | + . _T( |
|
| 370 | + 'info_erreur_systeme2', |
|
| 371 | + ['script' => generer_url_ecrire('base_repair')] |
|
| 372 | + ) |
|
| 373 | + . '</b><br />'; |
|
| 374 | + spip_log("Erreur systeme $errno"); |
|
| 375 | + |
|
| 376 | + return [$retour, '']; |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + // Requete erronee |
|
| 380 | + $err = '<b>' . _T('avis_erreur_mysql') . " $errno</b><br /><tt>\n" |
|
| 381 | + . spip_htmlspecialchars($msg) |
|
| 382 | + . "\n<br /><span style='color: red'><b>" |
|
| 383 | + . spip_htmlspecialchars($query) |
|
| 384 | + . '</b></span></tt><br />'; |
|
| 385 | + |
|
| 386 | + //. aider('erreur_mysql'); |
|
| 387 | + |
|
| 388 | + return $err; |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | |
| 392 | 392 | function trouve_boucle_debug($n, $nom, $debut = 0, $boucle = '') { |
| 393 | 393 | |
| 394 | - $id = $nom . $boucle; |
|
| 395 | - if (is_array($GLOBALS['debug_objets']['sequence'][$id])) { |
|
| 396 | - foreach ($GLOBALS['debug_objets']['sequence'][$id] as $v) { |
|
| 397 | - if (!preg_match('/^(.*)(<\?.*\?>)(.*)$/s', $v[0], $r)) { |
|
| 398 | - $y = substr_count($v[0], "\n"); |
|
| 399 | - } else { |
|
| 400 | - if ($v[1][0] == '#') { // balise dynamique |
|
| 401 | - $incl = $GLOBALS['debug_objets']['resultat'][$v[2]]; |
|
| 402 | - } else // inclusion |
|
| 403 | - { |
|
| 404 | - $incl = $GLOBALS['debug_objets']['squelette'][trouve_squelette_inclus($v[0])]; |
|
| 405 | - } |
|
| 406 | - $y = substr_count($incl, "\n") |
|
| 407 | - + substr_count($r[1], "\n") |
|
| 408 | - + substr_count($r[3], "\n"); |
|
| 409 | - } |
|
| 410 | - if ($n <= ($y + $debut)) { |
|
| 411 | - if ($v[1][0] == '?') { |
|
| 412 | - return trouve_boucle_debug($n, $nom, $debut, substr($v[1], 1)); |
|
| 413 | - } elseif ($v[1][0] == '!') { |
|
| 414 | - if ($incl = trouve_squelette_inclus($v[1])) { |
|
| 415 | - return trouve_boucle_debug($n, $incl, $debut); |
|
| 416 | - } |
|
| 417 | - } |
|
| 418 | - |
|
| 419 | - return [$nom, $boucle, $v[2] - 1 + $n - $debut]; |
|
| 420 | - } |
|
| 421 | - $debut += $y; |
|
| 422 | - } |
|
| 423 | - } |
|
| 424 | - |
|
| 425 | - return [$nom, $boucle, $n - $debut]; |
|
| 394 | + $id = $nom . $boucle; |
|
| 395 | + if (is_array($GLOBALS['debug_objets']['sequence'][$id])) { |
|
| 396 | + foreach ($GLOBALS['debug_objets']['sequence'][$id] as $v) { |
|
| 397 | + if (!preg_match('/^(.*)(<\?.*\?>)(.*)$/s', $v[0], $r)) { |
|
| 398 | + $y = substr_count($v[0], "\n"); |
|
| 399 | + } else { |
|
| 400 | + if ($v[1][0] == '#') { // balise dynamique |
|
| 401 | + $incl = $GLOBALS['debug_objets']['resultat'][$v[2]]; |
|
| 402 | + } else // inclusion |
|
| 403 | + { |
|
| 404 | + $incl = $GLOBALS['debug_objets']['squelette'][trouve_squelette_inclus($v[0])]; |
|
| 405 | + } |
|
| 406 | + $y = substr_count($incl, "\n") |
|
| 407 | + + substr_count($r[1], "\n") |
|
| 408 | + + substr_count($r[3], "\n"); |
|
| 409 | + } |
|
| 410 | + if ($n <= ($y + $debut)) { |
|
| 411 | + if ($v[1][0] == '?') { |
|
| 412 | + return trouve_boucle_debug($n, $nom, $debut, substr($v[1], 1)); |
|
| 413 | + } elseif ($v[1][0] == '!') { |
|
| 414 | + if ($incl = trouve_squelette_inclus($v[1])) { |
|
| 415 | + return trouve_boucle_debug($n, $incl, $debut); |
|
| 416 | + } |
|
| 417 | + } |
|
| 418 | + |
|
| 419 | + return [$nom, $boucle, $v[2] - 1 + $n - $debut]; |
|
| 420 | + } |
|
| 421 | + $debut += $y; |
|
| 422 | + } |
|
| 423 | + } |
|
| 424 | + |
|
| 425 | + return [$nom, $boucle, $n - $debut]; |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | function trouve_squelette_inclus($script) { |
| 429 | 429 | |
| 430 | - preg_match('/include\(.(.*).php3?.\);/', $script, $reg); |
|
| 431 | - // si le script X.php n'est pas ecrire/public.php |
|
| 432 | - // on suppose qu'il prend le squelette X.html (pas sur, mais y a pas mieux) |
|
| 433 | - if ($reg[1] == 'ecrire/public') { // si c'est bien ecrire/public on cherche le param 'fond' |
|
| 434 | - if (!preg_match("/'fond' => '([^']*)'/", $script, $reg)) { // a defaut on cherche le param 'page' |
|
| 435 | - if (!preg_match("/'param' => '([^']*)'/", $script, $reg)) { |
|
| 436 | - $reg[1] = 'inconnu'; |
|
| 437 | - } |
|
| 438 | - } |
|
| 439 | - } |
|
| 440 | - $incl = ',' . $reg[1] . '[.]\w$,'; |
|
| 441 | - |
|
| 442 | - foreach ($GLOBALS['debug_objets']['sourcefile'] as $k => $v) { |
|
| 443 | - if (preg_match($incl, $v)) { |
|
| 444 | - return $k; |
|
| 445 | - } |
|
| 446 | - } |
|
| 447 | - |
|
| 448 | - return ''; |
|
| 430 | + preg_match('/include\(.(.*).php3?.\);/', $script, $reg); |
|
| 431 | + // si le script X.php n'est pas ecrire/public.php |
|
| 432 | + // on suppose qu'il prend le squelette X.html (pas sur, mais y a pas mieux) |
|
| 433 | + if ($reg[1] == 'ecrire/public') { // si c'est bien ecrire/public on cherche le param 'fond' |
|
| 434 | + if (!preg_match("/'fond' => '([^']*)'/", $script, $reg)) { // a defaut on cherche le param 'page' |
|
| 435 | + if (!preg_match("/'param' => '([^']*)'/", $script, $reg)) { |
|
| 436 | + $reg[1] = 'inconnu'; |
|
| 437 | + } |
|
| 438 | + } |
|
| 439 | + } |
|
| 440 | + $incl = ',' . $reg[1] . '[.]\w$,'; |
|
| 441 | + |
|
| 442 | + foreach ($GLOBALS['debug_objets']['sourcefile'] as $k => $v) { |
|
| 443 | + if (preg_match($incl, $v)) { |
|
| 444 | + return $k; |
|
| 445 | + } |
|
| 446 | + } |
|
| 447 | + |
|
| 448 | + return ''; |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | function reference_boucle_debug($n, $nom, $self) { |
| 452 | - [$skel, $boucle, $ligne] = trouve_boucle_debug($n, $nom); |
|
| 453 | - |
|
| 454 | - if (!$boucle) { |
|
| 455 | - return !$ligne ? '' : |
|
| 456 | - (' (' . |
|
| 457 | - (($nom != $skel) ? _T('squelette_inclus_ligne') : |
|
| 458 | - _T('squelette_ligne')) . |
|
| 459 | - " <a href='$self&var_mode_objet=$skel&var_mode_affiche=squelette&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"); |
|
| 460 | - } else { |
|
| 461 | - $self .= "&var_mode_objet=$skel$boucle&var_mode_affiche=boucle"; |
|
| 462 | - |
|
| 463 | - return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : |
|
| 464 | - " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 465 | - } |
|
| 452 | + [$skel, $boucle, $ligne] = trouve_boucle_debug($n, $nom); |
|
| 453 | + |
|
| 454 | + if (!$boucle) { |
|
| 455 | + return !$ligne ? '' : |
|
| 456 | + (' (' . |
|
| 457 | + (($nom != $skel) ? _T('squelette_inclus_ligne') : |
|
| 458 | + _T('squelette_ligne')) . |
|
| 459 | + " <a href='$self&var_mode_objet=$skel&var_mode_affiche=squelette&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"); |
|
| 460 | + } else { |
|
| 461 | + $self .= "&var_mode_objet=$skel$boucle&var_mode_affiche=boucle"; |
|
| 462 | + |
|
| 463 | + return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : |
|
| 464 | + " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 465 | + } |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | // affiche un texte avec numero de ligne et ancre. |
| 469 | 469 | |
| 470 | 470 | function ancre_texte($texte, $fautifs = [], $nocpt = false) { |
| 471 | 471 | |
| 472 | - $var_mode_ligne = _request('var_mode_ligne'); |
|
| 473 | - if ($var_mode_ligne) { |
|
| 474 | - $fautifs[] = [$var_mode_ligne]; |
|
| 475 | - } |
|
| 476 | - $res = ''; |
|
| 477 | - |
|
| 478 | - $s = highlight_string($texte, true); |
|
| 479 | - if (substr($s, 0, 6) == '<code>') { |
|
| 480 | - $s = substr($s, 6); |
|
| 481 | - $res = '<code>'; |
|
| 482 | - } |
|
| 483 | - |
|
| 484 | - $s = preg_replace( |
|
| 485 | - ',<(\w[^<>]*)>([^<]*)<br />([^<]*)</\1>,', |
|
| 486 | - '<\1>\2</\1><br />' . "\n" . '<\1>\3</\1>', |
|
| 487 | - $s |
|
| 488 | - ); |
|
| 489 | - |
|
| 490 | - |
|
| 491 | - $tableau = explode('<br />', $s); |
|
| 492 | - |
|
| 493 | - $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"; |
|
| 494 | - |
|
| 495 | - $format10 = str_replace('white', 'lightgrey', $format); |
|
| 496 | - $formaterr = 'color: red;'; |
|
| 497 | - $i = 1; |
|
| 498 | - $flignes = []; |
|
| 499 | - $loc = [0, 0]; |
|
| 500 | - foreach ($fautifs as $lc) { |
|
| 501 | - if (is_array($lc)) { |
|
| 502 | - $l = array_shift($lc); |
|
| 503 | - $flignes[$l] = $lc; |
|
| 504 | - } else { |
|
| 505 | - $flignes[$lc] = $loc; |
|
| 506 | - } |
|
| 507 | - } |
|
| 508 | - |
|
| 509 | - $ancre = md5($texte); |
|
| 510 | - foreach ($tableau as $ligne) { |
|
| 511 | - if (isset($flignes[$i])) { |
|
| 512 | - $ligne = str_replace(' ', ' ', $ligne); |
|
| 513 | - $indexmesg = $flignes[$i][1]; |
|
| 514 | - $err = textebrut($flignes[$i][2]); |
|
| 515 | - // tentative de pointer sur la colonne fautive; |
|
| 516 | - // marche pas car highlight_string rajoute des entites. A revoir. |
|
| 517 | - // $m = $flignes[$i][0]; |
|
| 518 | - // $ligne = substr($ligne, 0, $m-1) . |
|
| 519 | - // sprintf($formaterr, substr($ligne,$m)); |
|
| 520 | - $bg = $formaterr; |
|
| 521 | - } else { |
|
| 522 | - $indexmesg = $ancre; |
|
| 523 | - $err = $bg = ''; |
|
| 524 | - } |
|
| 525 | - $res .= sprintf((($i % 10) ? $format : $format10), $i, $bg, $indexmesg, $err, $i, $ligne); |
|
| 526 | - $i++; |
|
| 527 | - } |
|
| 528 | - |
|
| 529 | - return "<div id='T$ancre'>" |
|
| 530 | - . '<div onclick="' |
|
| 531 | - . "jQuery(this).parent().find('a').toggle();" |
|
| 532 | - . '" title="' |
|
| 533 | - . _T('masquer_colonne') |
|
| 534 | - . '" style="cursor: pointer;">' |
|
| 535 | - . ($nocpt ? '' : _T('info_numero_abbreviation')) |
|
| 536 | - . '</div> |
|
| 472 | + $var_mode_ligne = _request('var_mode_ligne'); |
|
| 473 | + if ($var_mode_ligne) { |
|
| 474 | + $fautifs[] = [$var_mode_ligne]; |
|
| 475 | + } |
|
| 476 | + $res = ''; |
|
| 477 | + |
|
| 478 | + $s = highlight_string($texte, true); |
|
| 479 | + if (substr($s, 0, 6) == '<code>') { |
|
| 480 | + $s = substr($s, 6); |
|
| 481 | + $res = '<code>'; |
|
| 482 | + } |
|
| 483 | + |
|
| 484 | + $s = preg_replace( |
|
| 485 | + ',<(\w[^<>]*)>([^<]*)<br />([^<]*)</\1>,', |
|
| 486 | + '<\1>\2</\1><br />' . "\n" . '<\1>\3</\1>', |
|
| 487 | + $s |
|
| 488 | + ); |
|
| 489 | + |
|
| 490 | + |
|
| 491 | + $tableau = explode('<br />', $s); |
|
| 492 | + |
|
| 493 | + $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"; |
|
| 494 | + |
|
| 495 | + $format10 = str_replace('white', 'lightgrey', $format); |
|
| 496 | + $formaterr = 'color: red;'; |
|
| 497 | + $i = 1; |
|
| 498 | + $flignes = []; |
|
| 499 | + $loc = [0, 0]; |
|
| 500 | + foreach ($fautifs as $lc) { |
|
| 501 | + if (is_array($lc)) { |
|
| 502 | + $l = array_shift($lc); |
|
| 503 | + $flignes[$l] = $lc; |
|
| 504 | + } else { |
|
| 505 | + $flignes[$lc] = $loc; |
|
| 506 | + } |
|
| 507 | + } |
|
| 508 | + |
|
| 509 | + $ancre = md5($texte); |
|
| 510 | + foreach ($tableau as $ligne) { |
|
| 511 | + if (isset($flignes[$i])) { |
|
| 512 | + $ligne = str_replace(' ', ' ', $ligne); |
|
| 513 | + $indexmesg = $flignes[$i][1]; |
|
| 514 | + $err = textebrut($flignes[$i][2]); |
|
| 515 | + // tentative de pointer sur la colonne fautive; |
|
| 516 | + // marche pas car highlight_string rajoute des entites. A revoir. |
|
| 517 | + // $m = $flignes[$i][0]; |
|
| 518 | + // $ligne = substr($ligne, 0, $m-1) . |
|
| 519 | + // sprintf($formaterr, substr($ligne,$m)); |
|
| 520 | + $bg = $formaterr; |
|
| 521 | + } else { |
|
| 522 | + $indexmesg = $ancre; |
|
| 523 | + $err = $bg = ''; |
|
| 524 | + } |
|
| 525 | + $res .= sprintf((($i % 10) ? $format : $format10), $i, $bg, $indexmesg, $err, $i, $ligne); |
|
| 526 | + $i++; |
|
| 527 | + } |
|
| 528 | + |
|
| 529 | + return "<div id='T$ancre'>" |
|
| 530 | + . '<div onclick="' |
|
| 531 | + . "jQuery(this).parent().find('a').toggle();" |
|
| 532 | + . '" title="' |
|
| 533 | + . _T('masquer_colonne') |
|
| 534 | + . '" style="cursor: pointer;">' |
|
| 535 | + . ($nocpt ? '' : _T('info_numero_abbreviation')) |
|
| 536 | + . '</div> |
|
| 537 | 537 | ' . $res . "</div>\n"; |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | // l'environnement graphique du debuggueur |
| 541 | 541 | |
| 542 | 542 | function debusquer_squelette($fonc, $mode, $self) { |
| 543 | - $legend = null; |
|
| 544 | - $texte = ''; |
|
| 545 | - |
|
| 546 | - if ($mode !== 'validation') { |
|
| 547 | - if (isset($GLOBALS['debug_objets']['sourcefile']) and $GLOBALS['debug_objets']['sourcefile']) { |
|
| 548 | - $res = "<div id='spip-boucles'>\n" |
|
| 549 | - . debusquer_navigation_squelettes($self) |
|
| 550 | - . '</div>'; |
|
| 551 | - } else { |
|
| 552 | - $res = ''; |
|
| 553 | - } |
|
| 554 | - if ($fonc) { |
|
| 555 | - $id = " id='$fonc'"; |
|
| 556 | - if (!empty($GLOBALS['debug_objets'][$mode][$fonc])) { |
|
| 557 | - [$legend, $texte, $res2] = debusquer_source($fonc, $mode); |
|
| 558 | - $texte .= $res2; |
|
| 559 | - } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc . 'tout'])) { |
|
| 560 | - $legend = _T('zbug_' . $mode); |
|
| 561 | - $texte = $GLOBALS['debug_objets'][$mode][$fonc . 'tout']; |
|
| 562 | - $texte = ancre_texte($texte, ['', '']); |
|
| 563 | - } |
|
| 564 | - } else { |
|
| 565 | - if (strlen(trim($res))) { |
|
| 566 | - 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>"; |
|
| 567 | - } else { |
|
| 568 | - // cas de l'appel sur erreur: montre la page |
|
| 569 | - return $GLOBALS['debug_objets']['resultat']['tout'] ?? ''; |
|
| 570 | - } |
|
| 571 | - } |
|
| 572 | - } else { |
|
| 573 | - $valider = charger_fonction('valider', 'xml'); |
|
| 574 | - $val = $valider($GLOBALS['debug_objets']['validation'][$fonc . 'tout']); |
|
| 575 | - // Si erreur, signaler leur nombre dans le formulaire admin |
|
| 576 | - $GLOBALS['debug_objets']['validation'] = $val->err ? count($val->err) : ''; |
|
| 577 | - [$texte, $err] = emboite_texte($val, $fonc, $self); |
|
| 578 | - if ($err === false) { |
|
| 579 | - $err = _T('impossible'); |
|
| 580 | - } elseif ($err === true) { |
|
| 581 | - $err = _T('correcte'); |
|
| 582 | - } else { |
|
| 583 | - $err = ": $err"; |
|
| 584 | - } |
|
| 585 | - $legend = _T('validation') . ' ' . $err; |
|
| 586 | - $res = $id = ''; |
|
| 587 | - } |
|
| 588 | - |
|
| 589 | - return !trim($texte) ? '' : ( |
|
| 590 | - "<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" |
|
| 591 | - . "<div id='debug_boucle'><fieldset$id><legend>" |
|
| 592 | - . "<a href='" . $self . '#f_' . substr($fonc, 0, 37) . "'> ↑ " |
|
| 593 | - . ($legend ?: $mode) |
|
| 594 | - . '</a></legend>' |
|
| 595 | - . $texte |
|
| 596 | - . '</fieldset></div>' |
|
| 597 | - . '</div>'); |
|
| 543 | + $legend = null; |
|
| 544 | + $texte = ''; |
|
| 545 | + |
|
| 546 | + if ($mode !== 'validation') { |
|
| 547 | + if (isset($GLOBALS['debug_objets']['sourcefile']) and $GLOBALS['debug_objets']['sourcefile']) { |
|
| 548 | + $res = "<div id='spip-boucles'>\n" |
|
| 549 | + . debusquer_navigation_squelettes($self) |
|
| 550 | + . '</div>'; |
|
| 551 | + } else { |
|
| 552 | + $res = ''; |
|
| 553 | + } |
|
| 554 | + if ($fonc) { |
|
| 555 | + $id = " id='$fonc'"; |
|
| 556 | + if (!empty($GLOBALS['debug_objets'][$mode][$fonc])) { |
|
| 557 | + [$legend, $texte, $res2] = debusquer_source($fonc, $mode); |
|
| 558 | + $texte .= $res2; |
|
| 559 | + } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc . 'tout'])) { |
|
| 560 | + $legend = _T('zbug_' . $mode); |
|
| 561 | + $texte = $GLOBALS['debug_objets'][$mode][$fonc . 'tout']; |
|
| 562 | + $texte = ancre_texte($texte, ['', '']); |
|
| 563 | + } |
|
| 564 | + } else { |
|
| 565 | + if (strlen(trim($res))) { |
|
| 566 | + 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>"; |
|
| 567 | + } else { |
|
| 568 | + // cas de l'appel sur erreur: montre la page |
|
| 569 | + return $GLOBALS['debug_objets']['resultat']['tout'] ?? ''; |
|
| 570 | + } |
|
| 571 | + } |
|
| 572 | + } else { |
|
| 573 | + $valider = charger_fonction('valider', 'xml'); |
|
| 574 | + $val = $valider($GLOBALS['debug_objets']['validation'][$fonc . 'tout']); |
|
| 575 | + // Si erreur, signaler leur nombre dans le formulaire admin |
|
| 576 | + $GLOBALS['debug_objets']['validation'] = $val->err ? count($val->err) : ''; |
|
| 577 | + [$texte, $err] = emboite_texte($val, $fonc, $self); |
|
| 578 | + if ($err === false) { |
|
| 579 | + $err = _T('impossible'); |
|
| 580 | + } elseif ($err === true) { |
|
| 581 | + $err = _T('correcte'); |
|
| 582 | + } else { |
|
| 583 | + $err = ": $err"; |
|
| 584 | + } |
|
| 585 | + $legend = _T('validation') . ' ' . $err; |
|
| 586 | + $res = $id = ''; |
|
| 587 | + } |
|
| 588 | + |
|
| 589 | + return !trim($texte) ? '' : ( |
|
| 590 | + "<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" |
|
| 591 | + . "<div id='debug_boucle'><fieldset$id><legend>" |
|
| 592 | + . "<a href='" . $self . '#f_' . substr($fonc, 0, 37) . "'> ↑ " |
|
| 593 | + . ($legend ?: $mode) |
|
| 594 | + . '</a></legend>' |
|
| 595 | + . $texte |
|
| 596 | + . '</fieldset></div>' |
|
| 597 | + . '</div>'); |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | |
| 601 | 601 | function emboite_texte($res, $fonc = '', $self = '') { |
| 602 | - $errs = $res->err; |
|
| 603 | - $texte = $res->entete . ($errs ? '' : $res->page); |
|
| 604 | - |
|
| 605 | - if (!$texte and !$errs) { |
|
| 606 | - return [ancre_texte('', ['', '']), false]; |
|
| 607 | - } |
|
| 608 | - if (!$errs) { |
|
| 609 | - return [ancre_texte($texte, ['', '']), true]; |
|
| 610 | - } |
|
| 611 | - |
|
| 612 | - if (!isset($GLOBALS['debug_objets'])) { |
|
| 613 | - $colors = ['#e0e0f0', '#f8f8ff']; |
|
| 614 | - $encore = count_occ($errs); |
|
| 615 | - $encore2 = []; |
|
| 616 | - $fautifs = []; |
|
| 617 | - |
|
| 618 | - $err = '<tr><th>' |
|
| 619 | - . _T('numero') |
|
| 620 | - . '</th><th>' |
|
| 621 | - . _T('occurence') |
|
| 622 | - . '</th><th>' |
|
| 623 | - . _T('ligne') |
|
| 624 | - . '</th><th>' |
|
| 625 | - . _T('colonne') |
|
| 626 | - . '</th><th>' |
|
| 627 | - . _T('erreur') |
|
| 628 | - . '</th></tr>'; |
|
| 629 | - |
|
| 630 | - $i = 0; |
|
| 631 | - $style = "style='text-align: right; padding-right: 5px'"; |
|
| 632 | - foreach ($errs as $r) { |
|
| 633 | - $i++; |
|
| 634 | - [$msg, $ligne, $col] = $r; |
|
| 635 | - #spip_log("$r = list($msg, $ligne, $col"); |
|
| 636 | - if (isset($encore2[$msg])) { |
|
| 637 | - $ref = ++$encore2[$msg]; |
|
| 638 | - } else { |
|
| 639 | - $encore2[$msg] = $ref = 1; |
|
| 640 | - } |
|
| 641 | - $err .= "<tr style='background-color: " |
|
| 642 | - . $colors[$i % 2] |
|
| 643 | - . "'><td $style><a href='#debut_err'>" |
|
| 644 | - . $i |
|
| 645 | - . "</a></td><td $style>" |
|
| 646 | - . "$ref/$encore[$msg]</td>" |
|
| 647 | - . "<td $style><a href='#L" |
|
| 648 | - . $ligne |
|
| 649 | - . "' id='T$i'>" |
|
| 650 | - . $ligne |
|
| 651 | - . "</a></td><td $style>" |
|
| 652 | - . $col |
|
| 653 | - . "</td><td>$msg</td></tr>\n"; |
|
| 654 | - $fautifs[] = [$ligne, $col, $i, $msg]; |
|
| 655 | - } |
|
| 656 | - $err = "<h2 style='text-align: center'>" |
|
| 657 | - . $i |
|
| 658 | - . "<a href='#fin_err'>" |
|
| 659 | - . ' ' . _T('erreur_texte') |
|
| 660 | - . "</a></h2><table id='debut_err' style='width: 100%'>" |
|
| 661 | - . $err |
|
| 662 | - . " </table><a id='fin_err'></a>"; |
|
| 663 | - |
|
| 664 | - return [ancre_texte($texte, $fautifs), $err]; |
|
| 665 | - } else { |
|
| 666 | - [$msg, $fermant, $ouvrant] = $errs[0]; |
|
| 667 | - $rf = reference_boucle_debug($fermant, $fonc, $self); |
|
| 668 | - $ro = reference_boucle_debug($ouvrant, $fonc, $self); |
|
| 669 | - $err = $msg . |
|
| 670 | - "<a href='#L" . $fermant . "'>$fermant</a>$rf<br />" . |
|
| 671 | - "<a href='#L" . $ouvrant . "'>$ouvrant</a>$ro"; |
|
| 672 | - |
|
| 673 | - return [ancre_texte($texte, [[$ouvrant], [$fermant]]), $err]; |
|
| 674 | - } |
|
| 602 | + $errs = $res->err; |
|
| 603 | + $texte = $res->entete . ($errs ? '' : $res->page); |
|
| 604 | + |
|
| 605 | + if (!$texte and !$errs) { |
|
| 606 | + return [ancre_texte('', ['', '']), false]; |
|
| 607 | + } |
|
| 608 | + if (!$errs) { |
|
| 609 | + return [ancre_texte($texte, ['', '']), true]; |
|
| 610 | + } |
|
| 611 | + |
|
| 612 | + if (!isset($GLOBALS['debug_objets'])) { |
|
| 613 | + $colors = ['#e0e0f0', '#f8f8ff']; |
|
| 614 | + $encore = count_occ($errs); |
|
| 615 | + $encore2 = []; |
|
| 616 | + $fautifs = []; |
|
| 617 | + |
|
| 618 | + $err = '<tr><th>' |
|
| 619 | + . _T('numero') |
|
| 620 | + . '</th><th>' |
|
| 621 | + . _T('occurence') |
|
| 622 | + . '</th><th>' |
|
| 623 | + . _T('ligne') |
|
| 624 | + . '</th><th>' |
|
| 625 | + . _T('colonne') |
|
| 626 | + . '</th><th>' |
|
| 627 | + . _T('erreur') |
|
| 628 | + . '</th></tr>'; |
|
| 629 | + |
|
| 630 | + $i = 0; |
|
| 631 | + $style = "style='text-align: right; padding-right: 5px'"; |
|
| 632 | + foreach ($errs as $r) { |
|
| 633 | + $i++; |
|
| 634 | + [$msg, $ligne, $col] = $r; |
|
| 635 | + #spip_log("$r = list($msg, $ligne, $col"); |
|
| 636 | + if (isset($encore2[$msg])) { |
|
| 637 | + $ref = ++$encore2[$msg]; |
|
| 638 | + } else { |
|
| 639 | + $encore2[$msg] = $ref = 1; |
|
| 640 | + } |
|
| 641 | + $err .= "<tr style='background-color: " |
|
| 642 | + . $colors[$i % 2] |
|
| 643 | + . "'><td $style><a href='#debut_err'>" |
|
| 644 | + . $i |
|
| 645 | + . "</a></td><td $style>" |
|
| 646 | + . "$ref/$encore[$msg]</td>" |
|
| 647 | + . "<td $style><a href='#L" |
|
| 648 | + . $ligne |
|
| 649 | + . "' id='T$i'>" |
|
| 650 | + . $ligne |
|
| 651 | + . "</a></td><td $style>" |
|
| 652 | + . $col |
|
| 653 | + . "</td><td>$msg</td></tr>\n"; |
|
| 654 | + $fautifs[] = [$ligne, $col, $i, $msg]; |
|
| 655 | + } |
|
| 656 | + $err = "<h2 style='text-align: center'>" |
|
| 657 | + . $i |
|
| 658 | + . "<a href='#fin_err'>" |
|
| 659 | + . ' ' . _T('erreur_texte') |
|
| 660 | + . "</a></h2><table id='debut_err' style='width: 100%'>" |
|
| 661 | + . $err |
|
| 662 | + . " </table><a id='fin_err'></a>"; |
|
| 663 | + |
|
| 664 | + return [ancre_texte($texte, $fautifs), $err]; |
|
| 665 | + } else { |
|
| 666 | + [$msg, $fermant, $ouvrant] = $errs[0]; |
|
| 667 | + $rf = reference_boucle_debug($fermant, $fonc, $self); |
|
| 668 | + $ro = reference_boucle_debug($ouvrant, $fonc, $self); |
|
| 669 | + $err = $msg . |
|
| 670 | + "<a href='#L" . $fermant . "'>$fermant</a>$rf<br />" . |
|
| 671 | + "<a href='#L" . $ouvrant . "'>$ouvrant</a>$ro"; |
|
| 672 | + |
|
| 673 | + return [ancre_texte($texte, [[$ouvrant], [$fermant]]), $err]; |
|
| 674 | + } |
|
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | function count_occ($regs) { |
| 678 | - $encore = []; |
|
| 679 | - foreach ($regs as $r) { |
|
| 680 | - if (isset($encore[$r[0]])) { |
|
| 681 | - $encore[$r[0]]++; |
|
| 682 | - } else { |
|
| 683 | - $encore[$r[0]] = 1; |
|
| 684 | - } |
|
| 685 | - } |
|
| 686 | - |
|
| 687 | - return $encore; |
|
| 678 | + $encore = []; |
|
| 679 | + foreach ($regs as $r) { |
|
| 680 | + if (isset($encore[$r[0]])) { |
|
| 681 | + $encore[$r[0]]++; |
|
| 682 | + } else { |
|
| 683 | + $encore[$r[0]] = 1; |
|
| 684 | + } |
|
| 685 | + } |
|
| 686 | + |
|
| 687 | + return $encore; |
|
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | function debusquer_navigation_squelettes($self) { |
| 691 | 691 | |
| 692 | - $res = ''; |
|
| 693 | - $boucles = !empty($GLOBALS['debug_objets']['boucle']) ? $GLOBALS['debug_objets']['boucle'] : ''; |
|
| 694 | - $contexte = $GLOBALS['debug_objets']['contexte']; |
|
| 695 | - $t_skel = _T('squelette'); |
|
| 696 | - foreach ($GLOBALS['debug_objets']['sourcefile'] as $nom => $sourcefile) { |
|
| 697 | - $self2 = parametre_url($self, 'var_mode_objet', $nom); |
|
| 698 | - $nav = !$boucles ? '' : debusquer_navigation_boucles($boucles, $nom, $self, $sourcefile); |
|
| 699 | - $temps = !isset($GLOBALS['debug_objets']['profile'][$sourcefile]) ? '' : _T( |
|
| 700 | - 'zbug_profile', |
|
| 701 | - ['time' => $GLOBALS['debug_objets']['profile'][$sourcefile]] |
|
| 702 | - ); |
|
| 703 | - |
|
| 704 | - $res .= "<fieldset id='f_" . $nom . "'><legend>" |
|
| 705 | - . $t_skel |
|
| 706 | - . ' ' |
|
| 707 | - . $sourcefile |
|
| 708 | - . " :\n<a href='$self2&var_mode_affiche=squelette#f_$nom'>" |
|
| 709 | - . $t_skel |
|
| 710 | - . "</a>\n<a href='$self2&var_mode_affiche=resultat#f_$nom'>" |
|
| 711 | - . _T('zbug_resultat') |
|
| 712 | - . "</a>\n<a href='$self2&var_mode_affiche=code#f_$nom'>" |
|
| 713 | - . _T('zbug_code') |
|
| 714 | - . "</a>\n<a href='" |
|
| 715 | - . str_replace('var_mode=debug', 'var_profile=1&var_mode=recalcul', $self) |
|
| 716 | - . "'>" |
|
| 717 | - . _T('zbug_calcul') |
|
| 718 | - . '</a></legend>' |
|
| 719 | - . (!$temps ? '' : ("\n<span style='display:block;float:" . $GLOBALS['spip_lang_right'] . "'>$temps</span><br />")) |
|
| 720 | - . debusquer_contexte($contexte[$sourcefile]) |
|
| 721 | - . (!$nav ? '' : ("<table width='100%'>\n$nav</table>\n")) |
|
| 722 | - . "</fieldset>\n"; |
|
| 723 | - } |
|
| 724 | - |
|
| 725 | - return $res; |
|
| 692 | + $res = ''; |
|
| 693 | + $boucles = !empty($GLOBALS['debug_objets']['boucle']) ? $GLOBALS['debug_objets']['boucle'] : ''; |
|
| 694 | + $contexte = $GLOBALS['debug_objets']['contexte']; |
|
| 695 | + $t_skel = _T('squelette'); |
|
| 696 | + foreach ($GLOBALS['debug_objets']['sourcefile'] as $nom => $sourcefile) { |
|
| 697 | + $self2 = parametre_url($self, 'var_mode_objet', $nom); |
|
| 698 | + $nav = !$boucles ? '' : debusquer_navigation_boucles($boucles, $nom, $self, $sourcefile); |
|
| 699 | + $temps = !isset($GLOBALS['debug_objets']['profile'][$sourcefile]) ? '' : _T( |
|
| 700 | + 'zbug_profile', |
|
| 701 | + ['time' => $GLOBALS['debug_objets']['profile'][$sourcefile]] |
|
| 702 | + ); |
|
| 703 | + |
|
| 704 | + $res .= "<fieldset id='f_" . $nom . "'><legend>" |
|
| 705 | + . $t_skel |
|
| 706 | + . ' ' |
|
| 707 | + . $sourcefile |
|
| 708 | + . " :\n<a href='$self2&var_mode_affiche=squelette#f_$nom'>" |
|
| 709 | + . $t_skel |
|
| 710 | + . "</a>\n<a href='$self2&var_mode_affiche=resultat#f_$nom'>" |
|
| 711 | + . _T('zbug_resultat') |
|
| 712 | + . "</a>\n<a href='$self2&var_mode_affiche=code#f_$nom'>" |
|
| 713 | + . _T('zbug_code') |
|
| 714 | + . "</a>\n<a href='" |
|
| 715 | + . str_replace('var_mode=debug', 'var_profile=1&var_mode=recalcul', $self) |
|
| 716 | + . "'>" |
|
| 717 | + . _T('zbug_calcul') |
|
| 718 | + . '</a></legend>' |
|
| 719 | + . (!$temps ? '' : ("\n<span style='display:block;float:" . $GLOBALS['spip_lang_right'] . "'>$temps</span><br />")) |
|
| 720 | + . debusquer_contexte($contexte[$sourcefile]) |
|
| 721 | + . (!$nav ? '' : ("<table width='100%'>\n$nav</table>\n")) |
|
| 722 | + . "</fieldset>\n"; |
|
| 723 | + } |
|
| 724 | + |
|
| 725 | + return $res; |
|
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | function debusquer_navigation_boucles($boucles, $nom_skel, $self, $nom_source) { |
| 729 | - $i = 0; |
|
| 730 | - $res = ''; |
|
| 731 | - $var_mode_objet = _request('var_mode_objet'); |
|
| 732 | - $gram = preg_match('/[.](\w+)$/', $nom_source, $r) ? $r[1] : ''; |
|
| 733 | - |
|
| 734 | - foreach ($boucles as $objet => $boucle) { |
|
| 735 | - if (substr($objet, 0, strlen($nom_skel)) == $nom_skel) { |
|
| 736 | - $i++; |
|
| 737 | - $nom = $boucle->id_boucle; |
|
| 738 | - $req = $boucle->type_requete; |
|
| 739 | - $crit = public_decompiler($boucle, $gram, 0, 'criteres'); |
|
| 740 | - $self2 = $self . '&var_mode_objet=' . $objet; |
|
| 741 | - |
|
| 742 | - $res .= "\n<tr style='background-color: " . |
|
| 743 | - ($i % 2 ? '#e0e0f0' : '#f8f8ff') . |
|
| 744 | - "'><td align='right'>$i</td><td>\n" . |
|
| 745 | - "<a class='debug_link_boucle' href='" . |
|
| 746 | - $self2 . |
|
| 747 | - "&var_mode_affiche=boucle#f_$nom_skel'>" . |
|
| 748 | - _T('zbug_boucle') . |
|
| 749 | - "</a></td><td>\n<a class='debug_link_boucle' href='" . |
|
| 750 | - $self2 . |
|
| 751 | - "&var_mode_affiche=resultat#f_$nom_skel'>" . |
|
| 752 | - _T('zbug_resultat') . |
|
| 753 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 754 | - $self2 . |
|
| 755 | - "&var_mode_affiche=code#f_$nom_skel'>" . |
|
| 756 | - _T('zbug_code') . |
|
| 757 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 758 | - str_replace('var_mode=', 'var_profile=', $self2) . |
|
| 759 | - "'>" . |
|
| 760 | - _T('zbug_calcul') . |
|
| 761 | - "</a></td><td>\n" . |
|
| 762 | - (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom) . |
|
| 763 | - "</td><td>\n" . |
|
| 764 | - $req . |
|
| 765 | - "</td><td>\n" . |
|
| 766 | - spip_htmlspecialchars($crit) . |
|
| 767 | - '</td></tr>'; |
|
| 768 | - } |
|
| 769 | - } |
|
| 770 | - |
|
| 771 | - return $res; |
|
| 729 | + $i = 0; |
|
| 730 | + $res = ''; |
|
| 731 | + $var_mode_objet = _request('var_mode_objet'); |
|
| 732 | + $gram = preg_match('/[.](\w+)$/', $nom_source, $r) ? $r[1] : ''; |
|
| 733 | + |
|
| 734 | + foreach ($boucles as $objet => $boucle) { |
|
| 735 | + if (substr($objet, 0, strlen($nom_skel)) == $nom_skel) { |
|
| 736 | + $i++; |
|
| 737 | + $nom = $boucle->id_boucle; |
|
| 738 | + $req = $boucle->type_requete; |
|
| 739 | + $crit = public_decompiler($boucle, $gram, 0, 'criteres'); |
|
| 740 | + $self2 = $self . '&var_mode_objet=' . $objet; |
|
| 741 | + |
|
| 742 | + $res .= "\n<tr style='background-color: " . |
|
| 743 | + ($i % 2 ? '#e0e0f0' : '#f8f8ff') . |
|
| 744 | + "'><td align='right'>$i</td><td>\n" . |
|
| 745 | + "<a class='debug_link_boucle' href='" . |
|
| 746 | + $self2 . |
|
| 747 | + "&var_mode_affiche=boucle#f_$nom_skel'>" . |
|
| 748 | + _T('zbug_boucle') . |
|
| 749 | + "</a></td><td>\n<a class='debug_link_boucle' href='" . |
|
| 750 | + $self2 . |
|
| 751 | + "&var_mode_affiche=resultat#f_$nom_skel'>" . |
|
| 752 | + _T('zbug_resultat') . |
|
| 753 | + "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 754 | + $self2 . |
|
| 755 | + "&var_mode_affiche=code#f_$nom_skel'>" . |
|
| 756 | + _T('zbug_code') . |
|
| 757 | + "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 758 | + str_replace('var_mode=', 'var_profile=', $self2) . |
|
| 759 | + "'>" . |
|
| 760 | + _T('zbug_calcul') . |
|
| 761 | + "</a></td><td>\n" . |
|
| 762 | + (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom) . |
|
| 763 | + "</td><td>\n" . |
|
| 764 | + $req . |
|
| 765 | + "</td><td>\n" . |
|
| 766 | + spip_htmlspecialchars($crit) . |
|
| 767 | + '</td></tr>'; |
|
| 768 | + } |
|
| 769 | + } |
|
| 770 | + |
|
| 771 | + return $res; |
|
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | function debusquer_source($objet, $affiche) { |
| 775 | - $quoi = $GLOBALS['debug_objets'][$affiche][$objet]; |
|
| 776 | - if (!empty($GLOBALS['debug_objets']['boucle'][$objet]->id_boucle)) { |
|
| 777 | - $nom = $GLOBALS['debug_objets']['boucle'][$objet]->id_boucle; |
|
| 778 | - } else { |
|
| 779 | - $nom = $GLOBALS['debug_objets']['sourcefile'][$objet]; |
|
| 780 | - } |
|
| 781 | - $res2 = ''; |
|
| 782 | - |
|
| 783 | - if ($affiche == 'resultat') { |
|
| 784 | - $legend = $nom; |
|
| 785 | - $req = $GLOBALS['debug_objets']['requete'][$objet]; |
|
| 786 | - if (function_exists('_mysql_traite_query')) { |
|
| 787 | - $c = strtolower(_request('connect') ?? ''); |
|
| 788 | - $c = $GLOBALS['connexions'][$c ?: 0]['prefixe']; |
|
| 789 | - $req = _mysql_traite_query($req, '', $c); |
|
| 790 | - } |
|
| 791 | - // permettre le copier/coller facile |
|
| 792 | - // $res = ancre_texte($req, array(), true); |
|
| 793 | - $res = "<div id='T" . md5($req) . "'>\n<pre>\n" . $req . "</pre>\n</div>\n"; |
|
| 794 | - // formatage et affichage des resultats bruts de la requete |
|
| 795 | - $ress_req = spip_query($req); |
|
| 796 | - $brut_sql = ''; |
|
| 797 | - $num = 1; |
|
| 798 | - // eviter l'affichage de milliers de lignes |
|
| 799 | - // personnalisation possible dans mes_options |
|
| 800 | - $max_aff = defined('_MAX_DEBUG_AFF') ? _MAX_DEBUG_AFF : 50; |
|
| 801 | - while ($retours_sql = sql_fetch($ress_req)) { |
|
| 802 | - if ($num <= $max_aff) { |
|
| 803 | - $brut_sql .= '<h3>' . ($num == 1 ? $num . ' sur ' . sql_count($ress_req) : $num) . '</h3>'; |
|
| 804 | - $brut_sql .= '<p>'; |
|
| 805 | - foreach ($retours_sql as $key => $val) { |
|
| 806 | - $brut_sql .= '<strong>' . $key . '</strong> => ' . spip_htmlspecialchars(couper($val, 150)) . "<br />\n"; |
|
| 807 | - } |
|
| 808 | - $brut_sql .= '</p>'; |
|
| 809 | - } |
|
| 810 | - $num++; |
|
| 811 | - } |
|
| 812 | - $res2 = interdire_scripts($brut_sql); |
|
| 813 | - foreach ($quoi as $view) { |
|
| 814 | - // ne pas afficher les $contexte_inclus |
|
| 815 | - $view = preg_replace(',<\?php.+\?[>],Uims', '', $view); |
|
| 816 | - if ($view) { |
|
| 817 | - $res2 .= "\n<br /><fieldset>" . interdire_scripts($view) . '</fieldset>'; |
|
| 818 | - } |
|
| 819 | - } |
|
| 820 | - } elseif ($affiche == 'code') { |
|
| 821 | - $legend = $nom; |
|
| 822 | - $res = ancre_texte('<' . "?php\n" . $quoi . "\n?" . '>'); |
|
| 823 | - } elseif ($affiche == 'boucle') { |
|
| 824 | - $legend = _T('zbug_boucle') . ' ' . $nom; |
|
| 825 | - // Le compilateur prefixe le nom des boucles par l'extension du fichier source. |
|
| 826 | - $gram = preg_match('/^([^_]+)_/', $objet, $r) ? $r[1] : ''; |
|
| 827 | - $res = ancre_texte(public_decompiler($quoi, $gram, 0, 'boucle')); |
|
| 828 | - } elseif ($affiche == 'squelette') { |
|
| 829 | - $legend = $GLOBALS['debug_objets']['sourcefile'][$objet]; |
|
| 830 | - $res = ancre_texte($GLOBALS['debug_objets']['squelette'][$objet]); |
|
| 831 | - } |
|
| 832 | - |
|
| 833 | - return [$legend, $res, $res2]; |
|
| 775 | + $quoi = $GLOBALS['debug_objets'][$affiche][$objet]; |
|
| 776 | + if (!empty($GLOBALS['debug_objets']['boucle'][$objet]->id_boucle)) { |
|
| 777 | + $nom = $GLOBALS['debug_objets']['boucle'][$objet]->id_boucle; |
|
| 778 | + } else { |
|
| 779 | + $nom = $GLOBALS['debug_objets']['sourcefile'][$objet]; |
|
| 780 | + } |
|
| 781 | + $res2 = ''; |
|
| 782 | + |
|
| 783 | + if ($affiche == 'resultat') { |
|
| 784 | + $legend = $nom; |
|
| 785 | + $req = $GLOBALS['debug_objets']['requete'][$objet]; |
|
| 786 | + if (function_exists('_mysql_traite_query')) { |
|
| 787 | + $c = strtolower(_request('connect') ?? ''); |
|
| 788 | + $c = $GLOBALS['connexions'][$c ?: 0]['prefixe']; |
|
| 789 | + $req = _mysql_traite_query($req, '', $c); |
|
| 790 | + } |
|
| 791 | + // permettre le copier/coller facile |
|
| 792 | + // $res = ancre_texte($req, array(), true); |
|
| 793 | + $res = "<div id='T" . md5($req) . "'>\n<pre>\n" . $req . "</pre>\n</div>\n"; |
|
| 794 | + // formatage et affichage des resultats bruts de la requete |
|
| 795 | + $ress_req = spip_query($req); |
|
| 796 | + $brut_sql = ''; |
|
| 797 | + $num = 1; |
|
| 798 | + // eviter l'affichage de milliers de lignes |
|
| 799 | + // personnalisation possible dans mes_options |
|
| 800 | + $max_aff = defined('_MAX_DEBUG_AFF') ? _MAX_DEBUG_AFF : 50; |
|
| 801 | + while ($retours_sql = sql_fetch($ress_req)) { |
|
| 802 | + if ($num <= $max_aff) { |
|
| 803 | + $brut_sql .= '<h3>' . ($num == 1 ? $num . ' sur ' . sql_count($ress_req) : $num) . '</h3>'; |
|
| 804 | + $brut_sql .= '<p>'; |
|
| 805 | + foreach ($retours_sql as $key => $val) { |
|
| 806 | + $brut_sql .= '<strong>' . $key . '</strong> => ' . spip_htmlspecialchars(couper($val, 150)) . "<br />\n"; |
|
| 807 | + } |
|
| 808 | + $brut_sql .= '</p>'; |
|
| 809 | + } |
|
| 810 | + $num++; |
|
| 811 | + } |
|
| 812 | + $res2 = interdire_scripts($brut_sql); |
|
| 813 | + foreach ($quoi as $view) { |
|
| 814 | + // ne pas afficher les $contexte_inclus |
|
| 815 | + $view = preg_replace(',<\?php.+\?[>],Uims', '', $view); |
|
| 816 | + if ($view) { |
|
| 817 | + $res2 .= "\n<br /><fieldset>" . interdire_scripts($view) . '</fieldset>'; |
|
| 818 | + } |
|
| 819 | + } |
|
| 820 | + } elseif ($affiche == 'code') { |
|
| 821 | + $legend = $nom; |
|
| 822 | + $res = ancre_texte('<' . "?php\n" . $quoi . "\n?" . '>'); |
|
| 823 | + } elseif ($affiche == 'boucle') { |
|
| 824 | + $legend = _T('zbug_boucle') . ' ' . $nom; |
|
| 825 | + // Le compilateur prefixe le nom des boucles par l'extension du fichier source. |
|
| 826 | + $gram = preg_match('/^([^_]+)_/', $objet, $r) ? $r[1] : ''; |
|
| 827 | + $res = ancre_texte(public_decompiler($quoi, $gram, 0, 'boucle')); |
|
| 828 | + } elseif ($affiche == 'squelette') { |
|
| 829 | + $legend = $GLOBALS['debug_objets']['sourcefile'][$objet]; |
|
| 830 | + $res = ancre_texte($GLOBALS['debug_objets']['squelette'][$objet]); |
|
| 831 | + } |
|
| 832 | + |
|
| 833 | + return [$legend, $res, $res2]; |
|
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | function debusquer_entete($titre, $corps) { |
| 837 | 837 | |
| 838 | - include_spip('balise/formulaire_admin'); |
|
| 839 | - include_spip('public/assembler'); // pour inclure_balise_dynamique |
|
| 840 | - include_spip('inc/texte'); // pour corriger_typo |
|
| 841 | - |
|
| 842 | - return _DOCTYPE_ECRIRE . |
|
| 843 | - html_lang_attributes() . |
|
| 844 | - "<head>\n<title>" . |
|
| 845 | - ('SPIP ' . $GLOBALS['spip_version_affichee'] . ' ' . |
|
| 846 | - _T('admin_debug') . ' ' . spip_htmlspecialchars($titre) . ' (' . |
|
| 847 | - supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))) . |
|
| 848 | - ")</title>\n" . |
|
| 849 | - "<meta http-equiv='Content-Type' content='text/html" . |
|
| 850 | - (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : '') . |
|
| 851 | - "' />\n" . |
|
| 852 | - http_script('', 'jquery.js') |
|
| 853 | - . "<link rel='stylesheet' href='" . url_absolue(find_in_path('spip_admin.css')) |
|
| 854 | - . "' type='text/css' />" . |
|
| 855 | - "</head>\n" . |
|
| 856 | - "<body style='margin:0 10px;'>\n" . |
|
| 857 | - "<div id='spip-debug-header'>" . |
|
| 858 | - $corps . |
|
| 859 | - inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false) . |
|
| 860 | - '</div></body></html>'; |
|
| 838 | + include_spip('balise/formulaire_admin'); |
|
| 839 | + include_spip('public/assembler'); // pour inclure_balise_dynamique |
|
| 840 | + include_spip('inc/texte'); // pour corriger_typo |
|
| 841 | + |
|
| 842 | + return _DOCTYPE_ECRIRE . |
|
| 843 | + html_lang_attributes() . |
|
| 844 | + "<head>\n<title>" . |
|
| 845 | + ('SPIP ' . $GLOBALS['spip_version_affichee'] . ' ' . |
|
| 846 | + _T('admin_debug') . ' ' . spip_htmlspecialchars($titre) . ' (' . |
|
| 847 | + supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))) . |
|
| 848 | + ")</title>\n" . |
|
| 849 | + "<meta http-equiv='Content-Type' content='text/html" . |
|
| 850 | + (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : '') . |
|
| 851 | + "' />\n" . |
|
| 852 | + http_script('', 'jquery.js') |
|
| 853 | + . "<link rel='stylesheet' href='" . url_absolue(find_in_path('spip_admin.css')) |
|
| 854 | + . "' type='text/css' />" . |
|
| 855 | + "</head>\n" . |
|
| 856 | + "<body style='margin:0 10px;'>\n" . |
|
| 857 | + "<div id='spip-debug-header'>" . |
|
| 858 | + $corps . |
|
| 859 | + inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false) . |
|
| 860 | + '</div></body></html>'; |
|
| 861 | 861 | } |
@@ -4,585 +4,585 @@ |
||
| 4 | 4 | // ** ne pas modifier le fichier ** |
| 5 | 5 | |
| 6 | 6 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 7 | - return; |
|
| 7 | + return; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $GLOBALS[$GLOBALS['idx_lang']] = array( |
| 11 | 11 | |
| 12 | - // A |
|
| 13 | - 'activer_plugin' => 'Aktivera insticksmodulen', |
|
| 14 | - 'affichage' => 'Visa', |
|
| 15 | - 'aide_non_disponible' => 'Den här delen av direkthjälpen finns inte i det aktuella språket', |
|
| 16 | - 'auteur' => 'Redaktör', |
|
| 17 | - 'avis_acces_interdit' => 'Tillträde förbjudet.', |
|
| 18 | - 'avis_article_modifie' => 'Varning, @nom_auteur_modif@ har arbetat på den här artikeln för @date_diff@ minuter sen', |
|
| 19 | - 'avis_aucun_resultat' => 'Hittade inga resultat', |
|
| 20 | - 'avis_chemin_invalide_1' => 'Sökvägen du har angett', |
|
| 21 | - 'avis_chemin_invalide_2' => 'är ogiltig. Återgå till den föregående sidan och kontrollera den angivna informationen', |
|
| 22 | - 'avis_connexion_echec_1' => 'Anslutningen till SQL-servern misslyckades.', |
|
| 23 | - 'avis_connexion_echec_2' => 'Återgå till den föregående sidan och kontrollera informationen du angivit.', |
|
| 24 | - 'avis_connexion_echec_3' => '<b>OBS</b> På många servrar måste du <b>begära</b> aktivering av din databas innan du kan använda den. Om du inte lyckas med uppkopplingen, se till att den är aktiverad.', |
|
| 25 | - 'avis_connexion_ldap_echec_1' => 'Anslutning till LDAP-server misslyckades.', |
|
| 26 | - 'avis_connexion_ldap_echec_2' => 'Återgå till den föregående sidan och kontrollera informationen du angivit.', |
|
| 27 | - 'avis_connexion_ldap_echec_3' => 'Alternativt kan du välja att inte använda LDAP stöd för att importera användare.', |
|
| 28 | - 'avis_deplacement_rubrique' => 'Varning! Den här avdelningen innehåller @contient_breves@ notiser@scb@: om du flyttar den, markera i kryssrutan för att bekräfta.', |
|
| 29 | - 'avis_erreur_connexion_mysql' => 'Fel på SQL-förbindelsen', |
|
| 30 | - 'avis_espace_interdit' => '<b>Förbjudet område</b><p>SPIP är redan installerat.', # MODIF |
|
| 31 | - 'avis_lecture_noms_bases_1' => 'Installerings-scriptet kunde inte läsa namnen på de installerade databaserna.', |
|
| 32 | - 'avis_lecture_noms_bases_2' => 'Antingen finns det ingen tillgänglig databas eller så är funktionen som listar |
|
| 12 | + // A |
|
| 13 | + 'activer_plugin' => 'Aktivera insticksmodulen', |
|
| 14 | + 'affichage' => 'Visa', |
|
| 15 | + 'aide_non_disponible' => 'Den här delen av direkthjälpen finns inte i det aktuella språket', |
|
| 16 | + 'auteur' => 'Redaktör', |
|
| 17 | + 'avis_acces_interdit' => 'Tillträde förbjudet.', |
|
| 18 | + 'avis_article_modifie' => 'Varning, @nom_auteur_modif@ har arbetat på den här artikeln för @date_diff@ minuter sen', |
|
| 19 | + 'avis_aucun_resultat' => 'Hittade inga resultat', |
|
| 20 | + 'avis_chemin_invalide_1' => 'Sökvägen du har angett', |
|
| 21 | + 'avis_chemin_invalide_2' => 'är ogiltig. Återgå till den föregående sidan och kontrollera den angivna informationen', |
|
| 22 | + 'avis_connexion_echec_1' => 'Anslutningen till SQL-servern misslyckades.', |
|
| 23 | + 'avis_connexion_echec_2' => 'Återgå till den föregående sidan och kontrollera informationen du angivit.', |
|
| 24 | + 'avis_connexion_echec_3' => '<b>OBS</b> På många servrar måste du <b>begära</b> aktivering av din databas innan du kan använda den. Om du inte lyckas med uppkopplingen, se till att den är aktiverad.', |
|
| 25 | + 'avis_connexion_ldap_echec_1' => 'Anslutning till LDAP-server misslyckades.', |
|
| 26 | + 'avis_connexion_ldap_echec_2' => 'Återgå till den föregående sidan och kontrollera informationen du angivit.', |
|
| 27 | + 'avis_connexion_ldap_echec_3' => 'Alternativt kan du välja att inte använda LDAP stöd för att importera användare.', |
|
| 28 | + 'avis_deplacement_rubrique' => 'Varning! Den här avdelningen innehåller @contient_breves@ notiser@scb@: om du flyttar den, markera i kryssrutan för att bekräfta.', |
|
| 29 | + 'avis_erreur_connexion_mysql' => 'Fel på SQL-förbindelsen', |
|
| 30 | + 'avis_espace_interdit' => '<b>Förbjudet område</b><p>SPIP är redan installerat.', # MODIF |
|
| 31 | + 'avis_lecture_noms_bases_1' => 'Installerings-scriptet kunde inte läsa namnen på de installerade databaserna.', |
|
| 32 | + 'avis_lecture_noms_bases_2' => 'Antingen finns det ingen tillgänglig databas eller så är funktionen som listar |
|
| 33 | 33 | databaser inaktiverad av säkerhetsskäl (det är fallet hos många webbvärdar).', |
| 34 | - 'avis_lecture_noms_bases_3' => 'I fråga om det andra alternativet är det möjligt att en databas med ditt användarnamn kan användas:', |
|
| 35 | - 'avis_non_acces_page' => 'Du har inte tillgång till den här sidan.', |
|
| 36 | - 'avis_operation_echec' => 'Operationen misslyckades.', |
|
| 37 | - 'avis_operation_impossible' => 'Operationen omöjlig att genomföra', |
|
| 38 | - 'avis_suppression_base' => 'OBS! Radering av data är permanent och kan inte göras ogjord.', |
|
| 34 | + 'avis_lecture_noms_bases_3' => 'I fråga om det andra alternativet är det möjligt att en databas med ditt användarnamn kan användas:', |
|
| 35 | + 'avis_non_acces_page' => 'Du har inte tillgång till den här sidan.', |
|
| 36 | + 'avis_operation_echec' => 'Operationen misslyckades.', |
|
| 37 | + 'avis_operation_impossible' => 'Operationen omöjlig att genomföra', |
|
| 38 | + 'avis_suppression_base' => 'OBS! Radering av data är permanent och kan inte göras ogjord.', |
|
| 39 | 39 | |
| 40 | - // B |
|
| 41 | - 'bouton_acces_ldap' => 'Lägg till en LDAP-katalog >>', |
|
| 42 | - 'bouton_ajouter' => 'Lägg till', |
|
| 43 | - 'bouton_annuler' => 'Avbryt', |
|
| 44 | - 'bouton_demande_publication' => 'Begär att den här artikeln ska publiceras', |
|
| 45 | - 'bouton_desactive_tout' => 'Avaktivera alla', |
|
| 46 | - 'bouton_desinstaller' => 'Avinstallera', |
|
| 47 | - 'bouton_effacer_tout' => 'Radera ALLA', |
|
| 48 | - 'bouton_envoyer_message' => 'Färdigt meddelande: skicka', |
|
| 49 | - 'bouton_modifier' => 'Ändra', |
|
| 50 | - 'bouton_radio_afficher' => 'Visa', |
|
| 51 | - 'bouton_radio_apparaitre_liste_redacteurs_connectes' => 'Synas i listan över anslutna redaktörere', |
|
| 52 | - 'bouton_radio_envoi_annonces_adresse' => 'Skicka meddelanden till adressen:', |
|
| 53 | - 'bouton_radio_envoi_liste_nouveautes' => 'Skicka lista över senaste notiser', |
|
| 54 | - 'bouton_radio_non_apparaitre_liste_redacteurs_connectes' => 'Inte synas i listan över anslutna redaktörere', |
|
| 55 | - 'bouton_radio_non_envoi_annonces_editoriales' => 'Skicka inga redaktionella meddelanden', |
|
| 56 | - 'bouton_redirection' => 'OMPEKA', |
|
| 57 | - 'bouton_relancer_installation' => 'Kör installationen igen', |
|
| 58 | - 'bouton_suivant' => 'Nästa', |
|
| 59 | - 'bouton_tenter_recuperation' => 'Försök till reparation', |
|
| 60 | - 'bouton_test_proxy' => 'Testa proxyn', |
|
| 61 | - 'bouton_vider_cache' => 'Töm cachen', |
|
| 40 | + // B |
|
| 41 | + 'bouton_acces_ldap' => 'Lägg till en LDAP-katalog >>', |
|
| 42 | + 'bouton_ajouter' => 'Lägg till', |
|
| 43 | + 'bouton_annuler' => 'Avbryt', |
|
| 44 | + 'bouton_demande_publication' => 'Begär att den här artikeln ska publiceras', |
|
| 45 | + 'bouton_desactive_tout' => 'Avaktivera alla', |
|
| 46 | + 'bouton_desinstaller' => 'Avinstallera', |
|
| 47 | + 'bouton_effacer_tout' => 'Radera ALLA', |
|
| 48 | + 'bouton_envoyer_message' => 'Färdigt meddelande: skicka', |
|
| 49 | + 'bouton_modifier' => 'Ändra', |
|
| 50 | + 'bouton_radio_afficher' => 'Visa', |
|
| 51 | + 'bouton_radio_apparaitre_liste_redacteurs_connectes' => 'Synas i listan över anslutna redaktörere', |
|
| 52 | + 'bouton_radio_envoi_annonces_adresse' => 'Skicka meddelanden till adressen:', |
|
| 53 | + 'bouton_radio_envoi_liste_nouveautes' => 'Skicka lista över senaste notiser', |
|
| 54 | + 'bouton_radio_non_apparaitre_liste_redacteurs_connectes' => 'Inte synas i listan över anslutna redaktörere', |
|
| 55 | + 'bouton_radio_non_envoi_annonces_editoriales' => 'Skicka inga redaktionella meddelanden', |
|
| 56 | + 'bouton_redirection' => 'OMPEKA', |
|
| 57 | + 'bouton_relancer_installation' => 'Kör installationen igen', |
|
| 58 | + 'bouton_suivant' => 'Nästa', |
|
| 59 | + 'bouton_tenter_recuperation' => 'Försök till reparation', |
|
| 60 | + 'bouton_test_proxy' => 'Testa proxyn', |
|
| 61 | + 'bouton_vider_cache' => 'Töm cachen', |
|
| 62 | 62 | |
| 63 | - // C |
|
| 64 | - 'cache_modifiable_webmestre' => 'Den här parametern kan ändras av den webbansvariga.', |
|
| 65 | - 'calendrier_synchro' => 'Om du använder ett kalenderprogram som är kompatibelt med <b>iCal</b> kan du synkronisera det med informationen på den här webbplatsen.', |
|
| 66 | - 'config_activer_champs' => 'Aktivera följande fält', |
|
| 67 | - 'config_choix_base_sup' => 'Ge namnet på en databas på servern', |
|
| 68 | - 'config_erreur_base_sup' => 'SPIP har inte tillgång till de existerande databaserna', |
|
| 69 | - 'config_info_base_sup_disponibles' => 'Ytterligare databaser dit databasfrågor kan skickas:', |
|
| 70 | - 'config_info_logos' => 'Alla objekt på sajten kan kan ha sin egen logotype och dessutom en "mouseover" logotype', |
|
| 71 | - 'config_info_logos_utiliser' => 'Använd logotyper', |
|
| 72 | - 'config_info_logos_utiliser_non' => 'Använd inte logotyper', |
|
| 73 | - 'config_info_logos_utiliser_survol' => 'Använd "mouseover" logotyper', |
|
| 74 | - 'config_info_logos_utiliser_survol_non' => 'Använd inte "mouseover" logotyper', |
|
| 75 | - 'config_info_redirection' => 'Genom att aktivera det här valet kan du skapa virtuella artiklar, som enbart är länkar till artiklar som publicerats på andra sajter oavsett om det är SPIP-sajter eller ej.', |
|
| 76 | - 'config_redirection' => 'Virtuella artiklar', |
|
| 77 | - 'config_titre_base_sup' => 'Konfigurera ytterligare en databas', |
|
| 78 | - 'config_titre_base_sup_choix' => 'Välj ytterligare en databas', |
|
| 79 | - 'connexion_ldap' => 'ldapuppkoppling:', |
|
| 63 | + // C |
|
| 64 | + 'cache_modifiable_webmestre' => 'Den här parametern kan ändras av den webbansvariga.', |
|
| 65 | + 'calendrier_synchro' => 'Om du använder ett kalenderprogram som är kompatibelt med <b>iCal</b> kan du synkronisera det med informationen på den här webbplatsen.', |
|
| 66 | + 'config_activer_champs' => 'Aktivera följande fält', |
|
| 67 | + 'config_choix_base_sup' => 'Ge namnet på en databas på servern', |
|
| 68 | + 'config_erreur_base_sup' => 'SPIP har inte tillgång till de existerande databaserna', |
|
| 69 | + 'config_info_base_sup_disponibles' => 'Ytterligare databaser dit databasfrågor kan skickas:', |
|
| 70 | + 'config_info_logos' => 'Alla objekt på sajten kan kan ha sin egen logotype och dessutom en "mouseover" logotype', |
|
| 71 | + 'config_info_logos_utiliser' => 'Använd logotyper', |
|
| 72 | + 'config_info_logos_utiliser_non' => 'Använd inte logotyper', |
|
| 73 | + 'config_info_logos_utiliser_survol' => 'Använd "mouseover" logotyper', |
|
| 74 | + 'config_info_logos_utiliser_survol_non' => 'Använd inte "mouseover" logotyper', |
|
| 75 | + 'config_info_redirection' => 'Genom att aktivera det här valet kan du skapa virtuella artiklar, som enbart är länkar till artiklar som publicerats på andra sajter oavsett om det är SPIP-sajter eller ej.', |
|
| 76 | + 'config_redirection' => 'Virtuella artiklar', |
|
| 77 | + 'config_titre_base_sup' => 'Konfigurera ytterligare en databas', |
|
| 78 | + 'config_titre_base_sup_choix' => 'Välj ytterligare en databas', |
|
| 79 | + 'connexion_ldap' => 'ldapuppkoppling:', |
|
| 80 | 80 | |
| 81 | - // D |
|
| 82 | - 'date_mot_heures' => 'h', |
|
| 81 | + // D |
|
| 82 | + 'date_mot_heures' => 'h', |
|
| 83 | 83 | |
| 84 | - // E |
|
| 85 | - 'email' => 'e-post', |
|
| 86 | - 'email_2' => 'e-post:', |
|
| 87 | - 'entree_adresse_annuaire' => 'Katalogens adress', |
|
| 88 | - 'entree_adresse_email' => 'Din e-postadress', |
|
| 89 | - 'entree_base_donnee_1' => 'Adress till databasen', |
|
| 90 | - 'entree_base_donnee_2' => '(Ofta är det samma adress som till din webbplats, ibland är det "localhost" och ibland lämnas det helt tomt.)', |
|
| 91 | - 'entree_biographie' => 'Kort biografi med några få ord.', |
|
| 92 | - 'entree_chemin_acces' => '<b>Fyll i</b> sökvägen:', |
|
| 93 | - 'entree_cle_pgp' => 'Din PGP-nyckel', |
|
| 94 | - 'entree_contenu_rubrique' => '(Några få ord som beskriver innehållet i avdelningen)', |
|
| 95 | - 'entree_identifiants_connexion' => 'Dina anslutningsuppgifter', |
|
| 96 | - 'entree_informations_connexion_ldap' => 'Fyll i det här formuläret med uppgifter om din anslutning till LDAP. Din system eller nätverks administratör kan ge dig dessa.', |
|
| 97 | - 'entree_infos_perso' => 'Vem är du?', |
|
| 98 | - 'entree_interieur_rubrique' => 'I avdelning:', |
|
| 99 | - 'entree_liens_sites' => '<b>Hyperlänk</b> (referens, sajt att besöka...)', |
|
| 100 | - 'entree_login' => 'Dina användaruppgifter', |
|
| 101 | - 'entree_login_connexion_1' => 'Användarupgifter för anslutningen', |
|
| 102 | - 'entree_login_connexion_2' => '(Är ibland samma som lösenordet för FTP-åtkomst och ibland kan det lämnas tomt)', |
|
| 103 | - 'entree_mot_passe' => 'Ditt lösenord', |
|
| 104 | - 'entree_mot_passe_1' => 'Lösenord för anslutningen', |
|
| 105 | - 'entree_mot_passe_2' => '(Är ibland samma som lösenordet för FTP-åtkomst och ibland kan det lämnas tomt)', |
|
| 106 | - 'entree_nom_fichier' => 'Skriv in filnamnet @texte_compresse@', |
|
| 107 | - 'entree_nom_pseudo' => 'Ditt namn eller alias', |
|
| 108 | - 'entree_nom_pseudo_1' => '(Ditt namn eller alias)', |
|
| 109 | - 'entree_nom_site' => 'Din webbplats namn', |
|
| 110 | - 'entree_nouveau_passe' => 'Nytt lösenord', |
|
| 111 | - 'entree_passe_ldap' => 'Lösenord', |
|
| 112 | - 'entree_port_annuaire' => 'Katalogens portnummer', |
|
| 113 | - 'entree_signature' => 'Signatur', |
|
| 114 | - 'entree_titre_obligatoire' => '<b>Title</b> [Krävs]<br />', |
|
| 115 | - 'entree_url' => 'Din webbplats URL', |
|
| 116 | - 'erreur_plugin_fichier_absent' => 'Filen saknas', |
|
| 117 | - 'erreur_plugin_fichier_def_absent' => 'Definitionsfilen saknas', |
|
| 118 | - 'erreur_plugin_nom_fonction_interdit' => 'Förbjudet namn för funktionen', |
|
| 119 | - 'erreur_plugin_nom_manquant' => 'plugin-namnet saknas', |
|
| 120 | - 'erreur_plugin_prefix_manquant' => 'Pluginens prefix odefinierad', |
|
| 121 | - 'erreur_plugin_tag_plugin_absent' => '<plugin> saknas i definitionsfilen', |
|
| 122 | - 'erreur_plugin_version_manquant' => 'Denna plugin saknar version.', |
|
| 84 | + // E |
|
| 85 | + 'email' => 'e-post', |
|
| 86 | + 'email_2' => 'e-post:', |
|
| 87 | + 'entree_adresse_annuaire' => 'Katalogens adress', |
|
| 88 | + 'entree_adresse_email' => 'Din e-postadress', |
|
| 89 | + 'entree_base_donnee_1' => 'Adress till databasen', |
|
| 90 | + 'entree_base_donnee_2' => '(Ofta är det samma adress som till din webbplats, ibland är det "localhost" och ibland lämnas det helt tomt.)', |
|
| 91 | + 'entree_biographie' => 'Kort biografi med några få ord.', |
|
| 92 | + 'entree_chemin_acces' => '<b>Fyll i</b> sökvägen:', |
|
| 93 | + 'entree_cle_pgp' => 'Din PGP-nyckel', |
|
| 94 | + 'entree_contenu_rubrique' => '(Några få ord som beskriver innehållet i avdelningen)', |
|
| 95 | + 'entree_identifiants_connexion' => 'Dina anslutningsuppgifter', |
|
| 96 | + 'entree_informations_connexion_ldap' => 'Fyll i det här formuläret med uppgifter om din anslutning till LDAP. Din system eller nätverks administratör kan ge dig dessa.', |
|
| 97 | + 'entree_infos_perso' => 'Vem är du?', |
|
| 98 | + 'entree_interieur_rubrique' => 'I avdelning:', |
|
| 99 | + 'entree_liens_sites' => '<b>Hyperlänk</b> (referens, sajt att besöka...)', |
|
| 100 | + 'entree_login' => 'Dina användaruppgifter', |
|
| 101 | + 'entree_login_connexion_1' => 'Användarupgifter för anslutningen', |
|
| 102 | + 'entree_login_connexion_2' => '(Är ibland samma som lösenordet för FTP-åtkomst och ibland kan det lämnas tomt)', |
|
| 103 | + 'entree_mot_passe' => 'Ditt lösenord', |
|
| 104 | + 'entree_mot_passe_1' => 'Lösenord för anslutningen', |
|
| 105 | + 'entree_mot_passe_2' => '(Är ibland samma som lösenordet för FTP-åtkomst och ibland kan det lämnas tomt)', |
|
| 106 | + 'entree_nom_fichier' => 'Skriv in filnamnet @texte_compresse@', |
|
| 107 | + 'entree_nom_pseudo' => 'Ditt namn eller alias', |
|
| 108 | + 'entree_nom_pseudo_1' => '(Ditt namn eller alias)', |
|
| 109 | + 'entree_nom_site' => 'Din webbplats namn', |
|
| 110 | + 'entree_nouveau_passe' => 'Nytt lösenord', |
|
| 111 | + 'entree_passe_ldap' => 'Lösenord', |
|
| 112 | + 'entree_port_annuaire' => 'Katalogens portnummer', |
|
| 113 | + 'entree_signature' => 'Signatur', |
|
| 114 | + 'entree_titre_obligatoire' => '<b>Title</b> [Krävs]<br />', |
|
| 115 | + 'entree_url' => 'Din webbplats URL', |
|
| 116 | + 'erreur_plugin_fichier_absent' => 'Filen saknas', |
|
| 117 | + 'erreur_plugin_fichier_def_absent' => 'Definitionsfilen saknas', |
|
| 118 | + 'erreur_plugin_nom_fonction_interdit' => 'Förbjudet namn för funktionen', |
|
| 119 | + 'erreur_plugin_nom_manquant' => 'plugin-namnet saknas', |
|
| 120 | + 'erreur_plugin_prefix_manquant' => 'Pluginens prefix odefinierad', |
|
| 121 | + 'erreur_plugin_tag_plugin_absent' => '<plugin> saknas i definitionsfilen', |
|
| 122 | + 'erreur_plugin_version_manquant' => 'Denna plugin saknar version.', |
|
| 123 | 123 | |
| 124 | - // I |
|
| 125 | - 'ical_info1' => 'Denna sida visar flera metoder att hålla dig informerad om aktiviteter på sajten.', |
|
| 126 | - 'ical_info2' => 'För mer information, tveka inte om att besöka <a href="@spipnet@">SPIP’s dokumentation</a>.', # MODIF |
|
| 127 | - 'ical_info_calendrier' => 'Du kan använda två kalendrar. En är en sajtkarta med alla publicerade artiklar. Den andra innehåller redaktionella meddelanden och dina senaste privata meddelanden: Den är personlig, tack vare en genererad nyckel som du kan förändra när som helst genom att byta lösenord.', |
|
| 128 | - 'ical_methode_http' => 'Nerladdning', |
|
| 129 | - 'ical_methode_webcal' => 'Synkronisering (webcal://)', # MODIF |
|
| 130 | - 'ical_texte_prive' => 'Den här kalendern som är personlig, innnehåller dina egna redaktionella händelser på den här sajten (uppgifter, egna möten, inlämnade artiklar och nyheter...).', |
|
| 131 | - 'ical_texte_public' => 'Den här kalendern låter dig följa den publika aktiviteten på sajten (publicerade artiklar och nyheter).', |
|
| 132 | - 'ical_texte_rss' => 'Du kan syndikerar de senaste nyheterna på den är sajten i vilken XML/RSS-läsare som helst. Det är samma format som gör det möjligt att läsa de senaste nyheterna på andra sajter som använder ett kompatibelt format. (syndikerade sajter).', |
|
| 133 | - 'ical_titre_js' => 'Javascript', |
|
| 134 | - 'ical_titre_mailing' => 'E-postlista', |
|
| 135 | - 'ical_titre_rss' => 'Syndikeringsfiler', |
|
| 136 | - 'icone_activer_cookie' => 'Sätt en cookie', |
|
| 137 | - 'icone_admin_plugin' => 'Hantera plugin’s', |
|
| 138 | - 'icone_afficher_auteurs' => 'Visa redaktörer', |
|
| 139 | - 'icone_afficher_visiteurs' => 'Visa besökare', |
|
| 140 | - 'icone_arret_discussion' => 'Avsluta diskussionen', |
|
| 141 | - 'icone_calendrier' => 'Kalender', |
|
| 142 | - 'icone_creer_auteur' => 'Skapa en ny redaktör och koppla honom (henne) till den här artikeln', |
|
| 143 | - 'icone_creer_mot_cle' => 'Skapa ett nytt nyckelord och länka det till artikeln', |
|
| 144 | - 'icone_creer_rubrique_2' => 'Skapa en ny avdelning', |
|
| 145 | - 'icone_modifier_article' => 'Editera artikeln', |
|
| 146 | - 'icone_modifier_rubrique' => 'Editera avdelningen', |
|
| 147 | - 'icone_relancer_signataire' => 'Kontakta personen igen', |
|
| 148 | - 'icone_retour' => 'Tillbaka', |
|
| 149 | - 'icone_retour_article' => 'Tillbaka till artikeln', |
|
| 150 | - 'icone_supprimer_cookie' => 'Radera cookien', |
|
| 151 | - 'icone_supprimer_rubrique' => 'Radera den här avdelningen', |
|
| 152 | - 'icone_supprimer_signature' => 'Radera den här signaturen', |
|
| 153 | - 'icone_valider_signature' => 'Validera signaturen', |
|
| 154 | - 'image_administrer_rubrique' => 'Du kan hantera den här avdelningen', |
|
| 155 | - 'impossible_modifier_login_auteur' => 'Impossible de modifier le login.', # MODIF |
|
| 156 | - 'impossible_modifier_pass_auteur' => 'Impossible de modifier le mot de passe.', # MODIF |
|
| 157 | - 'info_1_article' => '1 artikel', |
|
| 158 | - 'info_activer_cookie' => 'Du kan aktivera en <b>administrationscookie</b>, som tillåter dig |
|
| 124 | + // I |
|
| 125 | + 'ical_info1' => 'Denna sida visar flera metoder att hålla dig informerad om aktiviteter på sajten.', |
|
| 126 | + 'ical_info2' => 'För mer information, tveka inte om att besöka <a href="@spipnet@">SPIP’s dokumentation</a>.', # MODIF |
|
| 127 | + 'ical_info_calendrier' => 'Du kan använda två kalendrar. En är en sajtkarta med alla publicerade artiklar. Den andra innehåller redaktionella meddelanden och dina senaste privata meddelanden: Den är personlig, tack vare en genererad nyckel som du kan förändra när som helst genom att byta lösenord.', |
|
| 128 | + 'ical_methode_http' => 'Nerladdning', |
|
| 129 | + 'ical_methode_webcal' => 'Synkronisering (webcal://)', # MODIF |
|
| 130 | + 'ical_texte_prive' => 'Den här kalendern som är personlig, innnehåller dina egna redaktionella händelser på den här sajten (uppgifter, egna möten, inlämnade artiklar och nyheter...).', |
|
| 131 | + 'ical_texte_public' => 'Den här kalendern låter dig följa den publika aktiviteten på sajten (publicerade artiklar och nyheter).', |
|
| 132 | + 'ical_texte_rss' => 'Du kan syndikerar de senaste nyheterna på den är sajten i vilken XML/RSS-läsare som helst. Det är samma format som gör det möjligt att läsa de senaste nyheterna på andra sajter som använder ett kompatibelt format. (syndikerade sajter).', |
|
| 133 | + 'ical_titre_js' => 'Javascript', |
|
| 134 | + 'ical_titre_mailing' => 'E-postlista', |
|
| 135 | + 'ical_titre_rss' => 'Syndikeringsfiler', |
|
| 136 | + 'icone_activer_cookie' => 'Sätt en cookie', |
|
| 137 | + 'icone_admin_plugin' => 'Hantera plugin’s', |
|
| 138 | + 'icone_afficher_auteurs' => 'Visa redaktörer', |
|
| 139 | + 'icone_afficher_visiteurs' => 'Visa besökare', |
|
| 140 | + 'icone_arret_discussion' => 'Avsluta diskussionen', |
|
| 141 | + 'icone_calendrier' => 'Kalender', |
|
| 142 | + 'icone_creer_auteur' => 'Skapa en ny redaktör och koppla honom (henne) till den här artikeln', |
|
| 143 | + 'icone_creer_mot_cle' => 'Skapa ett nytt nyckelord och länka det till artikeln', |
|
| 144 | + 'icone_creer_rubrique_2' => 'Skapa en ny avdelning', |
|
| 145 | + 'icone_modifier_article' => 'Editera artikeln', |
|
| 146 | + 'icone_modifier_rubrique' => 'Editera avdelningen', |
|
| 147 | + 'icone_relancer_signataire' => 'Kontakta personen igen', |
|
| 148 | + 'icone_retour' => 'Tillbaka', |
|
| 149 | + 'icone_retour_article' => 'Tillbaka till artikeln', |
|
| 150 | + 'icone_supprimer_cookie' => 'Radera cookien', |
|
| 151 | + 'icone_supprimer_rubrique' => 'Radera den här avdelningen', |
|
| 152 | + 'icone_supprimer_signature' => 'Radera den här signaturen', |
|
| 153 | + 'icone_valider_signature' => 'Validera signaturen', |
|
| 154 | + 'image_administrer_rubrique' => 'Du kan hantera den här avdelningen', |
|
| 155 | + 'impossible_modifier_login_auteur' => 'Impossible de modifier le login.', # MODIF |
|
| 156 | + 'impossible_modifier_pass_auteur' => 'Impossible de modifier le mot de passe.', # MODIF |
|
| 157 | + 'info_1_article' => '1 artikel', |
|
| 158 | + 'info_activer_cookie' => 'Du kan aktivera en <b>administrationscookie</b>, som tillåter dig |
|
| 159 | 159 | att enkelt växla mellan den publika och den privata delen.', |
| 160 | - 'info_administrateur' => 'Administratör', |
|
| 161 | - 'info_administrateur_1' => 'Administratör', |
|
| 162 | - 'info_administrateur_2' => 'på sajten (<i>använd med försiktighet</i>)', |
|
| 163 | - 'info_administrateur_site_01' => 'Om du är en sajt-administratör, var vänlig', |
|
| 164 | - 'info_administrateur_site_02' => 'klicka på den här länken', |
|
| 165 | - 'info_administrateurs' => 'Administratörer', |
|
| 166 | - 'info_administrer_rubrique' => 'Du kan hantera den här avdelningen', |
|
| 167 | - 'info_adresse' => 'till adressen:', |
|
| 168 | - 'info_adresse_url' => 'Din sajts publika URL', |
|
| 169 | - 'info_aide_en_ligne' => 'SPIP Online Hjälp', |
|
| 170 | - 'info_ajout_image' => 'När du lägget till filer som bifogade dokument till en artikel, |
|
| 160 | + 'info_administrateur' => 'Administratör', |
|
| 161 | + 'info_administrateur_1' => 'Administratör', |
|
| 162 | + 'info_administrateur_2' => 'på sajten (<i>använd med försiktighet</i>)', |
|
| 163 | + 'info_administrateur_site_01' => 'Om du är en sajt-administratör, var vänlig', |
|
| 164 | + 'info_administrateur_site_02' => 'klicka på den här länken', |
|
| 165 | + 'info_administrateurs' => 'Administratörer', |
|
| 166 | + 'info_administrer_rubrique' => 'Du kan hantera den här avdelningen', |
|
| 167 | + 'info_adresse' => 'till adressen:', |
|
| 168 | + 'info_adresse_url' => 'Din sajts publika URL', |
|
| 169 | + 'info_aide_en_ligne' => 'SPIP Online Hjälp', |
|
| 170 | + 'info_ajout_image' => 'När du lägget till filer som bifogade dokument till en artikel, |
|
| 171 | 171 | kan SPIP automatiskt skapa miniatyrer av de |
| 172 | 172 | inlagda bilderna. Det tillåter till exempel |
| 173 | 173 | att man automatiskt skapar ett galleri eller en portfolio.', |
| 174 | - 'info_ajouter_rubrique' => 'lägg till en annan avdelning:', |
|
| 175 | - 'info_annonce_nouveautes' => 'Senaste nyheterna', |
|
| 176 | - 'info_article' => 'artikel', |
|
| 177 | - 'info_article_2' => 'artiklar', |
|
| 178 | - 'info_article_a_paraitre' => 'Fördaterade artiklar som kommer att publiceras', |
|
| 179 | - 'info_articles_02' => 'artiklar', |
|
| 180 | - 'info_articles_2' => 'Artiklar', |
|
| 181 | - 'info_articles_auteur' => 'Den här redaktörens artiklar', |
|
| 182 | - 'info_articles_trouves' => 'Artiklar hittade', |
|
| 183 | - 'info_attente_validation' => 'Dina artiklar som väntar på validering', |
|
| 184 | - 'info_aujourdhui' => 'idag:', |
|
| 185 | - 'info_auteurs' => 'Redaktörer', |
|
| 186 | - 'info_auteurs_par_tri' => 'Redaktörer@partri@', |
|
| 187 | - 'info_auteurs_trouves' => 'Redaktörer funna', |
|
| 188 | - 'info_authentification_externe' => 'Extern autentifiering', |
|
| 189 | - 'info_avertissement' => 'Varning', |
|
| 190 | - 'info_barre_outils' => 'med dess verktygsfält?', |
|
| 191 | - 'info_base_installee' => 'Databasen är skapad', |
|
| 192 | - 'info_chapeau' => 'Ingress', |
|
| 193 | - 'info_chapeau_2' => 'Introduktion:', |
|
| 194 | - 'info_chemin_acces_1' => 'inställningar: <b>sökväg i katalogen</b>', |
|
| 195 | - 'info_chemin_acces_2' => 'Från och med nu måste du konfigurera sökvägen till katalogen information. Det är nödvändigt för att kunna läsa användarprofilerna som är sparade i katalogen.', |
|
| 196 | - 'info_chemin_acces_annuaire' => 'Inställningar: <b>Sökväg i katalogen</b>', |
|
| 197 | - 'info_choix_base' => 'Tredje steget:', |
|
| 198 | - 'info_code_acces' => 'Glöm inte ditt eget lösenord!', |
|
| 199 | - 'info_config_suivi' => 'Om den här adressen är en mailing lista, kan du under adressen visa var man kan registrera sig. Det kan vara en URL (till exempel en webbsida där man kan registrera sig), eller en e-postadress med en speciell ärenderad (till exempel: <tt>@adresse_suivi@?subject=subscribe</tt>):', |
|
| 200 | - 'info_config_suivi_explication' => 'Du kan anmäla dig till sajtens nyhetsbrev. Du kommer då att automatiskt få meddelanden om artiklar och nyheter som laddats upp för publicering.', |
|
| 201 | - 'info_confirmer_passe' => 'Bekräfta ditt nya lösenord:', |
|
| 202 | - 'info_connexion_base' => 'Försöker att ansluta till databasen', |
|
| 203 | - 'info_connexion_ldap_ok' => 'Din förbindelse till LDAP-servern lyckades.</b><p> Du kan gå vidare till nästa steg.</p>', # MODIF |
|
| 204 | - 'info_connexion_mysql' => 'Din databasförbindelse', |
|
| 205 | - 'info_connexion_ok' => 'Förbindelsen lyckades.', |
|
| 206 | - 'info_contact' => 'Kontakt', |
|
| 207 | - 'info_contenu_articles' => 'Innehåll i artiklarna', |
|
| 208 | - 'info_creation_paragraphe' => '(För att skapa stycken, räcker det att lämna tomma rader.)', # MODIF |
|
| 209 | - 'info_creation_rubrique' => 'Innan du kan skriva artiklar,<br /> måste du skapa åtminstone en avdelning.<br />', |
|
| 210 | - 'info_creation_tables' => 'Skapar databastabeller', |
|
| 211 | - 'info_creer_base' => '<b>Skapa</b> en ny databas:', |
|
| 212 | - 'info_dans_rubrique' => 'I avdelningen:', |
|
| 213 | - 'info_date_publication_anterieure' => 'Datum för tidigare publicering:', |
|
| 214 | - 'info_date_referencement' => 'DATUM DÅ SAJTEN LÄNKADES:', |
|
| 215 | - 'info_derniere_etape' => 'Klart!', |
|
| 216 | - 'info_descriptif' => 'Beskrivning:', |
|
| 217 | - 'info_desinstaller_plugin' => 'raderar data och avaktiverar tillägget', |
|
| 218 | - 'info_discussion_cours' => 'Pågående diskussion', |
|
| 219 | - 'info_ecrire_article' => 'Innan du kan skriva artiklar, ymåste du skapa minst en avdelning.', |
|
| 220 | - 'info_email_envoi' => 'Avsändaren mailadress (frivilligt)', |
|
| 221 | - 'info_email_envoi_txt' => 'Skriv in avsändarens e-postadress som används när man sänder mejlen (som default används mottagarens adress som avsändaradress) :', |
|
| 222 | - 'info_email_webmestre' => 'Webmasterns mejladress (frivillig)', # MODIF |
|
| 223 | - 'info_envoi_email_automatique' => 'Automatisk e-post', |
|
| 224 | - 'info_envoyer_maintenant' => 'Skicka nu', |
|
| 225 | - 'info_etape_suivante' => 'Gå till nästa steg', |
|
| 226 | - 'info_etape_suivante_1' => 'Du kan fortsätta till nästa steg.', |
|
| 227 | - 'info_etape_suivante_2' => 'Du kan fortsätta till nästa steg.', |
|
| 228 | - 'info_exportation_base' => 'Exportera databasen till @archive@', |
|
| 229 | - 'info_facilite_suivi_activite' => 'För att underlätta att följa de redaktionella; |
|
| 174 | + 'info_ajouter_rubrique' => 'lägg till en annan avdelning:', |
|
| 175 | + 'info_annonce_nouveautes' => 'Senaste nyheterna', |
|
| 176 | + 'info_article' => 'artikel', |
|
| 177 | + 'info_article_2' => 'artiklar', |
|
| 178 | + 'info_article_a_paraitre' => 'Fördaterade artiklar som kommer att publiceras', |
|
| 179 | + 'info_articles_02' => 'artiklar', |
|
| 180 | + 'info_articles_2' => 'Artiklar', |
|
| 181 | + 'info_articles_auteur' => 'Den här redaktörens artiklar', |
|
| 182 | + 'info_articles_trouves' => 'Artiklar hittade', |
|
| 183 | + 'info_attente_validation' => 'Dina artiklar som väntar på validering', |
|
| 184 | + 'info_aujourdhui' => 'idag:', |
|
| 185 | + 'info_auteurs' => 'Redaktörer', |
|
| 186 | + 'info_auteurs_par_tri' => 'Redaktörer@partri@', |
|
| 187 | + 'info_auteurs_trouves' => 'Redaktörer funna', |
|
| 188 | + 'info_authentification_externe' => 'Extern autentifiering', |
|
| 189 | + 'info_avertissement' => 'Varning', |
|
| 190 | + 'info_barre_outils' => 'med dess verktygsfält?', |
|
| 191 | + 'info_base_installee' => 'Databasen är skapad', |
|
| 192 | + 'info_chapeau' => 'Ingress', |
|
| 193 | + 'info_chapeau_2' => 'Introduktion:', |
|
| 194 | + 'info_chemin_acces_1' => 'inställningar: <b>sökväg i katalogen</b>', |
|
| 195 | + 'info_chemin_acces_2' => 'Från och med nu måste du konfigurera sökvägen till katalogen information. Det är nödvändigt för att kunna läsa användarprofilerna som är sparade i katalogen.', |
|
| 196 | + 'info_chemin_acces_annuaire' => 'Inställningar: <b>Sökväg i katalogen</b>', |
|
| 197 | + 'info_choix_base' => 'Tredje steget:', |
|
| 198 | + 'info_code_acces' => 'Glöm inte ditt eget lösenord!', |
|
| 199 | + 'info_config_suivi' => 'Om den här adressen är en mailing lista, kan du under adressen visa var man kan registrera sig. Det kan vara en URL (till exempel en webbsida där man kan registrera sig), eller en e-postadress med en speciell ärenderad (till exempel: <tt>@adresse_suivi@?subject=subscribe</tt>):', |
|
| 200 | + 'info_config_suivi_explication' => 'Du kan anmäla dig till sajtens nyhetsbrev. Du kommer då att automatiskt få meddelanden om artiklar och nyheter som laddats upp för publicering.', |
|
| 201 | + 'info_confirmer_passe' => 'Bekräfta ditt nya lösenord:', |
|
| 202 | + 'info_connexion_base' => 'Försöker att ansluta till databasen', |
|
| 203 | + 'info_connexion_ldap_ok' => 'Din förbindelse till LDAP-servern lyckades.</b><p> Du kan gå vidare till nästa steg.</p>', # MODIF |
|
| 204 | + 'info_connexion_mysql' => 'Din databasförbindelse', |
|
| 205 | + 'info_connexion_ok' => 'Förbindelsen lyckades.', |
|
| 206 | + 'info_contact' => 'Kontakt', |
|
| 207 | + 'info_contenu_articles' => 'Innehåll i artiklarna', |
|
| 208 | + 'info_creation_paragraphe' => '(För att skapa stycken, räcker det att lämna tomma rader.)', # MODIF |
|
| 209 | + 'info_creation_rubrique' => 'Innan du kan skriva artiklar,<br /> måste du skapa åtminstone en avdelning.<br />', |
|
| 210 | + 'info_creation_tables' => 'Skapar databastabeller', |
|
| 211 | + 'info_creer_base' => '<b>Skapa</b> en ny databas:', |
|
| 212 | + 'info_dans_rubrique' => 'I avdelningen:', |
|
| 213 | + 'info_date_publication_anterieure' => 'Datum för tidigare publicering:', |
|
| 214 | + 'info_date_referencement' => 'DATUM DÅ SAJTEN LÄNKADES:', |
|
| 215 | + 'info_derniere_etape' => 'Klart!', |
|
| 216 | + 'info_descriptif' => 'Beskrivning:', |
|
| 217 | + 'info_desinstaller_plugin' => 'raderar data och avaktiverar tillägget', |
|
| 218 | + 'info_discussion_cours' => 'Pågående diskussion', |
|
| 219 | + 'info_ecrire_article' => 'Innan du kan skriva artiklar, ymåste du skapa minst en avdelning.', |
|
| 220 | + 'info_email_envoi' => 'Avsändaren mailadress (frivilligt)', |
|
| 221 | + 'info_email_envoi_txt' => 'Skriv in avsändarens e-postadress som används när man sänder mejlen (som default används mottagarens adress som avsändaradress) :', |
|
| 222 | + 'info_email_webmestre' => 'Webmasterns mejladress (frivillig)', # MODIF |
|
| 223 | + 'info_envoi_email_automatique' => 'Automatisk e-post', |
|
| 224 | + 'info_envoyer_maintenant' => 'Skicka nu', |
|
| 225 | + 'info_etape_suivante' => 'Gå till nästa steg', |
|
| 226 | + 'info_etape_suivante_1' => 'Du kan fortsätta till nästa steg.', |
|
| 227 | + 'info_etape_suivante_2' => 'Du kan fortsätta till nästa steg.', |
|
| 228 | + 'info_exportation_base' => 'Exportera databasen till @archive@', |
|
| 229 | + 'info_facilite_suivi_activite' => 'För att underlätta att följa de redaktionella; |
|
| 230 | 230 | aktiviteterna, kan SPIP skicka medddelanden via e-post, exempelvis till en maillista för redaktörer, |
| 231 | 231 | angående publiceringar och godkännanden.', # MODIF |
| 232 | - 'info_fichiers_authent' => 'Lösenordsfil ".htpasswd"', |
|
| 233 | - 'info_gauche_auteurs' => 'Här hittar du alla redaktörer på sajten. |
|
| 232 | + 'info_fichiers_authent' => 'Lösenordsfil ".htpasswd"', |
|
| 233 | + 'info_gauche_auteurs' => 'Här hittar du alla redaktörer på sajten. |
|
| 234 | 234 | Status på var och en av dem visas av färgen på ikonen (administratör = grön; redaktör = gul).', |
| 235 | - 'info_gauche_auteurs_exterieurs' => 'Externa redaktörer utan behörighet på sajten, visas med en blå ikon; raderade redaktörer med en soptunna.', # MODIF |
|
| 236 | - 'info_generation_miniatures_images' => 'Skapande av tumnagelbilder.', |
|
| 237 | - 'info_hebergeur_desactiver_envoi_email' => 'Vissa webhotell avaktiverar automatisk mejl |
|
| 235 | + 'info_gauche_auteurs_exterieurs' => 'Externa redaktörer utan behörighet på sajten, visas med en blå ikon; raderade redaktörer med en soptunna.', # MODIF |
|
| 236 | + 'info_generation_miniatures_images' => 'Skapande av tumnagelbilder.', |
|
| 237 | + 'info_hebergeur_desactiver_envoi_email' => 'Vissa webhotell avaktiverar automatisk mejl |
|
| 238 | 238 | på deras servrar. Om så är fallet kan följande |
| 239 | 239 | funktioner hos SPIP inte användas.', |
| 240 | - 'info_hier' => 'I går:', |
|
| 241 | - 'info_identification_publique' => 'Din publika identitet...', |
|
| 242 | - 'info_image_process' => 'Välj den bästa metoden för att skapa miniatyrer genom att klicka på motsvarande bild.', |
|
| 243 | - 'info_image_process2' => '<b>OBS!.</b> <i>Om du inte kan se någon bild, så är din server inte konfigurerad för att använda sådana verktyg. Om du vill använda dessa finesser så kontakta din leverantörs tekniska support och be dem installera utökningarna för «GD» eller «Imagick».</i>', # MODIF |
|
| 244 | - 'info_informations_personnelles' => 'Personlig information', |
|
| 245 | - 'info_inscription_automatique' => 'Automatisk registreing av nya redaktörer', |
|
| 246 | - 'info_jeu_caractere' => 'Sajtens teckenuppsättning', |
|
| 247 | - 'info_jours' => 'dagar', |
|
| 248 | - 'info_laisser_champs_vides' => 'Lämna dessa fält tomma)', |
|
| 249 | - 'info_langues' => 'Sajtens språk', |
|
| 250 | - 'info_lien_hypertexte' => 'Hyperlänk:', |
|
| 251 | - 'info_liste_redacteurs_connectes' => 'Inlogggade redaktörer', |
|
| 252 | - 'info_login_existant' => 'Användarnamnet finns redan.', |
|
| 253 | - 'info_login_trop_court' => 'Användarnamnet är för kort.', |
|
| 254 | - 'info_logos' => 'Logotyperna', |
|
| 255 | - 'info_maximum' => 'maximum:', |
|
| 256 | - 'info_meme_rubrique' => 'I samma avdelning', |
|
| 257 | - 'info_message_en_redaction' => 'utkorg', |
|
| 258 | - 'info_message_technique' => 'Tekniskt meddelande:', |
|
| 259 | - 'info_messagerie_interne' => 'Internmeddelande', |
|
| 260 | - 'info_mise_a_niveau_base' => 'SQL database upgradering', |
|
| 261 | - 'info_mise_a_niveau_base_2' => '{{Warning!}} Du har installerat {äldre} |
|
| 240 | + 'info_hier' => 'I går:', |
|
| 241 | + 'info_identification_publique' => 'Din publika identitet...', |
|
| 242 | + 'info_image_process' => 'Välj den bästa metoden för att skapa miniatyrer genom att klicka på motsvarande bild.', |
|
| 243 | + 'info_image_process2' => '<b>OBS!.</b> <i>Om du inte kan se någon bild, så är din server inte konfigurerad för att använda sådana verktyg. Om du vill använda dessa finesser så kontakta din leverantörs tekniska support och be dem installera utökningarna för «GD» eller «Imagick».</i>', # MODIF |
|
| 244 | + 'info_informations_personnelles' => 'Personlig information', |
|
| 245 | + 'info_inscription_automatique' => 'Automatisk registreing av nya redaktörer', |
|
| 246 | + 'info_jeu_caractere' => 'Sajtens teckenuppsättning', |
|
| 247 | + 'info_jours' => 'dagar', |
|
| 248 | + 'info_laisser_champs_vides' => 'Lämna dessa fält tomma)', |
|
| 249 | + 'info_langues' => 'Sajtens språk', |
|
| 250 | + 'info_lien_hypertexte' => 'Hyperlänk:', |
|
| 251 | + 'info_liste_redacteurs_connectes' => 'Inlogggade redaktörer', |
|
| 252 | + 'info_login_existant' => 'Användarnamnet finns redan.', |
|
| 253 | + 'info_login_trop_court' => 'Användarnamnet är för kort.', |
|
| 254 | + 'info_logos' => 'Logotyperna', |
|
| 255 | + 'info_maximum' => 'maximum:', |
|
| 256 | + 'info_meme_rubrique' => 'I samma avdelning', |
|
| 257 | + 'info_message_en_redaction' => 'utkorg', |
|
| 258 | + 'info_message_technique' => 'Tekniskt meddelande:', |
|
| 259 | + 'info_messagerie_interne' => 'Internmeddelande', |
|
| 260 | + 'info_mise_a_niveau_base' => 'SQL database upgradering', |
|
| 261 | + 'info_mise_a_niveau_base_2' => '{{Warning!}} Du har installerat {äldre} |
|
| 262 | 262 | SPIP filer än de som redan |
| 263 | 263 | varit installerade på sajten: Du riskerar att förlora databasen |
| 264 | 264 | och ha en sajt som inte längre fungerar.<br />{{återinstallera |
| 265 | 265 | SPIP filerna.}}', |
| 266 | - 'info_modifier_auteur' => 'Editera detaljer för redaktören:', |
|
| 267 | - 'info_modifier_rubrique' => 'Editera avdelningen:', |
|
| 268 | - 'info_modifier_titre' => 'Editera: @titre@', |
|
| 269 | - 'info_mon_site_spip' => 'Min SPIP-sajt', |
|
| 270 | - 'info_moyenne' => 'genomsnitt:', |
|
| 271 | - 'info_multi_cet_article' => 'Den här artikelns språk:', |
|
| 272 | - 'info_multi_langues_choisies' => 'Var vänlig, välj tillgängliga språk för redaktörerna bland språken nedan. |
|
| 266 | + 'info_modifier_auteur' => 'Editera detaljer för redaktören:', |
|
| 267 | + 'info_modifier_rubrique' => 'Editera avdelningen:', |
|
| 268 | + 'info_modifier_titre' => 'Editera: @titre@', |
|
| 269 | + 'info_mon_site_spip' => 'Min SPIP-sajt', |
|
| 270 | + 'info_moyenne' => 'genomsnitt:', |
|
| 271 | + 'info_multi_cet_article' => 'Den här artikelns språk:', |
|
| 272 | + 'info_multi_langues_choisies' => 'Var vänlig, välj tillgängliga språk för redaktörerna bland språken nedan. |
|
| 273 | 273 | Språk som redan används på din sajt (högst upp på listan) kan inte avaktiveras.', |
| 274 | - 'info_multi_secteurs' => '... bara för avdelningarna i roten?', |
|
| 275 | - 'info_nom' => 'Namn', |
|
| 276 | - 'info_nom_destinataire' => 'Mottagarens namn', |
|
| 277 | - 'info_nom_site' => 'Din sajts namn', |
|
| 278 | - 'info_nombre_articles' => '@nb_articles@ artiklar,', |
|
| 279 | - 'info_nombre_rubriques' => '@nb_rubriques@ avdelningar,', |
|
| 280 | - 'info_nombre_sites' => '@nb_sites@ sajter,', |
|
| 281 | - 'info_non_deplacer' => 'Flytta inte...', |
|
| 282 | - 'info_non_envoi_liste_nouveautes' => 'Skicka inte listan med senaste nyheterna', |
|
| 283 | - 'info_non_modifiable' => 'kan inte förändras', |
|
| 284 | - 'info_non_suppression_mot_cle' => 'Jag vill inte radera nyckelordet.', |
|
| 285 | - 'info_notes' => 'Fotnoter', |
|
| 286 | - 'info_nouvel_article' => 'Ny artikel', |
|
| 287 | - 'info_nouvelle_traduction' => 'Ny översättning:', |
|
| 288 | - 'info_numero_article' => 'ARTIKEL NUMMER:', |
|
| 289 | - 'info_obligatoire_02' => '[Krävs]', # MODIF |
|
| 290 | - 'info_option_accepter_visiteurs' => 'Tillåt besökare registrera sig på den publika delen', |
|
| 291 | - 'info_option_ne_pas_accepter_visiteurs' => 'Avvisa besökarregistrering', |
|
| 292 | - 'info_options_avancees' => 'AVANCERADE INSTÄLLNINGAR', |
|
| 293 | - 'info_ou' => 'eller...', |
|
| 294 | - 'info_page_interdite' => 'Förbjuden sida', |
|
| 295 | - 'info_par_nom' => 'efter namn', |
|
| 296 | - 'info_par_nombre_article' => 'efter antal artiklar', |
|
| 297 | - 'info_par_statut' => 'efter status', |
|
| 298 | - 'info_par_tri' => '’(efter @tri@)’', |
|
| 299 | - 'info_passe_trop_court' => 'lösenordet är för kort.', |
|
| 300 | - 'info_passes_identiques' => 'De två lösenorden är inte identiska.', |
|
| 301 | - 'info_plus_cinq_car' => 'mer än 5 tecken', |
|
| 302 | - 'info_plus_cinq_car_2' => '(Mer än 5 tecken)', |
|
| 303 | - 'info_plus_trois_car' => '(Mer än 3 tecken)', |
|
| 304 | - 'info_popularite' => 'popularitet: @popularite@; besök: @visites@', |
|
| 305 | - 'info_post_scriptum' => 'Postscript', |
|
| 306 | - 'info_post_scriptum_2' => 'PS:', |
|
| 307 | - 'info_pour' => 'för', |
|
| 308 | - 'info_procedez_par_etape' => 'Var vänlig, fortsätt steg för steg', |
|
| 309 | - 'info_procedure_maj_version' => 'Uppdateringsproceduren skall köras för att |
|
| 274 | + 'info_multi_secteurs' => '... bara för avdelningarna i roten?', |
|
| 275 | + 'info_nom' => 'Namn', |
|
| 276 | + 'info_nom_destinataire' => 'Mottagarens namn', |
|
| 277 | + 'info_nom_site' => 'Din sajts namn', |
|
| 278 | + 'info_nombre_articles' => '@nb_articles@ artiklar,', |
|
| 279 | + 'info_nombre_rubriques' => '@nb_rubriques@ avdelningar,', |
|
| 280 | + 'info_nombre_sites' => '@nb_sites@ sajter,', |
|
| 281 | + 'info_non_deplacer' => 'Flytta inte...', |
|
| 282 | + 'info_non_envoi_liste_nouveautes' => 'Skicka inte listan med senaste nyheterna', |
|
| 283 | + 'info_non_modifiable' => 'kan inte förändras', |
|
| 284 | + 'info_non_suppression_mot_cle' => 'Jag vill inte radera nyckelordet.', |
|
| 285 | + 'info_notes' => 'Fotnoter', |
|
| 286 | + 'info_nouvel_article' => 'Ny artikel', |
|
| 287 | + 'info_nouvelle_traduction' => 'Ny översättning:', |
|
| 288 | + 'info_numero_article' => 'ARTIKEL NUMMER:', |
|
| 289 | + 'info_obligatoire_02' => '[Krävs]', # MODIF |
|
| 290 | + 'info_option_accepter_visiteurs' => 'Tillåt besökare registrera sig på den publika delen', |
|
| 291 | + 'info_option_ne_pas_accepter_visiteurs' => 'Avvisa besökarregistrering', |
|
| 292 | + 'info_options_avancees' => 'AVANCERADE INSTÄLLNINGAR', |
|
| 293 | + 'info_ou' => 'eller...', |
|
| 294 | + 'info_page_interdite' => 'Förbjuden sida', |
|
| 295 | + 'info_par_nom' => 'efter namn', |
|
| 296 | + 'info_par_nombre_article' => 'efter antal artiklar', |
|
| 297 | + 'info_par_statut' => 'efter status', |
|
| 298 | + 'info_par_tri' => '’(efter @tri@)’', |
|
| 299 | + 'info_passe_trop_court' => 'lösenordet är för kort.', |
|
| 300 | + 'info_passes_identiques' => 'De två lösenorden är inte identiska.', |
|
| 301 | + 'info_plus_cinq_car' => 'mer än 5 tecken', |
|
| 302 | + 'info_plus_cinq_car_2' => '(Mer än 5 tecken)', |
|
| 303 | + 'info_plus_trois_car' => '(Mer än 3 tecken)', |
|
| 304 | + 'info_popularite' => 'popularitet: @popularite@; besök: @visites@', |
|
| 305 | + 'info_post_scriptum' => 'Postscript', |
|
| 306 | + 'info_post_scriptum_2' => 'PS:', |
|
| 307 | + 'info_pour' => 'för', |
|
| 308 | + 'info_procedez_par_etape' => 'Var vänlig, fortsätt steg för steg', |
|
| 309 | + 'info_procedure_maj_version' => 'Uppdateringsproceduren skall köras för att |
|
| 310 | 310 | anpassa databasen till den nya versionen av SPIP.', |
| 311 | - 'info_proxy_ok' => 'Testen av proxy lyckades.', |
|
| 312 | - 'info_ps' => 'P.S.', |
|
| 313 | - 'info_publier' => 'publicera', |
|
| 314 | - 'info_publies' => 'Dina onlinepublicerade artiklar', |
|
| 315 | - 'info_question_accepter_visiteurs' => 'Om sajtens template tillåter besökare att registrera sig utan att gå in i den privata delen, var vänlig och aktivera följande option:', |
|
| 316 | - 'info_racine_site' => 'Sajtens bas', |
|
| 317 | - 'info_recharger_page' => 'Var vänlig och uppdatera sidan om en liten stund.', |
|
| 318 | - 'info_recherche_auteur_zero' => 'Inga resultat hittades för "@cherche_auteur@".', |
|
| 319 | - 'info_recommencer' => 'Var vänlig och försök igen.', |
|
| 320 | - 'info_redacteur_1' => 'Redaktör', |
|
| 321 | - 'info_redacteur_2' => 'för tillgång till den privata delen (<i>rekommenderas</i>)', |
|
| 322 | - 'info_redacteurs' => 'Redaktörer', |
|
| 323 | - 'info_redaction_en_cours' => 'UNDER ARBETE', |
|
| 324 | - 'info_redirection' => 'Ompekning', |
|
| 325 | - 'info_refuses' => 'Refuserade artiklar', |
|
| 326 | - 'info_reglage_ldap' => 'inställningar: <b>anpassar LDAP import</b>', |
|
| 327 | - 'info_renvoi_article' => '<b>Ompekning.</b> Den här artikeln pekar om till:', |
|
| 328 | - 'info_reserve_admin' => 'Enbart administratörer kan förändra adressen.', |
|
| 329 | - 'info_restreindre_rubrique' => 'Begränsa administrationen till avdelningen:', |
|
| 330 | - 'info_resultat_recherche' => 'Sökresultat:', |
|
| 331 | - 'info_rubriques' => 'Avdelningar', |
|
| 332 | - 'info_rubriques_02' => 'avdelningar', |
|
| 333 | - 'info_rubriques_trouvees' => 'Hittade avdelningar', |
|
| 334 | - 'info_sans_titre' => 'Utan titel', |
|
| 335 | - 'info_selection_chemin_acces' => '<b>Välj</b> åtkomstväg i katalogen:', |
|
| 336 | - 'info_signatures' => 'underskrifter', |
|
| 337 | - 'info_site' => 'Sajt', |
|
| 338 | - 'info_site_2' => 'sajt:', |
|
| 339 | - 'info_site_min' => 'sajt', |
|
| 340 | - 'info_site_reference_2' => 'Länkad sajt', |
|
| 341 | - 'info_site_web' => 'WEBBSAJT:', # MODIF |
|
| 342 | - 'info_sites' => 'sajter', |
|
| 343 | - 'info_sites_lies_mot' => 'Länkade sajter knutna till detta nyckelord', |
|
| 344 | - 'info_sites_proxy' => 'Använder en proxy', |
|
| 345 | - 'info_sites_trouves' => 'Hittade sajter', |
|
| 346 | - 'info_sous_titre' => 'Undertitel:', |
|
| 347 | - 'info_statut_administrateur' => 'Administratör', |
|
| 348 | - 'info_statut_auteur' => 'Redaktörens status:', # MODIF |
|
| 349 | - 'info_statut_auteur_a_confirmer' => 'Registreringar som skall godkännas', |
|
| 350 | - 'info_statut_auteur_autre' => 'Annan status:', |
|
| 351 | - 'info_statut_redacteur' => 'Redaktör', |
|
| 352 | - 'info_statut_utilisateurs_1' => 'Startinställningar för importerade användare', |
|
| 353 | - 'info_suivi_activite' => 'Följ upp aktiviteten på sajten', |
|
| 354 | - 'info_surtitre' => 'Övertitel:', |
|
| 355 | - 'info_syndication_integrale_1' => 'Din sajt publiceras RSS-filer för syndikering (Se <a href="@url@">@titre@</a>).', |
|
| 356 | - 'info_syndication_integrale_2' => 'Vill du skicka hela artiklar eller bara en sammanfattning på ett par hundra tecken?', |
|
| 357 | - 'info_table_prefix' => 'Det är möjligt att byta prefix i databastabellernas namn. (Du behöver göra det om di installerar flera sajter i samma databas). Prefixet måste skrivas utan accenter, med versaler utan mellanslag.', |
|
| 358 | - 'info_taille_maximale_vignette' => 'Maximal storlek på miniatyrer som skapats av systemet:', |
|
| 359 | - 'info_terminer_installation' => 'Du kan nu avsluta installationsprocessen.', |
|
| 360 | - 'info_texte' => 'Text', |
|
| 361 | - 'info_texte_explicatif' => 'Förklarande text', |
|
| 362 | - 'info_texte_long' => '(Texten är lång: Den kommer att synas i flera delar som sedan sammanfogas efter validering.)', |
|
| 363 | - 'info_texte_message' => 'Texten i ditt meddelande:', # MODIF |
|
| 364 | - 'info_texte_message_02' => 'Texten i ditt meddelande', |
|
| 365 | - 'info_titre' => 'Titel:', |
|
| 366 | - 'info_total' => 'total:', |
|
| 367 | - 'info_tous_articles_en_redaction' => 'Alla artiklar under arbete', |
|
| 368 | - 'info_tous_articles_presents' => 'Alla artiklar som publicerats i den här avdelningen', |
|
| 369 | - 'info_tous_les' => 'alla:', |
|
| 370 | - 'info_tout_site' => 'Hela sajten', |
|
| 371 | - 'info_tout_site2' => 'Artikeln har inte blivit översatt till det här språket.', |
|
| 372 | - 'info_tout_site3' => 'Artikeln har blivit översatt till det hör språket men vissa förändringar har gjorts senare i orginalartikeln. Översättningen behöver uppdateras.', |
|
| 373 | - 'info_tout_site4' => 'Artikeln har blivit översatt till det här språket och översättningen är aktuell.', |
|
| 374 | - 'info_tout_site5' => 'Orginalartikeln.', |
|
| 375 | - 'info_tout_site6' => '<b>OBS:</b> bara orginalartiklarna visas. |
|
| 311 | + 'info_proxy_ok' => 'Testen av proxy lyckades.', |
|
| 312 | + 'info_ps' => 'P.S.', |
|
| 313 | + 'info_publier' => 'publicera', |
|
| 314 | + 'info_publies' => 'Dina onlinepublicerade artiklar', |
|
| 315 | + 'info_question_accepter_visiteurs' => 'Om sajtens template tillåter besökare att registrera sig utan att gå in i den privata delen, var vänlig och aktivera följande option:', |
|
| 316 | + 'info_racine_site' => 'Sajtens bas', |
|
| 317 | + 'info_recharger_page' => 'Var vänlig och uppdatera sidan om en liten stund.', |
|
| 318 | + 'info_recherche_auteur_zero' => 'Inga resultat hittades för "@cherche_auteur@".', |
|
| 319 | + 'info_recommencer' => 'Var vänlig och försök igen.', |
|
| 320 | + 'info_redacteur_1' => 'Redaktör', |
|
| 321 | + 'info_redacteur_2' => 'för tillgång till den privata delen (<i>rekommenderas</i>)', |
|
| 322 | + 'info_redacteurs' => 'Redaktörer', |
|
| 323 | + 'info_redaction_en_cours' => 'UNDER ARBETE', |
|
| 324 | + 'info_redirection' => 'Ompekning', |
|
| 325 | + 'info_refuses' => 'Refuserade artiklar', |
|
| 326 | + 'info_reglage_ldap' => 'inställningar: <b>anpassar LDAP import</b>', |
|
| 327 | + 'info_renvoi_article' => '<b>Ompekning.</b> Den här artikeln pekar om till:', |
|
| 328 | + 'info_reserve_admin' => 'Enbart administratörer kan förändra adressen.', |
|
| 329 | + 'info_restreindre_rubrique' => 'Begränsa administrationen till avdelningen:', |
|
| 330 | + 'info_resultat_recherche' => 'Sökresultat:', |
|
| 331 | + 'info_rubriques' => 'Avdelningar', |
|
| 332 | + 'info_rubriques_02' => 'avdelningar', |
|
| 333 | + 'info_rubriques_trouvees' => 'Hittade avdelningar', |
|
| 334 | + 'info_sans_titre' => 'Utan titel', |
|
| 335 | + 'info_selection_chemin_acces' => '<b>Välj</b> åtkomstväg i katalogen:', |
|
| 336 | + 'info_signatures' => 'underskrifter', |
|
| 337 | + 'info_site' => 'Sajt', |
|
| 338 | + 'info_site_2' => 'sajt:', |
|
| 339 | + 'info_site_min' => 'sajt', |
|
| 340 | + 'info_site_reference_2' => 'Länkad sajt', |
|
| 341 | + 'info_site_web' => 'WEBBSAJT:', # MODIF |
|
| 342 | + 'info_sites' => 'sajter', |
|
| 343 | + 'info_sites_lies_mot' => 'Länkade sajter knutna till detta nyckelord', |
|
| 344 | + 'info_sites_proxy' => 'Använder en proxy', |
|
| 345 | + 'info_sites_trouves' => 'Hittade sajter', |
|
| 346 | + 'info_sous_titre' => 'Undertitel:', |
|
| 347 | + 'info_statut_administrateur' => 'Administratör', |
|
| 348 | + 'info_statut_auteur' => 'Redaktörens status:', # MODIF |
|
| 349 | + 'info_statut_auteur_a_confirmer' => 'Registreringar som skall godkännas', |
|
| 350 | + 'info_statut_auteur_autre' => 'Annan status:', |
|
| 351 | + 'info_statut_redacteur' => 'Redaktör', |
|
| 352 | + 'info_statut_utilisateurs_1' => 'Startinställningar för importerade användare', |
|
| 353 | + 'info_suivi_activite' => 'Följ upp aktiviteten på sajten', |
|
| 354 | + 'info_surtitre' => 'Övertitel:', |
|
| 355 | + 'info_syndication_integrale_1' => 'Din sajt publiceras RSS-filer för syndikering (Se <a href="@url@">@titre@</a>).', |
|
| 356 | + 'info_syndication_integrale_2' => 'Vill du skicka hela artiklar eller bara en sammanfattning på ett par hundra tecken?', |
|
| 357 | + 'info_table_prefix' => 'Det är möjligt att byta prefix i databastabellernas namn. (Du behöver göra det om di installerar flera sajter i samma databas). Prefixet måste skrivas utan accenter, med versaler utan mellanslag.', |
|
| 358 | + 'info_taille_maximale_vignette' => 'Maximal storlek på miniatyrer som skapats av systemet:', |
|
| 359 | + 'info_terminer_installation' => 'Du kan nu avsluta installationsprocessen.', |
|
| 360 | + 'info_texte' => 'Text', |
|
| 361 | + 'info_texte_explicatif' => 'Förklarande text', |
|
| 362 | + 'info_texte_long' => '(Texten är lång: Den kommer att synas i flera delar som sedan sammanfogas efter validering.)', |
|
| 363 | + 'info_texte_message' => 'Texten i ditt meddelande:', # MODIF |
|
| 364 | + 'info_texte_message_02' => 'Texten i ditt meddelande', |
|
| 365 | + 'info_titre' => 'Titel:', |
|
| 366 | + 'info_total' => 'total:', |
|
| 367 | + 'info_tous_articles_en_redaction' => 'Alla artiklar under arbete', |
|
| 368 | + 'info_tous_articles_presents' => 'Alla artiklar som publicerats i den här avdelningen', |
|
| 369 | + 'info_tous_les' => 'alla:', |
|
| 370 | + 'info_tout_site' => 'Hela sajten', |
|
| 371 | + 'info_tout_site2' => 'Artikeln har inte blivit översatt till det här språket.', |
|
| 372 | + 'info_tout_site3' => 'Artikeln har blivit översatt till det hör språket men vissa förändringar har gjorts senare i orginalartikeln. Översättningen behöver uppdateras.', |
|
| 373 | + 'info_tout_site4' => 'Artikeln har blivit översatt till det här språket och översättningen är aktuell.', |
|
| 374 | + 'info_tout_site5' => 'Orginalartikeln.', |
|
| 375 | + 'info_tout_site6' => '<b>OBS:</b> bara orginalartiklarna visas. |
|
| 376 | 376 | Översättningarna är länkade till orginalet |
| 377 | 377 | med en färg som visar deras status:', |
| 378 | - 'info_travail_colaboratif' => 'Gemensamt arbete på artiklar', |
|
| 379 | - 'info_un_article' => 'en artikel,', |
|
| 380 | - 'info_un_site' => 'En sajt,', |
|
| 381 | - 'info_une_rubrique' => 'en avdelning,', |
|
| 382 | - 'info_une_rubrique_02' => '1 avdelning', |
|
| 383 | - 'info_url' => 'URL:', |
|
| 384 | - 'info_urlref' => 'Hyperlänk:', |
|
| 385 | - 'info_utilisation_spip' => 'SPIP är nu färdig att användas..', |
|
| 386 | - 'info_visites_par_mois' => 'Besökare per månad:', |
|
| 387 | - 'info_visiteur_1' => 'Besökare', |
|
| 388 | - 'info_visiteur_2' => 'på den publika delen', |
|
| 389 | - 'info_visiteurs' => 'Besökare', |
|
| 390 | - 'info_visiteurs_02' => 'Beökare på den publika delen', |
|
| 391 | - 'install_adresse_base_hebergeur' => 'Databasadress tillhandahållen av webbhotellet', |
|
| 392 | - 'install_echec_annonce' => 'Den här installationen kommer förmodligen inte att fungera, alternativt resulterar den i en sajt med reducerad funktionalitet ...', |
|
| 393 | - 'install_extension_mbstring' => 'SPIP fungerar inte med:', |
|
| 394 | - 'install_extension_php_obligatoire' => 'SPIP kräver ett tillägg till php:', |
|
| 395 | - 'install_login_base_hebergeur' => 'Login tilldelat av leverantören', |
|
| 396 | - 'install_nom_base_hebergeur' => 'Databasnamn tilldelat av leverantören:', |
|
| 397 | - 'install_pas_table' => 'Databasen har inga tabeller', |
|
| 398 | - 'install_pass_base_hebergeur' => 'Lösenord till databasen tilldelat av leverantören', |
|
| 399 | - 'install_php_version' => 'Versionen av PHP, @version@ är för gammal (minimum = @minimum@)', |
|
| 400 | - 'install_select_langue' => 'Välj ett språk, klicka sedan på knappen "fortsätt" för att starta installationen.', |
|
| 401 | - 'install_select_type_db' => 'Välj typ av databas :', |
|
| 402 | - 'install_select_type_mysql' => 'MySQL', |
|
| 403 | - 'install_select_type_sqlite2' => 'SQLite 2', |
|
| 404 | - 'install_select_type_sqlite3' => 'SQLite 3', |
|
| 405 | - 'install_tables_base' => 'Databasens tabeller', |
|
| 406 | - 'intem_redacteur' => 'redaktör', |
|
| 407 | - 'intitule_licence' => 'Licens', |
|
| 408 | - 'item_accepter_inscriptions' => 'Tillåt registreringar', |
|
| 409 | - 'item_activer_messages_avertissement' => 'Aktivera varningsmeddelanden', |
|
| 410 | - 'item_administrateur_2' => 'administratör', |
|
| 411 | - 'item_afficher_calendrier' => 'Visa i kalendern', |
|
| 412 | - 'item_autoriser_syndication_integrale' => 'Inkludera hela artiklar i syndikeringsfilerna', |
|
| 413 | - 'item_choix_administrateurs' => 'administratörer', |
|
| 414 | - 'item_choix_generation_miniature' => 'Generera miniatyrer automatiskt.', |
|
| 415 | - 'item_choix_non_generation_miniature' => 'Generera inte miniatyrer.', |
|
| 416 | - 'item_choix_redacteurs' => 'redaktörer', |
|
| 417 | - 'item_choix_visiteurs' => 'besökare till den publika delen', |
|
| 418 | - 'item_creer_fichiers_authent' => 'Skapa .htpasswd filer', |
|
| 419 | - 'item_login' => 'Login', |
|
| 420 | - 'item_messagerie_agenda' => 'Aktivera meddelandesystemet och kalendern', |
|
| 421 | - 'item_mots_cles_association_articles' => 'artiklar', |
|
| 422 | - 'item_mots_cles_association_rubriques' => 'avdelningar', |
|
| 423 | - 'item_mots_cles_association_sites' => 'länkade eller syndikerade sajter.', |
|
| 424 | - 'item_non' => 'Nej', |
|
| 425 | - 'item_non_accepter_inscriptions' => 'Tillåt inte registreringar', |
|
| 426 | - 'item_non_activer_messages_avertissement' => 'Inga varningsmeddelanden', |
|
| 427 | - 'item_non_afficher_calendrier' => 'Visa inte i kalendern', |
|
| 428 | - 'item_non_autoriser_syndication_integrale' => 'Skicka bara en sammanfattning', |
|
| 429 | - 'item_non_creer_fichiers_authent' => 'Skapa inte dessa filer', |
|
| 430 | - 'item_non_messagerie_agenda' => 'Avaktivera meddelandesystemet och kalendern', |
|
| 431 | - 'item_non_publier_articles' => 'Publicera inte artiklar innan deras publiceringsdatum.', |
|
| 432 | - 'item_nouvel_auteur' => 'Ny redaktör', |
|
| 433 | - 'item_nouvelle_rubrique' => 'Ny avdelning', |
|
| 434 | - 'item_oui' => 'Ja', |
|
| 435 | - 'item_publier_articles' => 'Publicera artiklarna utan att ta hänsyn till publiceringsdatum.', |
|
| 436 | - 'item_reponse_article' => 'Svara på artikeln', |
|
| 437 | - 'item_visiteur' => 'besökare', |
|
| 378 | + 'info_travail_colaboratif' => 'Gemensamt arbete på artiklar', |
|
| 379 | + 'info_un_article' => 'en artikel,', |
|
| 380 | + 'info_un_site' => 'En sajt,', |
|
| 381 | + 'info_une_rubrique' => 'en avdelning,', |
|
| 382 | + 'info_une_rubrique_02' => '1 avdelning', |
|
| 383 | + 'info_url' => 'URL:', |
|
| 384 | + 'info_urlref' => 'Hyperlänk:', |
|
| 385 | + 'info_utilisation_spip' => 'SPIP är nu färdig att användas..', |
|
| 386 | + 'info_visites_par_mois' => 'Besökare per månad:', |
|
| 387 | + 'info_visiteur_1' => 'Besökare', |
|
| 388 | + 'info_visiteur_2' => 'på den publika delen', |
|
| 389 | + 'info_visiteurs' => 'Besökare', |
|
| 390 | + 'info_visiteurs_02' => 'Beökare på den publika delen', |
|
| 391 | + 'install_adresse_base_hebergeur' => 'Databasadress tillhandahållen av webbhotellet', |
|
| 392 | + 'install_echec_annonce' => 'Den här installationen kommer förmodligen inte att fungera, alternativt resulterar den i en sajt med reducerad funktionalitet ...', |
|
| 393 | + 'install_extension_mbstring' => 'SPIP fungerar inte med:', |
|
| 394 | + 'install_extension_php_obligatoire' => 'SPIP kräver ett tillägg till php:', |
|
| 395 | + 'install_login_base_hebergeur' => 'Login tilldelat av leverantören', |
|
| 396 | + 'install_nom_base_hebergeur' => 'Databasnamn tilldelat av leverantören:', |
|
| 397 | + 'install_pas_table' => 'Databasen har inga tabeller', |
|
| 398 | + 'install_pass_base_hebergeur' => 'Lösenord till databasen tilldelat av leverantören', |
|
| 399 | + 'install_php_version' => 'Versionen av PHP, @version@ är för gammal (minimum = @minimum@)', |
|
| 400 | + 'install_select_langue' => 'Välj ett språk, klicka sedan på knappen "fortsätt" för att starta installationen.', |
|
| 401 | + 'install_select_type_db' => 'Välj typ av databas :', |
|
| 402 | + 'install_select_type_mysql' => 'MySQL', |
|
| 403 | + 'install_select_type_sqlite2' => 'SQLite 2', |
|
| 404 | + 'install_select_type_sqlite3' => 'SQLite 3', |
|
| 405 | + 'install_tables_base' => 'Databasens tabeller', |
|
| 406 | + 'intem_redacteur' => 'redaktör', |
|
| 407 | + 'intitule_licence' => 'Licens', |
|
| 408 | + 'item_accepter_inscriptions' => 'Tillåt registreringar', |
|
| 409 | + 'item_activer_messages_avertissement' => 'Aktivera varningsmeddelanden', |
|
| 410 | + 'item_administrateur_2' => 'administratör', |
|
| 411 | + 'item_afficher_calendrier' => 'Visa i kalendern', |
|
| 412 | + 'item_autoriser_syndication_integrale' => 'Inkludera hela artiklar i syndikeringsfilerna', |
|
| 413 | + 'item_choix_administrateurs' => 'administratörer', |
|
| 414 | + 'item_choix_generation_miniature' => 'Generera miniatyrer automatiskt.', |
|
| 415 | + 'item_choix_non_generation_miniature' => 'Generera inte miniatyrer.', |
|
| 416 | + 'item_choix_redacteurs' => 'redaktörer', |
|
| 417 | + 'item_choix_visiteurs' => 'besökare till den publika delen', |
|
| 418 | + 'item_creer_fichiers_authent' => 'Skapa .htpasswd filer', |
|
| 419 | + 'item_login' => 'Login', |
|
| 420 | + 'item_messagerie_agenda' => 'Aktivera meddelandesystemet och kalendern', |
|
| 421 | + 'item_mots_cles_association_articles' => 'artiklar', |
|
| 422 | + 'item_mots_cles_association_rubriques' => 'avdelningar', |
|
| 423 | + 'item_mots_cles_association_sites' => 'länkade eller syndikerade sajter.', |
|
| 424 | + 'item_non' => 'Nej', |
|
| 425 | + 'item_non_accepter_inscriptions' => 'Tillåt inte registreringar', |
|
| 426 | + 'item_non_activer_messages_avertissement' => 'Inga varningsmeddelanden', |
|
| 427 | + 'item_non_afficher_calendrier' => 'Visa inte i kalendern', |
|
| 428 | + 'item_non_autoriser_syndication_integrale' => 'Skicka bara en sammanfattning', |
|
| 429 | + 'item_non_creer_fichiers_authent' => 'Skapa inte dessa filer', |
|
| 430 | + 'item_non_messagerie_agenda' => 'Avaktivera meddelandesystemet och kalendern', |
|
| 431 | + 'item_non_publier_articles' => 'Publicera inte artiklar innan deras publiceringsdatum.', |
|
| 432 | + 'item_nouvel_auteur' => 'Ny redaktör', |
|
| 433 | + 'item_nouvelle_rubrique' => 'Ny avdelning', |
|
| 434 | + 'item_oui' => 'Ja', |
|
| 435 | + 'item_publier_articles' => 'Publicera artiklarna utan att ta hänsyn till publiceringsdatum.', |
|
| 436 | + 'item_reponse_article' => 'Svara på artikeln', |
|
| 437 | + 'item_visiteur' => 'besökare', |
|
| 438 | 438 | |
| 439 | - // J |
|
| 440 | - 'jour_non_connu_nc' => 'okänd', |
|
| 439 | + // J |
|
| 440 | + 'jour_non_connu_nc' => 'okänd', |
|
| 441 | 441 | |
| 442 | - // L |
|
| 443 | - 'lien_ajouter_auteur' => 'Lätt till redaktören', |
|
| 444 | - 'lien_email' => 'e-post', |
|
| 445 | - 'lien_nom_site' => 'SAJTENS NAMN:', |
|
| 446 | - 'lien_retirer_auteur' => 'Ta bort redaktören', |
|
| 447 | - 'lien_site' => 'sajt', |
|
| 448 | - 'lien_tout_deplier' => 'Expandera alla', |
|
| 449 | - 'lien_tout_replier' => 'Kollapsa alla', |
|
| 450 | - 'lien_tout_supprimer' => 'Radera alla', |
|
| 451 | - 'lien_trier_nom' => 'Sortera efter namn', |
|
| 452 | - 'lien_trier_nombre_articles' => 'Sortera efter artikelnummer', |
|
| 453 | - 'lien_trier_statut' => 'Sortera efter status', |
|
| 454 | - 'lien_voir_en_ligne' => 'SE ONLINE:', |
|
| 455 | - 'logo_article' => 'ARTIKELNS LOGOTYPE', # MODIF |
|
| 456 | - 'logo_auteur' => 'REDAKTÖRENS LOGOTYPE', # MODIF |
|
| 457 | - 'logo_rubrique' => 'Avdelningens logotype', # MODIF |
|
| 458 | - 'logo_site' => 'SAJTENS LOGOTYPE', # MODIF |
|
| 459 | - 'logo_standard_rubrique' => 'STANDARDLOGOTYPE FÖR AVDELNINGAR', # MODIF |
|
| 460 | - 'logo_survol' => 'LOGOTYPE FÖR MUS-ÖVER', # MODIF |
|
| 442 | + // L |
|
| 443 | + 'lien_ajouter_auteur' => 'Lätt till redaktören', |
|
| 444 | + 'lien_email' => 'e-post', |
|
| 445 | + 'lien_nom_site' => 'SAJTENS NAMN:', |
|
| 446 | + 'lien_retirer_auteur' => 'Ta bort redaktören', |
|
| 447 | + 'lien_site' => 'sajt', |
|
| 448 | + 'lien_tout_deplier' => 'Expandera alla', |
|
| 449 | + 'lien_tout_replier' => 'Kollapsa alla', |
|
| 450 | + 'lien_tout_supprimer' => 'Radera alla', |
|
| 451 | + 'lien_trier_nom' => 'Sortera efter namn', |
|
| 452 | + 'lien_trier_nombre_articles' => 'Sortera efter artikelnummer', |
|
| 453 | + 'lien_trier_statut' => 'Sortera efter status', |
|
| 454 | + 'lien_voir_en_ligne' => 'SE ONLINE:', |
|
| 455 | + 'logo_article' => 'ARTIKELNS LOGOTYPE', # MODIF |
|
| 456 | + 'logo_auteur' => 'REDAKTÖRENS LOGOTYPE', # MODIF |
|
| 457 | + 'logo_rubrique' => 'Avdelningens logotype', # MODIF |
|
| 458 | + 'logo_site' => 'SAJTENS LOGOTYPE', # MODIF |
|
| 459 | + 'logo_standard_rubrique' => 'STANDARDLOGOTYPE FÖR AVDELNINGAR', # MODIF |
|
| 460 | + 'logo_survol' => 'LOGOTYPE FÖR MUS-ÖVER', # MODIF |
|
| 461 | 461 | |
| 462 | - // M |
|
| 463 | - 'menu_aide_installation_choix_base' => 'Välj din databas', |
|
| 464 | - 'module_fichier_langue' => 'Språkfiler', |
|
| 465 | - 'module_raccourci' => 'Genväg', |
|
| 466 | - 'module_texte_affiche' => 'Visad text', |
|
| 467 | - 'module_texte_traduction' => 'Språkfilen « @module@ » finns i:', |
|
| 462 | + // M |
|
| 463 | + 'menu_aide_installation_choix_base' => 'Välj din databas', |
|
| 464 | + 'module_fichier_langue' => 'Språkfiler', |
|
| 465 | + 'module_raccourci' => 'Genväg', |
|
| 466 | + 'module_texte_affiche' => 'Visad text', |
|
| 467 | + 'module_texte_traduction' => 'Språkfilen « @module@ » finns i:', |
|
| 468 | 468 | |
| 469 | - // O |
|
| 470 | - 'onglet_contenu' => 'Innehåll', |
|
| 471 | - 'onglet_declarer_une_autre_base' => 'Ange en annan databas', |
|
| 472 | - 'onglet_discuter' => 'Diskutera', |
|
| 473 | - 'onglet_interactivite' => 'Interaktivitet', |
|
| 474 | - 'onglet_proprietes' => 'Egenskaper', |
|
| 475 | - 'onglet_repartition_actuelle' => 'nu', |
|
| 469 | + // O |
|
| 470 | + 'onglet_contenu' => 'Innehåll', |
|
| 471 | + 'onglet_declarer_une_autre_base' => 'Ange en annan databas', |
|
| 472 | + 'onglet_discuter' => 'Diskutera', |
|
| 473 | + 'onglet_interactivite' => 'Interaktivitet', |
|
| 474 | + 'onglet_proprietes' => 'Egenskaper', |
|
| 475 | + 'onglet_repartition_actuelle' => 'nu', |
|
| 476 | 476 | |
| 477 | - // P |
|
| 478 | - 'plugin_etat_developpement' => 'Under utveckling', |
|
| 479 | - 'plugin_etat_experimental' => 'exprimentell', |
|
| 480 | - 'plugin_etat_stable' => 'Stabil', |
|
| 481 | - 'plugin_etat_test' => 'under test', |
|
| 482 | - 'plugin_impossible_activer' => 'Omöjligt att aktivera pluginen @plugin@', |
|
| 483 | - 'plugin_necessite_plugin' => 'Version @version@ eller nyare av pluginen @plugin@ krävs.', # MODIF |
|
| 484 | - 'plugin_zip_active' => 'Fortsätt för att aktivera', |
|
| 485 | - 'plugin_zip_installe_finie' => 'Filen @zip@ har packats upp och installerats.', |
|
| 486 | - 'plugin_zip_installe_rep_finie' => 'Filen @zip@ har packats upp och installerats i katalogen @rep@', |
|
| 487 | - 'plugin_zip_installer' => 'Du kan installera nu.', |
|
| 488 | - 'plugins_actifs' => '@count@ aktiva plugins.', |
|
| 489 | - 'plugins_compte' => '@count@ plugins', |
|
| 490 | - 'plugins_disponibles' => '@count@ tillgängliga plugins.', |
|
| 491 | - 'plugins_erreur' => 'Fel i följande plugin: @plugins@', |
|
| 492 | - 'plugins_liste' => 'Lista över plugins', |
|
| 477 | + // P |
|
| 478 | + 'plugin_etat_developpement' => 'Under utveckling', |
|
| 479 | + 'plugin_etat_experimental' => 'exprimentell', |
|
| 480 | + 'plugin_etat_stable' => 'Stabil', |
|
| 481 | + 'plugin_etat_test' => 'under test', |
|
| 482 | + 'plugin_impossible_activer' => 'Omöjligt att aktivera pluginen @plugin@', |
|
| 483 | + 'plugin_necessite_plugin' => 'Version @version@ eller nyare av pluginen @plugin@ krävs.', # MODIF |
|
| 484 | + 'plugin_zip_active' => 'Fortsätt för att aktivera', |
|
| 485 | + 'plugin_zip_installe_finie' => 'Filen @zip@ har packats upp och installerats.', |
|
| 486 | + 'plugin_zip_installe_rep_finie' => 'Filen @zip@ har packats upp och installerats i katalogen @rep@', |
|
| 487 | + 'plugin_zip_installer' => 'Du kan installera nu.', |
|
| 488 | + 'plugins_actifs' => '@count@ aktiva plugins.', |
|
| 489 | + 'plugins_compte' => '@count@ plugins', |
|
| 490 | + 'plugins_disponibles' => '@count@ tillgängliga plugins.', |
|
| 491 | + 'plugins_erreur' => 'Fel i följande plugin: @plugins@', |
|
| 492 | + 'plugins_liste' => 'Lista över plugins', |
|
| 493 | 493 | |
| 494 | - // R |
|
| 495 | - 'required' => '[Krävs]', # MODIF |
|
| 494 | + // R |
|
| 495 | + 'required' => '[Krävs]', # MODIF |
|
| 496 | 496 | |
| 497 | - // T |
|
| 498 | - 'taille_cache_vide' => 'Cachen är tom.', |
|
| 499 | - 'text_article_propose_publication' => 'Artikel inlämnad för publicering. tveka inte att säga din mening i forumet längst ned på sidan.', # MODIF |
|
| 500 | - 'texte_admin_effacer_01' => 'Detta kommando raderar <i>all</i> information i databasen, |
|
| 497 | + // T |
|
| 498 | + 'taille_cache_vide' => 'Cachen är tom.', |
|
| 499 | + 'text_article_propose_publication' => 'Artikel inlämnad för publicering. tveka inte att säga din mening i forumet längst ned på sidan.', # MODIF |
|
| 500 | + 'texte_admin_effacer_01' => 'Detta kommando raderar <i>all</i> information i databasen, |
|
| 501 | 501 | inklusive <i>alla</i> uppgifter om användare. Efter att du använt det, måste du |
| 502 | 502 | installera om SPIP för att skapa en ny databas och den första administratören.', |
| 503 | - 'texte_adresse_annuaire_1' => '( Om din katalog är installerad på samma dator som din websajt, är det troligen «localhost».)', |
|
| 504 | - 'texte_ajout_auteur' => 'Följande redaktör lades till artikeln:', |
|
| 505 | - 'texte_annuaire_ldap_1' => 'Om du har tillgång till en LDAP-katalog kan du använda den för att importera användare till SPIP.', |
|
| 506 | - 'texte_article_statut' => 'Artikelns status:', |
|
| 507 | - 'texte_article_virtuel' => 'Virtuell artikel', |
|
| 508 | - 'texte_article_virtuel_reference' => '<b>Virtuell Artikel:</b> länkad artikel i din SPIP site, men ompekad till en annan URL. För att ta bort ompekningen, radera denna URL.', |
|
| 509 | - 'texte_aucun_resultat_auteur' => 'Inga resultat för "@cherche_auteur@".', |
|
| 510 | - 'texte_auteurs' => 'REDAKTÖRERNA', |
|
| 511 | - 'texte_choix_base_1' => 'Välj din databas:', |
|
| 512 | - 'texte_choix_base_2' => 'Databasservern innehåller flera databaser.', |
|
| 513 | - 'texte_choix_base_3' => '<b>Välj</b> den som din leverantör har gett dig:', |
|
| 514 | - 'texte_choix_table_prefix' => 'Prefix för tabeller:', |
|
| 515 | - 'texte_compte_element' => '@count@ objekt', |
|
| 516 | - 'texte_compte_elements' => '@count@ element', |
|
| 517 | - 'texte_jeu_caractere_3' => 'Din sajt använder följande teckenuppsättning:', |
|
| 518 | - 'texte_mise_a_niveau_base_1' => 'Du har just uppdaterat filerna i SPIP. |
|
| 503 | + 'texte_adresse_annuaire_1' => '( Om din katalog är installerad på samma dator som din websajt, är det troligen «localhost».)', |
|
| 504 | + 'texte_ajout_auteur' => 'Följande redaktör lades till artikeln:', |
|
| 505 | + 'texte_annuaire_ldap_1' => 'Om du har tillgång till en LDAP-katalog kan du använda den för att importera användare till SPIP.', |
|
| 506 | + 'texte_article_statut' => 'Artikelns status:', |
|
| 507 | + 'texte_article_virtuel' => 'Virtuell artikel', |
|
| 508 | + 'texte_article_virtuel_reference' => '<b>Virtuell Artikel:</b> länkad artikel i din SPIP site, men ompekad till en annan URL. För att ta bort ompekningen, radera denna URL.', |
|
| 509 | + 'texte_aucun_resultat_auteur' => 'Inga resultat för "@cherche_auteur@".', |
|
| 510 | + 'texte_auteurs' => 'REDAKTÖRERNA', |
|
| 511 | + 'texte_choix_base_1' => 'Välj din databas:', |
|
| 512 | + 'texte_choix_base_2' => 'Databasservern innehåller flera databaser.', |
|
| 513 | + 'texte_choix_base_3' => '<b>Välj</b> den som din leverantör har gett dig:', |
|
| 514 | + 'texte_choix_table_prefix' => 'Prefix för tabeller:', |
|
| 515 | + 'texte_compte_element' => '@count@ objekt', |
|
| 516 | + 'texte_compte_elements' => '@count@ element', |
|
| 517 | + 'texte_jeu_caractere_3' => 'Din sajt använder följande teckenuppsättning:', |
|
| 518 | + 'texte_mise_a_niveau_base_1' => 'Du har just uppdaterat filerna i SPIP. |
|
| 519 | 519 | Nu måste du uppgradera sajtens databas.', |
| 520 | - 'texte_modifier_article' => 'Redigera artikeln:', |
|
| 521 | - 'texte_multilinguisme' => 'Om du vill hantera artiklar på flera språk, med en avancerad navigering, kan du lägga till en option för språkval i artiklar och avdelningar, i enlighet med sajtens struktur.', # MODIF |
|
| 522 | - 'texte_multilinguisme_trad' => 'Dessutom kan du aktivera ett system för länkhantering av de olika översättningarna av en artikel.', # MODIF |
|
| 523 | - 'texte_non_compresse' => '<i>okomprimerad</i> (din server stöder inte denna funktion)', |
|
| 524 | - 'texte_nouvelle_version_spip_1' => 'Du har installerat en ny version av SPIP.', |
|
| 525 | - 'texte_plus_trois_car' => 'mer än tre tecken', |
|
| 526 | - 'texte_plusieurs_articles' => 'Flera redaktörer hittades för "@cherche_auteur@":', |
|
| 527 | - 'texte_recalcul_page' => 'Om du vill uppdatera |
|
| 520 | + 'texte_modifier_article' => 'Redigera artikeln:', |
|
| 521 | + 'texte_multilinguisme' => 'Om du vill hantera artiklar på flera språk, med en avancerad navigering, kan du lägga till en option för språkval i artiklar och avdelningar, i enlighet med sajtens struktur.', # MODIF |
|
| 522 | + 'texte_multilinguisme_trad' => 'Dessutom kan du aktivera ett system för länkhantering av de olika översättningarna av en artikel.', # MODIF |
|
| 523 | + 'texte_non_compresse' => '<i>okomprimerad</i> (din server stöder inte denna funktion)', |
|
| 524 | + 'texte_nouvelle_version_spip_1' => 'Du har installerat en ny version av SPIP.', |
|
| 525 | + 'texte_plus_trois_car' => 'mer än tre tecken', |
|
| 526 | + 'texte_plusieurs_articles' => 'Flera redaktörer hittades för "@cherche_auteur@":', |
|
| 527 | + 'texte_recalcul_page' => 'Om du vill uppdatera |
|
| 528 | 528 | enbart en sida, är det bäst att göra det från den publika delen genom att klicka på « Ladda om sidan ».', |
| 529 | - 'texte_recuperer_base' => 'Reparera databasen', |
|
| 530 | - 'texte_sous_titre' => 'Undertitel', |
|
| 531 | - 'texte_statistiques_visites' => '(mörka staplar: Söndag / mörk linje: genomsnittlig nivå)', |
|
| 532 | - 'texte_statut_attente_validation' => 'väntar på godkännande', |
|
| 533 | - 'texte_statut_publies' => 'publicerad online', |
|
| 534 | - 'texte_statut_refuses' => 'avvisad', |
|
| 535 | - 'texte_suppression_fichiers' => 'Använd detta kommando för att radera alla filer |
|
| 529 | + 'texte_recuperer_base' => 'Reparera databasen', |
|
| 530 | + 'texte_sous_titre' => 'Undertitel', |
|
| 531 | + 'texte_statistiques_visites' => '(mörka staplar: Söndag / mörk linje: genomsnittlig nivå)', |
|
| 532 | + 'texte_statut_attente_validation' => 'väntar på godkännande', |
|
| 533 | + 'texte_statut_publies' => 'publicerad online', |
|
| 534 | + 'texte_statut_refuses' => 'avvisad', |
|
| 535 | + 'texte_suppression_fichiers' => 'Använd detta kommando för att radera alla filer |
|
| 536 | 536 | i SPIP’s cache. Det gör det möjligt att tvinga fram en uppdatering av alla sidor om du |
| 537 | 537 | gjort viktiga förändringar i sajtens utseende eller struktur.', |
| 538 | - 'texte_sur_titre' => 'Övertitel', |
|
| 539 | - 'texte_table_ok' => ': den här tabellen är OK.', |
|
| 540 | - 'texte_tentative_recuperation' => 'Reparationsförsök', |
|
| 541 | - 'texte_tenter_reparation' => 'Försök att reparera databasen', |
|
| 542 | - 'texte_titre_02' => 'Ärenderad:', |
|
| 543 | - 'texte_titre_obligatoire' => '<b>Titel</b> [Krävs]', |
|
| 544 | - 'texte_travail_article' => '@nom_auteur_modif@ arbetade med den här artikeln för @date_diff@ minuter sedan', |
|
| 545 | - 'texte_vide' => 'tom', |
|
| 546 | - 'texte_vider_cache' => 'töm cachen', |
|
| 547 | - 'titre_admin_tech' => 'Tekniskt underhåll', |
|
| 548 | - 'titre_admin_vider' => 'Tekniskt underhåll', |
|
| 549 | - 'titre_cadre_afficher_article' => 'Visa artiklarna:', |
|
| 550 | - 'titre_cadre_afficher_traductions' => 'Visa status för översättningen för följande språk:', |
|
| 551 | - 'titre_cadre_ajouter_auteur' => 'LÄGG TILL EN REDAKTÖR:', |
|
| 552 | - 'titre_cadre_interieur_rubrique' => 'I Avdelningen', |
|
| 553 | - 'titre_cadre_numero_auteur' => 'Redaktör nummer', |
|
| 554 | - 'titre_cadre_signature_obligatoire' => '<b>Signatur</b> [krävs]<br />', |
|
| 555 | - 'titre_config_fonctions' => 'Sajtens konfiguration', |
|
| 556 | - 'titre_configuration' => 'Sajtens konfiguration', |
|
| 557 | - 'titre_connexion_ldap' => 'Optioner: <b>Din LDAP koppling</b>', |
|
| 558 | - 'titre_groupe_mots' => 'NYCKELORDSGRUPP:', |
|
| 559 | - 'titre_langue_article' => 'ARTIKELNS SPRÅK', # MODIF |
|
| 560 | - 'titre_langue_rubrique' => 'AVDELNINGENS SPRÅK', # MODIF |
|
| 561 | - 'titre_langue_trad_article' => 'ARTIKESPRÅK OCH ÖVERSÄTTNINGAR', |
|
| 562 | - 'titre_les_articles' => 'ARTIKLAR', |
|
| 563 | - 'titre_naviguer_dans_le_site' => 'Navigera i sajten...', |
|
| 564 | - 'titre_nouvelle_rubrique' => 'Ny avdelning', |
|
| 565 | - 'titre_numero_rubrique' => 'AVDELNING NUMMER:', |
|
| 566 | - 'titre_page_articles_edit' => 'Editera: @titre@', |
|
| 567 | - 'titre_page_articles_page' => 'Artiklar', |
|
| 568 | - 'titre_page_articles_tous' => 'Hela sajten', |
|
| 569 | - 'titre_page_calendrier' => 'Kalender @nom_mois@ @annee@', |
|
| 570 | - 'titre_page_config_contenu' => 'Sajtens inställningar', |
|
| 571 | - 'titre_page_delete_all' => 'total och oåterkallelig radering', |
|
| 572 | - 'titre_page_recherche' => 'Sökresultat @recherche@', |
|
| 573 | - 'titre_page_statistiques_referers' => 'Statistik (inkommande länkar)', |
|
| 574 | - 'titre_page_upgrade' => 'Uppgradera SPIP', |
|
| 575 | - 'titre_publication_articles_post_dates' => 'Tidsstyrd publicering av artiklar', |
|
| 576 | - 'titre_reparation' => 'Reparera', |
|
| 577 | - 'titre_suivi_petition' => 'Uppföljning av namninasamlingar', |
|
| 578 | - 'trad_article_traduction' => 'Alla versioner av den här artikeln:', |
|
| 579 | - 'trad_delier' => 'Sluta länka den här artikeln till dess översättningar', # MODIF |
|
| 580 | - 'trad_lier' => 'Den här artikeln är en översättning av artikel nummer:', |
|
| 581 | - 'trad_new' => 'Skriv en ny översättning av den här artikeln', # MODIF |
|
| 538 | + 'texte_sur_titre' => 'Övertitel', |
|
| 539 | + 'texte_table_ok' => ': den här tabellen är OK.', |
|
| 540 | + 'texte_tentative_recuperation' => 'Reparationsförsök', |
|
| 541 | + 'texte_tenter_reparation' => 'Försök att reparera databasen', |
|
| 542 | + 'texte_titre_02' => 'Ärenderad:', |
|
| 543 | + 'texte_titre_obligatoire' => '<b>Titel</b> [Krävs]', |
|
| 544 | + 'texte_travail_article' => '@nom_auteur_modif@ arbetade med den här artikeln för @date_diff@ minuter sedan', |
|
| 545 | + 'texte_vide' => 'tom', |
|
| 546 | + 'texte_vider_cache' => 'töm cachen', |
|
| 547 | + 'titre_admin_tech' => 'Tekniskt underhåll', |
|
| 548 | + 'titre_admin_vider' => 'Tekniskt underhåll', |
|
| 549 | + 'titre_cadre_afficher_article' => 'Visa artiklarna:', |
|
| 550 | + 'titre_cadre_afficher_traductions' => 'Visa status för översättningen för följande språk:', |
|
| 551 | + 'titre_cadre_ajouter_auteur' => 'LÄGG TILL EN REDAKTÖR:', |
|
| 552 | + 'titre_cadre_interieur_rubrique' => 'I Avdelningen', |
|
| 553 | + 'titre_cadre_numero_auteur' => 'Redaktör nummer', |
|
| 554 | + 'titre_cadre_signature_obligatoire' => '<b>Signatur</b> [krävs]<br />', |
|
| 555 | + 'titre_config_fonctions' => 'Sajtens konfiguration', |
|
| 556 | + 'titre_configuration' => 'Sajtens konfiguration', |
|
| 557 | + 'titre_connexion_ldap' => 'Optioner: <b>Din LDAP koppling</b>', |
|
| 558 | + 'titre_groupe_mots' => 'NYCKELORDSGRUPP:', |
|
| 559 | + 'titre_langue_article' => 'ARTIKELNS SPRÅK', # MODIF |
|
| 560 | + 'titre_langue_rubrique' => 'AVDELNINGENS SPRÅK', # MODIF |
|
| 561 | + 'titre_langue_trad_article' => 'ARTIKESPRÅK OCH ÖVERSÄTTNINGAR', |
|
| 562 | + 'titre_les_articles' => 'ARTIKLAR', |
|
| 563 | + 'titre_naviguer_dans_le_site' => 'Navigera i sajten...', |
|
| 564 | + 'titre_nouvelle_rubrique' => 'Ny avdelning', |
|
| 565 | + 'titre_numero_rubrique' => 'AVDELNING NUMMER:', |
|
| 566 | + 'titre_page_articles_edit' => 'Editera: @titre@', |
|
| 567 | + 'titre_page_articles_page' => 'Artiklar', |
|
| 568 | + 'titre_page_articles_tous' => 'Hela sajten', |
|
| 569 | + 'titre_page_calendrier' => 'Kalender @nom_mois@ @annee@', |
|
| 570 | + 'titre_page_config_contenu' => 'Sajtens inställningar', |
|
| 571 | + 'titre_page_delete_all' => 'total och oåterkallelig radering', |
|
| 572 | + 'titre_page_recherche' => 'Sökresultat @recherche@', |
|
| 573 | + 'titre_page_statistiques_referers' => 'Statistik (inkommande länkar)', |
|
| 574 | + 'titre_page_upgrade' => 'Uppgradera SPIP', |
|
| 575 | + 'titre_publication_articles_post_dates' => 'Tidsstyrd publicering av artiklar', |
|
| 576 | + 'titre_reparation' => 'Reparera', |
|
| 577 | + 'titre_suivi_petition' => 'Uppföljning av namninasamlingar', |
|
| 578 | + 'trad_article_traduction' => 'Alla versioner av den här artikeln:', |
|
| 579 | + 'trad_delier' => 'Sluta länka den här artikeln till dess översättningar', # MODIF |
|
| 580 | + 'trad_lier' => 'Den här artikeln är en översättning av artikel nummer:', |
|
| 581 | + 'trad_new' => 'Skriv en ny översättning av den här artikeln', # MODIF |
|
| 582 | 582 | |
| 583 | - // U |
|
| 584 | - 'utf8_convert_erreur_orig' => 'Fel: teckenkodningen @charset@ stöds inte.', |
|
| 583 | + // U |
|
| 584 | + 'utf8_convert_erreur_orig' => 'Fel: teckenkodningen @charset@ stöds inte.', |
|
| 585 | 585 | |
| 586 | - // V |
|
| 587 | - 'version' => 'Version:' |
|
| 586 | + // V |
|
| 587 | + 'version' => 'Version:' |
|
| 588 | 588 | ); |