@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | if ($quoi !== 'actifs') { |
| 140 | 140 | $lpf = liste_plugin_files(); |
| 141 | 141 | if ($lpf) { |
| 142 | - echo "<p>" . _T('texte_presente_plugin') . "</p>"; |
|
| 142 | + echo "<p>"._T('texte_presente_plugin')."</p>"; |
|
| 143 | 143 | } else { |
| 144 | 144 | if (!@is_dir(_DIR_PLUGINS)) { |
| 145 | - echo "<p>" . _T('plugin_info_automatique_ftp', array('rep' => joli_repertoire(_DIR_PLUGINS))) |
|
| 146 | - . " — " . _T('plugin_info_automatique_creer') . "</p>"; |
|
| 145 | + echo "<p>"._T('plugin_info_automatique_ftp', array('rep' => joli_repertoire(_DIR_PLUGINS))) |
|
| 146 | + . " — "._T('plugin_info_automatique_creer')."</p>"; |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | $lcpaffiche = $lpf; |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | if (defined('_DIR_PLUGINS_SUPPL')) { |
| 165 | 165 | $nb += count($lcpas); |
| 166 | 166 | } |
| 167 | - echo "<h3>" . sinon(singulier_ou_pluriel($nb, 'plugins_actif_un', 'plugins_actifs', 'count'), |
|
| 168 | - _T('plugins_actif_aucun')) . "</h3>"; |
|
| 167 | + echo "<h3>".sinon(singulier_ou_pluriel($nb, 'plugins_actif_un', 'plugins_actifs', 'count'), |
|
| 168 | + _T('plugins_actif_aucun'))."</h3>"; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | if (empty($format)) { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | if ($corps) { |
| 184 | 184 | $corps .= "\n<div class='boutons' style='display:none;'>" |
| 185 | - . "<input type='submit' class='submit save' value='" . _T('bouton_enregistrer') |
|
| 185 | + . "<input type='submit' class='submit save' value='"._T('bouton_enregistrer') |
|
| 186 | 186 | . "' />" |
| 187 | 187 | . "</div>"; |
| 188 | 188 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | . debut_cadre_trait_couleur('', true, '', _T('plugins_liste_dist'), 'liste_plugins_dist') |
| 256 | 256 | . "<p>" |
| 257 | 257 | . _T('plugin_info_plugins_dist_1', array('plugins_dist' => joli_repertoire(_DIR_PLUGINS_DIST))) |
| 258 | - . '<br />' . _T('plugin_info_plugins_dist_2') |
|
| 258 | + . '<br />'._T('plugin_info_plugins_dist_2') |
|
| 259 | 259 | . "</p>" |
| 260 | 260 | . $liste |
| 261 | 261 | . fin_cadre_trait_couleur(true) |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | $res = debut_cadre_enfonce('', true, '', _T('plugin_librairies_installees')); |
| 279 | 279 | $res .= '<dl>'; |
| 280 | 280 | foreach ($libs as $lib => $rep) { |
| 281 | - $res .= "<dt>$lib</dt><dd>" . joli_repertoire($rep) . "</dd>\n"; |
|
| 281 | + $res .= "<dt>$lib</dt><dd>".joli_repertoire($rep)."</dd>\n"; |
|
| 282 | 282 | } |
| 283 | 283 | $res .= '</dl>'; |
| 284 | 284 | $res .= fin_cadre_enfonce(true); |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | function liste_librairies() { |
| 297 | 297 | $libs = array(); |
| 298 | 298 | foreach (array_reverse(creer_chemin()) as $d) { |
| 299 | - if (is_dir($dir = $d . 'lib/') |
|
| 299 | + if (is_dir($dir = $d.'lib/') |
|
| 300 | 300 | and $t = opendir($dir) |
| 301 | 301 | ) { |
| 302 | 302 | while (($f = readdir($t)) !== 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 | include_spip('inc/config'); |
@@ -37,26 +37,26 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function exec_admin_plugin_dist($retour = '') { |
| 39 | 39 | |
| 40 | - if (!autoriser('configurer', '_plugins')) { |
|
| 41 | - include_spip('inc/minipres'); |
|
| 42 | - echo minipres(); |
|
| 43 | - } else { |
|
| 44 | - // on fait la verif du path avant tout, |
|
| 45 | - // et l'installation des qu'on est dans la colonne principale |
|
| 46 | - // si jamais la liste des plugins actifs change, il faut faire un refresh du hit |
|
| 47 | - // pour etre sur que les bons fichiers seront charges lors de l'install |
|
| 48 | - $new = actualise_plugins_actifs(); |
|
| 49 | - if ($new and _request('actualise') < 2) { |
|
| 50 | - include_spip('inc/headers'); |
|
| 51 | - if (isset($GLOBALS['fichier_php_compile_recent'])) { |
|
| 52 | - // attendre eventuellement l'invalidation du cache opcode |
|
| 53 | - spip_attend_invalidation_opcode_cache($GLOBALS['fichier_php_compile_recent']); |
|
| 54 | - } |
|
| 55 | - redirige_par_entete(parametre_url(self(), 'actualise', _request('actualise') + 1, '&')); |
|
| 56 | - } else { |
|
| 57 | - admin_plug_args(_request('voir'), _request('erreur'), _request('format')); |
|
| 58 | - } |
|
| 59 | - } |
|
| 40 | + if (!autoriser('configurer', '_plugins')) { |
|
| 41 | + include_spip('inc/minipres'); |
|
| 42 | + echo minipres(); |
|
| 43 | + } else { |
|
| 44 | + // on fait la verif du path avant tout, |
|
| 45 | + // et l'installation des qu'on est dans la colonne principale |
|
| 46 | + // si jamais la liste des plugins actifs change, il faut faire un refresh du hit |
|
| 47 | + // pour etre sur que les bons fichiers seront charges lors de l'install |
|
| 48 | + $new = actualise_plugins_actifs(); |
|
| 49 | + if ($new and _request('actualise') < 2) { |
|
| 50 | + include_spip('inc/headers'); |
|
| 51 | + if (isset($GLOBALS['fichier_php_compile_recent'])) { |
|
| 52 | + // attendre eventuellement l'invalidation du cache opcode |
|
| 53 | + spip_attend_invalidation_opcode_cache($GLOBALS['fichier_php_compile_recent']); |
|
| 54 | + } |
|
| 55 | + redirige_par_entete(parametre_url(self(), 'actualise', _request('actualise') + 1, '&')); |
|
| 56 | + } else { |
|
| 57 | + admin_plug_args(_request('voir'), _request('erreur'), _request('format')); |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -81,126 +81,126 @@ discard block |
||
| 81 | 81 | * Format d'affichage (liste ou arborescence) |
| 82 | 82 | **/ |
| 83 | 83 | function admin_plug_args($quoi, $erreur, $format) { |
| 84 | - if (!$quoi) { |
|
| 85 | - $quoi = 'actifs'; |
|
| 86 | - } |
|
| 87 | - // empecher l'affichage des erreurs dans le bandeau, on le donne ensuite |
|
| 88 | - // format brut par plugin |
|
| 89 | - $GLOBALS['erreurs_activation_raw'] = plugin_donne_erreurs(true, false); |
|
| 90 | - // format resume mis en forme |
|
| 91 | - $erreur_activation = plugin_donne_erreurs(); |
|
| 92 | - $commencer_page = charger_fonction('commencer_page', 'inc'); |
|
| 93 | - echo $commencer_page(_T('icone_admin_plugin'), "configuration", "plugin"); |
|
| 94 | - |
|
| 95 | - echo debut_gauche('plugin', true); |
|
| 96 | - echo recuperer_fond('prive/squelettes/navigation/configurer', array('exec' => 'admin_plugin')); |
|
| 97 | - |
|
| 98 | - echo pipeline('affiche_gauche', |
|
| 99 | - array( |
|
| 100 | - 'args' => array('exec' => 'admin_plugin'), |
|
| 101 | - 'data' => afficher_librairies() |
|
| 102 | - ) |
|
| 103 | - ); |
|
| 104 | - |
|
| 105 | - echo debut_droite('plugin', true); |
|
| 106 | - echo gros_titre(_T('icone_admin_plugin'), '', false); |
|
| 107 | - |
|
| 108 | - // Barre d'onglets de premier niveau |
|
| 109 | - echo barre_onglets("plugins", "plugins_actifs"); |
|
| 110 | - // Barre d'onglets de second niveau |
|
| 111 | - $onglet2 = $quoi == 'actifs' ? 'plugins_actifs' : 'admin_plugin'; |
|
| 112 | - echo debut_onglet('onglets_simple second'); |
|
| 113 | - echo onglet(_T('plugins_tous_liste'), generer_url_ecrire("admin_plugin", "voir=tous"), 'admin_plugin', $onglet2); |
|
| 114 | - echo onglet(_T('plugins_actifs_liste'), generer_url_ecrire("admin_plugin"), 'plugins_actifs', $onglet2); |
|
| 115 | - echo fin_onglet(); |
|
| 116 | - |
|
| 117 | - // message d'erreur au retour d'une operation |
|
| 118 | - if ($erreur) { |
|
| 119 | - echo "<div class='error'>$erreur</div>"; |
|
| 120 | - } |
|
| 121 | - if ($erreur_activation) { |
|
| 122 | - echo "<div class='error'>$erreur_activation</div>"; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - // la mise a jour de cette meta a ete faite par ecrire_plugin_actifs |
|
| 126 | - $actifs = unserialize($GLOBALS['meta']['plugin']); |
|
| 127 | - $lcpa = $actifs + unserialize($GLOBALS['meta']['plugin_attente']); |
|
| 128 | - |
|
| 129 | - // Les affichages se basent sur le repertoire, pas sur le nom |
|
| 130 | - $actifs = liste_chemin_plugin($actifs, ''); |
|
| 131 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 132 | - $lcpas = liste_chemin_plugin($lcpa, _DIR_PLUGINS_SUPPL); |
|
| 133 | - } |
|
| 134 | - $lcpa = liste_chemin_plugin($lcpa); |
|
| 135 | - |
|
| 136 | - // on installe les plugins maintenant, |
|
| 137 | - // cela permet aux scripts d'install de faire des affichages (moches...) |
|
| 138 | - plugin_installes_meta(); |
|
| 139 | - |
|
| 140 | - echo "<div class='liste-plugins formulaire_spip'>"; |
|
| 141 | - echo debut_cadre_trait_couleur('plugin-24.png', true, '', _T('plugins_liste'), 'plugins'); |
|
| 142 | - |
|
| 143 | - if ($quoi !== 'actifs') { |
|
| 144 | - $lpf = liste_plugin_files(); |
|
| 145 | - if ($lpf) { |
|
| 146 | - echo "<p>" . _T('texte_presente_plugin') . "</p>"; |
|
| 147 | - } else { |
|
| 148 | - if (!@is_dir(_DIR_PLUGINS)) { |
|
| 149 | - echo "<p>" . _T('plugin_info_automatique_ftp', array('rep' => joli_repertoire(_DIR_PLUGINS))) |
|
| 150 | - . " — " . _T('plugin_info_automatique_creer') . "</p>"; |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - $lcpaffiche = $lpf; |
|
| 154 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 155 | - $lcpaffichesup = liste_plugin_files(_DIR_PLUGINS_SUPPL); |
|
| 156 | - } |
|
| 157 | - } else { |
|
| 158 | - // la liste |
|
| 159 | - // $quoi=='actifs' |
|
| 160 | - $lcpaffiche = $lcpa; |
|
| 161 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 162 | - $lcpaffichesup = $lcpas; |
|
| 163 | - } |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - if ($quoi == 'actifs' or $lpf) { |
|
| 167 | - $nb = count($lcpa); |
|
| 168 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 169 | - $nb += count($lcpas); |
|
| 170 | - } |
|
| 171 | - echo "<h3>" . sinon(singulier_ou_pluriel($nb, 'plugins_actif_un', 'plugins_actifs', 'count'), |
|
| 172 | - _T('plugins_actif_aucun')) . "</h3>"; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - if (empty($format)) { |
|
| 176 | - $format = 'liste'; |
|
| 177 | - } elseif (!in_array($format, array('liste', 'repertoires'))) { |
|
| 178 | - $format = 'repertoires'; |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - $afficher = charger_fonction("afficher_$format", 'plugins'); |
|
| 182 | - $corps = $afficher(self(), $lcpaffiche, $lcpa, $actifs); |
|
| 183 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 184 | - $corps .= $afficher(self(), $lcpaffichesup, $lcpas, $actifs, _DIR_PLUGINS_SUPPL); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - if ($corps) { |
|
| 188 | - $corps .= "\n<div class='boutons' style='display:none;'>" |
|
| 189 | - . "<input type='submit' class='submit save' value='" . _T('bouton_enregistrer') |
|
| 190 | - . "' />" |
|
| 191 | - . "</div>"; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - echo redirige_action_post('activer_plugins', 'activer', 'admin_plugin', '', $corps); |
|
| 195 | - |
|
| 196 | - echo fin_cadre_trait_couleur(true); |
|
| 197 | - |
|
| 198 | - if ($quoi == 'actifs') { |
|
| 199 | - echo affiche_les_plugins_verrouilles($actifs); |
|
| 200 | - } |
|
| 201 | - echo "</div>"; |
|
| 202 | - |
|
| 203 | - echo http_script(" |
|
| 84 | + if (!$quoi) { |
|
| 85 | + $quoi = 'actifs'; |
|
| 86 | + } |
|
| 87 | + // empecher l'affichage des erreurs dans le bandeau, on le donne ensuite |
|
| 88 | + // format brut par plugin |
|
| 89 | + $GLOBALS['erreurs_activation_raw'] = plugin_donne_erreurs(true, false); |
|
| 90 | + // format resume mis en forme |
|
| 91 | + $erreur_activation = plugin_donne_erreurs(); |
|
| 92 | + $commencer_page = charger_fonction('commencer_page', 'inc'); |
|
| 93 | + echo $commencer_page(_T('icone_admin_plugin'), "configuration", "plugin"); |
|
| 94 | + |
|
| 95 | + echo debut_gauche('plugin', true); |
|
| 96 | + echo recuperer_fond('prive/squelettes/navigation/configurer', array('exec' => 'admin_plugin')); |
|
| 97 | + |
|
| 98 | + echo pipeline('affiche_gauche', |
|
| 99 | + array( |
|
| 100 | + 'args' => array('exec' => 'admin_plugin'), |
|
| 101 | + 'data' => afficher_librairies() |
|
| 102 | + ) |
|
| 103 | + ); |
|
| 104 | + |
|
| 105 | + echo debut_droite('plugin', true); |
|
| 106 | + echo gros_titre(_T('icone_admin_plugin'), '', false); |
|
| 107 | + |
|
| 108 | + // Barre d'onglets de premier niveau |
|
| 109 | + echo barre_onglets("plugins", "plugins_actifs"); |
|
| 110 | + // Barre d'onglets de second niveau |
|
| 111 | + $onglet2 = $quoi == 'actifs' ? 'plugins_actifs' : 'admin_plugin'; |
|
| 112 | + echo debut_onglet('onglets_simple second'); |
|
| 113 | + echo onglet(_T('plugins_tous_liste'), generer_url_ecrire("admin_plugin", "voir=tous"), 'admin_plugin', $onglet2); |
|
| 114 | + echo onglet(_T('plugins_actifs_liste'), generer_url_ecrire("admin_plugin"), 'plugins_actifs', $onglet2); |
|
| 115 | + echo fin_onglet(); |
|
| 116 | + |
|
| 117 | + // message d'erreur au retour d'une operation |
|
| 118 | + if ($erreur) { |
|
| 119 | + echo "<div class='error'>$erreur</div>"; |
|
| 120 | + } |
|
| 121 | + if ($erreur_activation) { |
|
| 122 | + echo "<div class='error'>$erreur_activation</div>"; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + // la mise a jour de cette meta a ete faite par ecrire_plugin_actifs |
|
| 126 | + $actifs = unserialize($GLOBALS['meta']['plugin']); |
|
| 127 | + $lcpa = $actifs + unserialize($GLOBALS['meta']['plugin_attente']); |
|
| 128 | + |
|
| 129 | + // Les affichages se basent sur le repertoire, pas sur le nom |
|
| 130 | + $actifs = liste_chemin_plugin($actifs, ''); |
|
| 131 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 132 | + $lcpas = liste_chemin_plugin($lcpa, _DIR_PLUGINS_SUPPL); |
|
| 133 | + } |
|
| 134 | + $lcpa = liste_chemin_plugin($lcpa); |
|
| 135 | + |
|
| 136 | + // on installe les plugins maintenant, |
|
| 137 | + // cela permet aux scripts d'install de faire des affichages (moches...) |
|
| 138 | + plugin_installes_meta(); |
|
| 139 | + |
|
| 140 | + echo "<div class='liste-plugins formulaire_spip'>"; |
|
| 141 | + echo debut_cadre_trait_couleur('plugin-24.png', true, '', _T('plugins_liste'), 'plugins'); |
|
| 142 | + |
|
| 143 | + if ($quoi !== 'actifs') { |
|
| 144 | + $lpf = liste_plugin_files(); |
|
| 145 | + if ($lpf) { |
|
| 146 | + echo "<p>" . _T('texte_presente_plugin') . "</p>"; |
|
| 147 | + } else { |
|
| 148 | + if (!@is_dir(_DIR_PLUGINS)) { |
|
| 149 | + echo "<p>" . _T('plugin_info_automatique_ftp', array('rep' => joli_repertoire(_DIR_PLUGINS))) |
|
| 150 | + . " — " . _T('plugin_info_automatique_creer') . "</p>"; |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | + $lcpaffiche = $lpf; |
|
| 154 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 155 | + $lcpaffichesup = liste_plugin_files(_DIR_PLUGINS_SUPPL); |
|
| 156 | + } |
|
| 157 | + } else { |
|
| 158 | + // la liste |
|
| 159 | + // $quoi=='actifs' |
|
| 160 | + $lcpaffiche = $lcpa; |
|
| 161 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 162 | + $lcpaffichesup = $lcpas; |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + if ($quoi == 'actifs' or $lpf) { |
|
| 167 | + $nb = count($lcpa); |
|
| 168 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 169 | + $nb += count($lcpas); |
|
| 170 | + } |
|
| 171 | + echo "<h3>" . sinon(singulier_ou_pluriel($nb, 'plugins_actif_un', 'plugins_actifs', 'count'), |
|
| 172 | + _T('plugins_actif_aucun')) . "</h3>"; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + if (empty($format)) { |
|
| 176 | + $format = 'liste'; |
|
| 177 | + } elseif (!in_array($format, array('liste', 'repertoires'))) { |
|
| 178 | + $format = 'repertoires'; |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + $afficher = charger_fonction("afficher_$format", 'plugins'); |
|
| 182 | + $corps = $afficher(self(), $lcpaffiche, $lcpa, $actifs); |
|
| 183 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 184 | + $corps .= $afficher(self(), $lcpaffichesup, $lcpas, $actifs, _DIR_PLUGINS_SUPPL); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + if ($corps) { |
|
| 188 | + $corps .= "\n<div class='boutons' style='display:none;'>" |
|
| 189 | + . "<input type='submit' class='submit save' value='" . _T('bouton_enregistrer') |
|
| 190 | + . "' />" |
|
| 191 | + . "</div>"; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + echo redirige_action_post('activer_plugins', 'activer', 'admin_plugin', '', $corps); |
|
| 195 | + |
|
| 196 | + echo fin_cadre_trait_couleur(true); |
|
| 197 | + |
|
| 198 | + if ($quoi == 'actifs') { |
|
| 199 | + echo affiche_les_plugins_verrouilles($actifs); |
|
| 200 | + } |
|
| 201 | + echo "</div>"; |
|
| 202 | + |
|
| 203 | + echo http_script(" |
|
| 204 | 204 | jQuery(function(){ |
| 205 | 205 | jQuery('.plugins li.item a[rel=info]').click(function(){ |
| 206 | 206 | var li = jQuery(this).parents('li').eq(0); |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | }); |
| 227 | 227 | "); |
| 228 | 228 | |
| 229 | - echo pipeline('affiche_milieu', |
|
| 230 | - array( |
|
| 231 | - 'args' => array('exec' => 'admin_plugin'), |
|
| 232 | - 'data' => '' |
|
| 233 | - ) |
|
| 234 | - ); |
|
| 229 | + echo pipeline('affiche_milieu', |
|
| 230 | + array( |
|
| 231 | + 'args' => array('exec' => 'admin_plugin'), |
|
| 232 | + 'data' => '' |
|
| 233 | + ) |
|
| 234 | + ); |
|
| 235 | 235 | |
| 236 | - echo fin_gauche(), fin_page(); |
|
| 236 | + echo fin_gauche(), fin_page(); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -247,23 +247,23 @@ discard block |
||
| 247 | 247 | * Code HTML |
| 248 | 248 | **/ |
| 249 | 249 | function affiche_les_plugins_verrouilles($actifs) { |
| 250 | - if ((!$liste = liste_plugin_files(_DIR_PLUGINS_DIST))) { |
|
| 251 | - return ''; |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - $afficher = charger_fonction("afficher_liste", 'plugins'); |
|
| 255 | - $liste = $afficher(self(), $liste, array(), $actifs, _DIR_PLUGINS_DIST); |
|
| 256 | - |
|
| 257 | - return |
|
| 258 | - "<div id='plugins_dist'>" |
|
| 259 | - . debut_cadre_trait_couleur('', true, '', _T('plugins_liste_dist'), 'liste_plugins_dist') |
|
| 260 | - . "<p>" |
|
| 261 | - . _T('plugin_info_plugins_dist_1', array('plugins_dist' => joli_repertoire(_DIR_PLUGINS_DIST))) |
|
| 262 | - . '<br />' . _T('plugin_info_plugins_dist_2') |
|
| 263 | - . "</p>" |
|
| 264 | - . $liste |
|
| 265 | - . fin_cadre_trait_couleur(true) |
|
| 266 | - . "</div>\n"; |
|
| 250 | + if ((!$liste = liste_plugin_files(_DIR_PLUGINS_DIST))) { |
|
| 251 | + return ''; |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + $afficher = charger_fonction("afficher_liste", 'plugins'); |
|
| 255 | + $liste = $afficher(self(), $liste, array(), $actifs, _DIR_PLUGINS_DIST); |
|
| 256 | + |
|
| 257 | + return |
|
| 258 | + "<div id='plugins_dist'>" |
|
| 259 | + . debut_cadre_trait_couleur('', true, '', _T('plugins_liste_dist'), 'liste_plugins_dist') |
|
| 260 | + . "<p>" |
|
| 261 | + . _T('plugin_info_plugins_dist_1', array('plugins_dist' => joli_repertoire(_DIR_PLUGINS_DIST))) |
|
| 262 | + . '<br />' . _T('plugin_info_plugins_dist_2') |
|
| 263 | + . "</p>" |
|
| 264 | + . $liste |
|
| 265 | + . fin_cadre_trait_couleur(true) |
|
| 266 | + . "</div>\n"; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -275,19 +275,19 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | function afficher_librairies() { |
| 277 | 277 | |
| 278 | - if (!$libs = liste_librairies()) { |
|
| 279 | - return ''; |
|
| 280 | - } |
|
| 281 | - ksort($libs); |
|
| 282 | - $res = debut_cadre_enfonce('', true, '', _T('plugin_librairies_installees')); |
|
| 283 | - $res .= '<dl>'; |
|
| 284 | - foreach ($libs as $lib => $rep) { |
|
| 285 | - $res .= "<dt>$lib</dt><dd>" . joli_repertoire($rep) . "</dd>\n"; |
|
| 286 | - } |
|
| 287 | - $res .= '</dl>'; |
|
| 288 | - $res .= fin_cadre_enfonce(true); |
|
| 289 | - |
|
| 290 | - return $res; |
|
| 278 | + if (!$libs = liste_librairies()) { |
|
| 279 | + return ''; |
|
| 280 | + } |
|
| 281 | + ksort($libs); |
|
| 282 | + $res = debut_cadre_enfonce('', true, '', _T('plugin_librairies_installees')); |
|
| 283 | + $res .= '<dl>'; |
|
| 284 | + foreach ($libs as $lib => $rep) { |
|
| 285 | + $res .= "<dt>$lib</dt><dd>" . joli_repertoire($rep) . "</dd>\n"; |
|
| 286 | + } |
|
| 287 | + $res .= '</dl>'; |
|
| 288 | + $res .= fin_cadre_enfonce(true); |
|
| 289 | + |
|
| 290 | + return $res; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
@@ -298,20 +298,20 @@ discard block |
||
| 298 | 298 | * Tableau (nom de la lib => repertoire , ...) |
| 299 | 299 | */ |
| 300 | 300 | function liste_librairies() { |
| 301 | - $libs = array(); |
|
| 302 | - foreach (array_reverse(creer_chemin()) as $d) { |
|
| 303 | - if (is_dir($dir = $d . 'lib/') |
|
| 304 | - and $t = opendir($dir) |
|
| 305 | - ) { |
|
| 306 | - while (($f = readdir($t)) !== false) { |
|
| 307 | - if ($f[0] != '.' |
|
| 308 | - and is_dir("$dir/$f") |
|
| 309 | - ) { |
|
| 310 | - $libs[$f] = $dir; |
|
| 311 | - } |
|
| 312 | - } |
|
| 313 | - } |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - return $libs; |
|
| 301 | + $libs = array(); |
|
| 302 | + foreach (array_reverse(creer_chemin()) as $d) { |
|
| 303 | + if (is_dir($dir = $d . 'lib/') |
|
| 304 | + and $t = opendir($dir) |
|
| 305 | + ) { |
|
| 306 | + while (($f = readdir($t)) !== false) { |
|
| 307 | + if ($f[0] != '.' |
|
| 308 | + and is_dir("$dir/$f") |
|
| 309 | + ) { |
|
| 310 | + $libs[$f] = $dir; |
|
| 311 | + } |
|
| 312 | + } |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + return $libs; |
|
| 317 | 317 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $texte = $x . $texte; |
|
| 67 | + $texte = $x.$texte; |
|
| 68 | 68 | |
| 69 | 69 | return $texte; |
| 70 | 70 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | if (isset($_SERVER['HTTP_REFERER'])) { |
| 102 | 102 | $_SERVER['HTTP_REFERER'] = preg_replace(',[^\w\,/#&;-]+,', ' ', $_SERVER['HTTP_REFERER']); |
| 103 | 103 | } |
| 104 | - if ($rech){ |
|
| 104 | + if ($rech) { |
|
| 105 | 105 | $rech = preg_replace(',[^\w\,/#&;-]+,', ' ', $rech); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | || ($pos = 0); |
| 177 | 177 | |
| 178 | 178 | if (false === strpos(substr($texte, 0, $pos), '<!-- insert_head -->')) { |
| 179 | - $insert = "\n" . pipeline('insert_head', '<!-- f_insert_head -->') . "\n"; |
|
| 179 | + $insert = "\n".pipeline('insert_head', '<!-- f_insert_head -->')."\n"; |
|
| 180 | 180 | $texte = substr_replace($texte, $insert, $pos, 0); |
| 181 | 181 | } |
| 182 | 182 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | // inserer avant le </body> fermant si on peut, a la fin de la page sinon |
| 274 | 274 | if (($p = strpos($texte, '</body>')) !== false) { |
| 275 | - $texte = substr($texte, 0, $p) . $code . substr($texte, $p); |
|
| 275 | + $texte = substr($texte, 0, $p).$code.substr($texte, $p); |
|
| 276 | 276 | } else { |
| 277 | 277 | $texte .= $code; |
| 278 | 278 | } |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Pipelines |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | if (test_espace_prive()) { |
| 22 | - include_spip('inc/pipelines_ecrire'); |
|
| 22 | + include_spip('inc/pipelines_ecrire'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
@@ -45,28 +45,28 @@ discard block |
||
| 45 | 45 | * @return string Contenu qui sera inséré dans le head HTML |
| 46 | 46 | **/ |
| 47 | 47 | function f_jQuery($texte) { |
| 48 | - $x = ''; |
|
| 49 | - $jquery_plugins = pipeline('jquery_plugins', |
|
| 50 | - array( |
|
| 51 | - 'javascript/jquery.js', |
|
| 52 | - 'javascript/jquery-migrate-3.0.1.js', |
|
| 53 | - 'javascript/jquery.form.js', |
|
| 54 | - 'javascript/jquery.autosave.js', |
|
| 55 | - 'javascript/jquery.placeholder-label.js', |
|
| 56 | - 'javascript/ajaxCallback.js', |
|
| 57 | - 'javascript/js.cookie.js', |
|
| 58 | - 'javascript/jquery.cookie.js' |
|
| 59 | - )); |
|
| 60 | - foreach (array_unique($jquery_plugins) as $script) { |
|
| 61 | - if ($script = find_in_path(supprimer_timestamp($script))) { |
|
| 62 | - $script = timestamp($script); |
|
| 63 | - $x .= "\n<script src=\"$script\" type=\"text/javascript\"></script>\n"; |
|
| 64 | - } |
|
| 65 | - } |
|
| 48 | + $x = ''; |
|
| 49 | + $jquery_plugins = pipeline('jquery_plugins', |
|
| 50 | + array( |
|
| 51 | + 'javascript/jquery.js', |
|
| 52 | + 'javascript/jquery-migrate-3.0.1.js', |
|
| 53 | + 'javascript/jquery.form.js', |
|
| 54 | + 'javascript/jquery.autosave.js', |
|
| 55 | + 'javascript/jquery.placeholder-label.js', |
|
| 56 | + 'javascript/ajaxCallback.js', |
|
| 57 | + 'javascript/js.cookie.js', |
|
| 58 | + 'javascript/jquery.cookie.js' |
|
| 59 | + )); |
|
| 60 | + foreach (array_unique($jquery_plugins) as $script) { |
|
| 61 | + if ($script = find_in_path(supprimer_timestamp($script))) { |
|
| 62 | + $script = timestamp($script); |
|
| 63 | + $x .= "\n<script src=\"$script\" type=\"text/javascript\"></script>\n"; |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - $texte = $x . $texte; |
|
| 67 | + $texte = $x . $texte; |
|
| 68 | 68 | |
| 69 | - return $texte; |
|
| 69 | + return $texte; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | |
@@ -85,27 +85,27 @@ discard block |
||
| 85 | 85 | * @return string Contenu de la page envoyée au navigateur |
| 86 | 86 | **/ |
| 87 | 87 | function f_surligne($texte) { |
| 88 | - if (!$GLOBALS['html']) { |
|
| 89 | - return $texte; |
|
| 90 | - } |
|
| 91 | - $rech = _request('var_recherche'); |
|
| 92 | - if (!$rech |
|
| 93 | - and (!defined('_SURLIGNE_RECHERCHE_REFERERS') |
|
| 94 | - or !_SURLIGNE_RECHERCHE_REFERERS |
|
| 95 | - or !isset($_SERVER['HTTP_REFERER'])) |
|
| 96 | - ) { |
|
| 97 | - return $texte; |
|
| 98 | - } |
|
| 99 | - include_spip('inc/surligne'); |
|
| 88 | + if (!$GLOBALS['html']) { |
|
| 89 | + return $texte; |
|
| 90 | + } |
|
| 91 | + $rech = _request('var_recherche'); |
|
| 92 | + if (!$rech |
|
| 93 | + and (!defined('_SURLIGNE_RECHERCHE_REFERERS') |
|
| 94 | + or !_SURLIGNE_RECHERCHE_REFERERS |
|
| 95 | + or !isset($_SERVER['HTTP_REFERER'])) |
|
| 96 | + ) { |
|
| 97 | + return $texte; |
|
| 98 | + } |
|
| 99 | + include_spip('inc/surligne'); |
|
| 100 | 100 | |
| 101 | - if (isset($_SERVER['HTTP_REFERER'])) { |
|
| 102 | - $_SERVER['HTTP_REFERER'] = preg_replace(',[^\w\,/#&;-]+,', ' ', $_SERVER['HTTP_REFERER']); |
|
| 103 | - } |
|
| 104 | - if ($rech){ |
|
| 105 | - $rech = preg_replace(',[^\w\,/#&;-]+,', ' ', $rech); |
|
| 106 | - } |
|
| 101 | + if (isset($_SERVER['HTTP_REFERER'])) { |
|
| 102 | + $_SERVER['HTTP_REFERER'] = preg_replace(',[^\w\,/#&;-]+,', ' ', $_SERVER['HTTP_REFERER']); |
|
| 103 | + } |
|
| 104 | + if ($rech){ |
|
| 105 | + $rech = preg_replace(',[^\w\,/#&;-]+,', ' ', $rech); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - return surligner_mots($texte, $rech); |
|
| 108 | + return surligner_mots($texte, $rech); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -122,32 +122,32 @@ discard block |
||
| 122 | 122 | * @return string Contenu de la page envoyée au navigateur |
| 123 | 123 | **/ |
| 124 | 124 | function f_tidy($texte) { |
| 125 | - /** |
|
| 126 | - * Indentation à faire ? |
|
| 127 | - * |
|
| 128 | - * - true : actif. |
|
| 129 | - * - false par défaut. |
|
| 130 | - */ |
|
| 125 | + /** |
|
| 126 | + * Indentation à faire ? |
|
| 127 | + * |
|
| 128 | + * - true : actif. |
|
| 129 | + * - false par défaut. |
|
| 130 | + */ |
|
| 131 | 131 | |
| 132 | - if ($GLOBALS['xhtml'] # tidy demande |
|
| 133 | - and $GLOBALS['html'] # verifie que la page avait l'entete text/html |
|
| 134 | - and strlen($texte) |
|
| 135 | - and !headers_sent() |
|
| 136 | - ) { |
|
| 137 | - # Compatibilite ascendante |
|
| 138 | - if (!is_string($GLOBALS['xhtml'])) { |
|
| 139 | - $GLOBALS['xhtml'] = 'tidy'; |
|
| 140 | - } |
|
| 132 | + if ($GLOBALS['xhtml'] # tidy demande |
|
| 133 | + and $GLOBALS['html'] # verifie que la page avait l'entete text/html |
|
| 134 | + and strlen($texte) |
|
| 135 | + and !headers_sent() |
|
| 136 | + ) { |
|
| 137 | + # Compatibilite ascendante |
|
| 138 | + if (!is_string($GLOBALS['xhtml'])) { |
|
| 139 | + $GLOBALS['xhtml'] = 'tidy'; |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - if (!$f = charger_fonction($GLOBALS['xhtml'], 'inc', true)) { |
|
| 143 | - spip_log("tidy absent, l'indenteur SPIP le remplace"); |
|
| 144 | - $f = charger_fonction('sax', 'xml'); |
|
| 145 | - } |
|
| 142 | + if (!$f = charger_fonction($GLOBALS['xhtml'], 'inc', true)) { |
|
| 143 | + spip_log("tidy absent, l'indenteur SPIP le remplace"); |
|
| 144 | + $f = charger_fonction('sax', 'xml'); |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - return $f($texte); |
|
| 148 | - } |
|
| 147 | + return $f($texte); |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - return $texte; |
|
| 150 | + return $texte; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -166,21 +166,21 @@ discard block |
||
| 166 | 166 | * @return string Contenu de la page envoyée au navigateur |
| 167 | 167 | **/ |
| 168 | 168 | function f_insert_head($texte) { |
| 169 | - if (!$GLOBALS['html']) { |
|
| 170 | - return $texte; |
|
| 171 | - } |
|
| 172 | - include_spip('public/admin'); // pour strripos |
|
| 169 | + if (!$GLOBALS['html']) { |
|
| 170 | + return $texte; |
|
| 171 | + } |
|
| 172 | + include_spip('public/admin'); // pour strripos |
|
| 173 | 173 | |
| 174 | - ($pos = stripos($texte, '</head>')) |
|
| 175 | - || ($pos = stripos($texte, '<body>')) |
|
| 176 | - || ($pos = 0); |
|
| 174 | + ($pos = stripos($texte, '</head>')) |
|
| 175 | + || ($pos = stripos($texte, '<body>')) |
|
| 176 | + || ($pos = 0); |
|
| 177 | 177 | |
| 178 | - if (false === strpos(substr($texte, 0, $pos), '<!-- insert_head -->')) { |
|
| 179 | - $insert = "\n" . pipeline('insert_head', '<!-- f_insert_head -->') . "\n"; |
|
| 180 | - $texte = substr_replace($texte, $insert, $pos, 0); |
|
| 181 | - } |
|
| 178 | + if (false === strpos(substr($texte, 0, $pos), '<!-- insert_head -->')) { |
|
| 179 | + $insert = "\n" . pipeline('insert_head', '<!-- f_insert_head -->') . "\n"; |
|
| 180 | + $texte = substr_replace($texte, $insert, $pos, 0); |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - return $texte; |
|
| 183 | + return $texte; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | |
@@ -196,28 +196,28 @@ discard block |
||
| 196 | 196 | * @return string Contenu de la page envoyée au navigateur |
| 197 | 197 | **/ |
| 198 | 198 | function f_admin($texte) { |
| 199 | - if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and $GLOBALS['html']) { |
|
| 200 | - include_spip('inc/filtres'); // pour http_img_pack |
|
| 201 | - $x = "<div class='spip-previsu' " |
|
| 202 | - . http_style_background('preview-32.png') |
|
| 203 | - . ">" |
|
| 204 | - . _T('previsualisation') |
|
| 205 | - . "</div>"; |
|
| 206 | - if (!$pos = stripos($texte, '</body>')) { |
|
| 207 | - $pos = strlen($texte); |
|
| 208 | - } |
|
| 209 | - $texte = substr_replace($texte, $x, $pos, 0); |
|
| 210 | - } |
|
| 199 | + if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and $GLOBALS['html']) { |
|
| 200 | + include_spip('inc/filtres'); // pour http_img_pack |
|
| 201 | + $x = "<div class='spip-previsu' " |
|
| 202 | + . http_style_background('preview-32.png') |
|
| 203 | + . ">" |
|
| 204 | + . _T('previsualisation') |
|
| 205 | + . "</div>"; |
|
| 206 | + if (!$pos = stripos($texte, '</body>')) { |
|
| 207 | + $pos = strlen($texte); |
|
| 208 | + } |
|
| 209 | + $texte = substr_replace($texte, $x, $pos, 0); |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - if (isset($GLOBALS['affiche_boutons_admin']) and $GLOBALS['affiche_boutons_admin']) { |
|
| 213 | - include_spip('public/admin'); |
|
| 214 | - $texte = affiche_boutons_admin($texte); |
|
| 215 | - } |
|
| 216 | - if (_request('var_mode') == 'noajax') { |
|
| 217 | - $texte = preg_replace(',(class=[\'"][^\'"]*)ajax([^\'"]*[\'"]),Uims', "\\1\\2", $texte); |
|
| 218 | - } |
|
| 212 | + if (isset($GLOBALS['affiche_boutons_admin']) and $GLOBALS['affiche_boutons_admin']) { |
|
| 213 | + include_spip('public/admin'); |
|
| 214 | + $texte = affiche_boutons_admin($texte); |
|
| 215 | + } |
|
| 216 | + if (_request('var_mode') == 'noajax') { |
|
| 217 | + $texte = preg_replace(',(class=[\'"][^\'"]*)ajax([^\'"]*[\'"]),Uims', "\\1\\2", $texte); |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | - return $texte; |
|
| 220 | + return $texte; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
@@ -235,11 +235,11 @@ discard block |
||
| 235 | 235 | * @return array $flux Description et contenu de l'inclusion |
| 236 | 236 | **/ |
| 237 | 237 | function f_recuperer_fond($flux) { |
| 238 | - if (!test_espace_prive()) { |
|
| 239 | - return $flux; |
|
| 240 | - } |
|
| 238 | + if (!test_espace_prive()) { |
|
| 239 | + return $flux; |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | - return f_afficher_blocs_ecrire($flux); |
|
| 242 | + return f_afficher_blocs_ecrire($flux); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -253,29 +253,29 @@ discard block |
||
| 253 | 253 | * @return string Contenu de la page envoyée au navigateur |
| 254 | 254 | */ |
| 255 | 255 | function f_queue($texte) { |
| 256 | - // eviter une inclusion si rien a faire |
|
| 257 | - if (_request('action') == 'cron' |
|
| 258 | - or queue_sleep_time_to_next_job() > 0 |
|
| 259 | - or defined('_DEBUG_BLOCK_QUEUE') |
|
| 260 | - ) { |
|
| 261 | - return $texte; |
|
| 262 | - } |
|
| 256 | + // eviter une inclusion si rien a faire |
|
| 257 | + if (_request('action') == 'cron' |
|
| 258 | + or queue_sleep_time_to_next_job() > 0 |
|
| 259 | + or defined('_DEBUG_BLOCK_QUEUE') |
|
| 260 | + ) { |
|
| 261 | + return $texte; |
|
| 262 | + } |
|
| 263 | 263 | |
| 264 | - include_spip('inc/queue'); |
|
| 265 | - $code = queue_affichage_cron(); |
|
| 264 | + include_spip('inc/queue'); |
|
| 265 | + $code = queue_affichage_cron(); |
|
| 266 | 266 | |
| 267 | - // si rien a afficher |
|
| 268 | - // ou si on est pas dans une page html, on ne sait rien faire de mieux |
|
| 269 | - if (!$code or !isset($GLOBALS['html']) or !$GLOBALS['html']) { |
|
| 270 | - return $texte; |
|
| 271 | - } |
|
| 267 | + // si rien a afficher |
|
| 268 | + // ou si on est pas dans une page html, on ne sait rien faire de mieux |
|
| 269 | + if (!$code or !isset($GLOBALS['html']) or !$GLOBALS['html']) { |
|
| 270 | + return $texte; |
|
| 271 | + } |
|
| 272 | 272 | |
| 273 | - // inserer avant le </body> fermant si on peut, a la fin de la page sinon |
|
| 274 | - if (($p = strpos($texte, '</body>')) !== false) { |
|
| 275 | - $texte = substr($texte, 0, $p) . $code . substr($texte, $p); |
|
| 276 | - } else { |
|
| 277 | - $texte .= $code; |
|
| 278 | - } |
|
| 273 | + // inserer avant le </body> fermant si on peut, a la fin de la page sinon |
|
| 274 | + if (($p = strpos($texte, '</body>')) !== false) { |
|
| 275 | + $texte = substr($texte, 0, $p) . $code . substr($texte, $p); |
|
| 276 | + } else { |
|
| 277 | + $texte .= $code; |
|
| 278 | + } |
|
| 279 | 279 | |
| 280 | - return $texte; |
|
| 280 | + return $texte; |
|
| 281 | 281 | } |
@@ -298,9 +298,9 @@ |
||
| 298 | 298 | and ($e = $flux['args']['contexte']['_etape']) > 1 |
| 299 | 299 | and $ext = $flux['args']['ext'] |
| 300 | 300 | and $f = $flux['data'] |
| 301 | - and file_exists($f . "_$e.$ext") |
|
| 301 | + and file_exists($f."_$e.$ext") |
|
| 302 | 302 | ) { |
| 303 | - $flux['data'] = $f . "_$e"; |
|
| 303 | + $flux['data'] = $f."_$e"; |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | return $flux; |
@@ -92,10 +92,12 @@ |
||
| 92 | 92 | $store = &$_GET; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - foreach ($c as $k => $v) // on ecrase pas si saisi a nouveau ! |
|
| 95 | + foreach ($c as $k => $v) { |
|
| 96 | + // on ecrase pas si saisi a nouveau ! |
|
| 96 | 97 | { |
| 97 | 98 | if (!isset($store[$k])) { |
| 98 | 99 | $_REQUEST[$k] = $store[$k] = $v; |
| 100 | + } |
|
| 99 | 101 | } // mais si tableau des deux cotes, on merge avec priorite a la derniere saisie |
| 100 | 102 | elseif (is_array($store[$k]) |
| 101 | 103 | and is_array($v) |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | |
| 68 | 68 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 69 | - return; |
|
| 69 | + return; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -77,45 +77,45 @@ discard block |
||
| 77 | 77 | * @return array |
| 78 | 78 | */ |
| 79 | 79 | function cvtmulti_recuperer_post_precedents($form) { |
| 80 | - include_spip('inc/filtres'); |
|
| 81 | - if ($form |
|
| 82 | - and $c = _request('cvtm_prev_post') |
|
| 83 | - and $c = decoder_contexte_ajax($c, $form) |
|
| 84 | - ) { |
|
| 85 | - #var_dump($c); |
|
| 80 | + include_spip('inc/filtres'); |
|
| 81 | + if ($form |
|
| 82 | + and $c = _request('cvtm_prev_post') |
|
| 83 | + and $c = decoder_contexte_ajax($c, $form) |
|
| 84 | + ) { |
|
| 85 | + #var_dump($c); |
|
| 86 | 86 | |
| 87 | - # reinjecter dans la bonne variable pour permettre de retrouver |
|
| 88 | - # toutes les saisies dans un seul tableau |
|
| 89 | - if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 90 | - $store = &$_POST; |
|
| 91 | - } else { |
|
| 92 | - $store = &$_GET; |
|
| 93 | - } |
|
| 87 | + # reinjecter dans la bonne variable pour permettre de retrouver |
|
| 88 | + # toutes les saisies dans un seul tableau |
|
| 89 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 90 | + $store = &$_POST; |
|
| 91 | + } else { |
|
| 92 | + $store = &$_GET; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - foreach ($c as $k => $v) // on ecrase pas si saisi a nouveau ! |
|
| 96 | - { |
|
| 97 | - if (!isset($store[$k])) { |
|
| 98 | - $_REQUEST[$k] = $store[$k] = $v; |
|
| 99 | - } // mais si tableau des deux cotes, on merge avec priorite a la derniere saisie |
|
| 100 | - elseif (is_array($store[$k]) |
|
| 101 | - and is_array($v) |
|
| 102 | - and $z = array_keys($v) |
|
| 103 | - and !is_numeric(reset($z)) |
|
| 104 | - and $z = array_keys($store[$k]) |
|
| 105 | - and !is_numeric(reset($z)) |
|
| 106 | - ) { |
|
| 107 | - $_REQUEST[$k] = $store[$k] = array_merge($v, $store[$k]); |
|
| 108 | - } |
|
| 109 | - } |
|
| 95 | + foreach ($c as $k => $v) // on ecrase pas si saisi a nouveau ! |
|
| 96 | + { |
|
| 97 | + if (!isset($store[$k])) { |
|
| 98 | + $_REQUEST[$k] = $store[$k] = $v; |
|
| 99 | + } // mais si tableau des deux cotes, on merge avec priorite a la derniere saisie |
|
| 100 | + elseif (is_array($store[$k]) |
|
| 101 | + and is_array($v) |
|
| 102 | + and $z = array_keys($v) |
|
| 103 | + and !is_numeric(reset($z)) |
|
| 104 | + and $z = array_keys($store[$k]) |
|
| 105 | + and !is_numeric(reset($z)) |
|
| 106 | + ) { |
|
| 107 | + $_REQUEST[$k] = $store[$k] = array_merge($v, $store[$k]); |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - // vider pour eviter un second appel a verifier_n |
|
| 112 | - // en cas de double implementation (unipotence) |
|
| 113 | - set_request('cvtm_prev_post'); |
|
| 111 | + // vider pour eviter un second appel a verifier_n |
|
| 112 | + // en cas de double implementation (unipotence) |
|
| 113 | + set_request('cvtm_prev_post'); |
|
| 114 | 114 | |
| 115 | - return array($c['_etape'], $c['_etapes']); |
|
| 116 | - } |
|
| 115 | + return array($c['_etape'], $c['_etapes']); |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - return false; |
|
| 118 | + return false; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -128,28 +128,28 @@ discard block |
||
| 128 | 128 | * @return array |
| 129 | 129 | */ |
| 130 | 130 | function cvtmulti_sauver_post($form, $je_suis_poste, &$valeurs) { |
| 131 | - if (!isset($valeurs['_cvtm_prev_post'])) { |
|
| 132 | - $post = array('_etape' => $valeurs['_etape'], '_etapes' => $valeurs['_etapes']); |
|
| 133 | - foreach (array_keys($valeurs) as $champ) { |
|
| 134 | - if (substr($champ, 0, 1) !== '_') { |
|
| 135 | - if ($je_suis_poste || (isset($valeurs['_forcer_request']) && $valeurs['_forcer_request'])) { |
|
| 136 | - if (($v = _request($champ)) !== null) { |
|
| 137 | - $post[$champ] = $v; |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - } |
|
| 141 | - } |
|
| 142 | - include_spip('inc/filtres'); |
|
| 143 | - $c = encoder_contexte_ajax($post, $form); |
|
| 144 | - if (!isset($valeurs['_hidden'])) { |
|
| 145 | - $valeurs['_hidden'] = ''; |
|
| 146 | - } |
|
| 147 | - $valeurs['_hidden'] .= "<input type='hidden' name='cvtm_prev_post' value='$c' />"; |
|
| 148 | - // marquer comme fait, pour eviter double encodage (unipotence) |
|
| 149 | - $valeurs['_cvtm_prev_post'] = true; |
|
| 150 | - } |
|
| 131 | + if (!isset($valeurs['_cvtm_prev_post'])) { |
|
| 132 | + $post = array('_etape' => $valeurs['_etape'], '_etapes' => $valeurs['_etapes']); |
|
| 133 | + foreach (array_keys($valeurs) as $champ) { |
|
| 134 | + if (substr($champ, 0, 1) !== '_') { |
|
| 135 | + if ($je_suis_poste || (isset($valeurs['_forcer_request']) && $valeurs['_forcer_request'])) { |
|
| 136 | + if (($v = _request($champ)) !== null) { |
|
| 137 | + $post[$champ] = $v; |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + } |
|
| 141 | + } |
|
| 142 | + include_spip('inc/filtres'); |
|
| 143 | + $c = encoder_contexte_ajax($post, $form); |
|
| 144 | + if (!isset($valeurs['_hidden'])) { |
|
| 145 | + $valeurs['_hidden'] = ''; |
|
| 146 | + } |
|
| 147 | + $valeurs['_hidden'] .= "<input type='hidden' name='cvtm_prev_post' value='$c' />"; |
|
| 148 | + // marquer comme fait, pour eviter double encodage (unipotence) |
|
| 149 | + $valeurs['_cvtm_prev_post'] = true; |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - return $valeurs; |
|
| 152 | + return $valeurs; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -162,13 +162,13 @@ discard block |
||
| 162 | 162 | * @return array |
| 163 | 163 | */ |
| 164 | 164 | function cvtmulti_formulaire_charger($flux) { |
| 165 | - if (is_array($flux['data']) |
|
| 166 | - and isset($flux['data']['_etapes']) |
|
| 167 | - ) { |
|
| 168 | - $flux['data'] = cvtmulti_formulaire_charger_etapes($flux['args'], $flux['data']); |
|
| 169 | - } |
|
| 165 | + if (is_array($flux['data']) |
|
| 166 | + and isset($flux['data']['_etapes']) |
|
| 167 | + ) { |
|
| 168 | + $flux['data'] = cvtmulti_formulaire_charger_etapes($flux['args'], $flux['data']); |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - return $flux; |
|
| 171 | + return $flux; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -178,19 +178,19 @@ discard block |
||
| 178 | 178 | * @return array |
| 179 | 179 | */ |
| 180 | 180 | function cvtmulti_formulaire_charger_etapes($args, $valeurs) { |
| 181 | - if (!isset($valeurs['_etape'])) { |
|
| 182 | - $form = $args['form']; |
|
| 183 | - $je_suis_poste = $args['je_suis_poste']; |
|
| 184 | - $nb_etapes = $valeurs['_etapes']; |
|
| 185 | - $etape = _request('_etape'); |
|
| 186 | - $etape = min(max($etape, 1), $nb_etapes); |
|
| 187 | - set_request('_etape', $etape); |
|
| 188 | - $valeurs['_etape'] = $etape; |
|
| 181 | + if (!isset($valeurs['_etape'])) { |
|
| 182 | + $form = $args['form']; |
|
| 183 | + $je_suis_poste = $args['je_suis_poste']; |
|
| 184 | + $nb_etapes = $valeurs['_etapes']; |
|
| 185 | + $etape = _request('_etape'); |
|
| 186 | + $etape = min(max($etape, 1), $nb_etapes); |
|
| 187 | + set_request('_etape', $etape); |
|
| 188 | + $valeurs['_etape'] = $etape; |
|
| 189 | 189 | |
| 190 | - // sauver les posts de cette etape pour les avoir a la prochaine etape |
|
| 191 | - $valeurs = cvtmulti_sauver_post($form, $je_suis_poste, $valeurs); |
|
| 192 | - } |
|
| 193 | - return $valeurs; |
|
| 190 | + // sauver les posts de cette etape pour les avoir a la prochaine etape |
|
| 191 | + $valeurs = cvtmulti_sauver_post($form, $je_suis_poste, $valeurs); |
|
| 192 | + } |
|
| 193 | + return $valeurs; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | * @return array |
| 203 | 203 | */ |
| 204 | 204 | function cvtmulti_formulaire_verifier($flux) { |
| 205 | - $flux['data'] = cvtmulti_formulaire_verifier_etapes($flux['args'], $flux['data']); |
|
| 206 | - return $flux; |
|
| 205 | + $flux['data'] = cvtmulti_formulaire_verifier_etapes($flux['args'], $flux['data']); |
|
| 206 | + return $flux; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -214,75 +214,75 @@ discard block |
||
| 214 | 214 | * @return array |
| 215 | 215 | */ |
| 216 | 216 | function cvtmulti_formulaire_verifier_etapes($args, $erreurs) { |
| 217 | - #var_dump('Pipe verifier'); |
|
| 217 | + #var_dump('Pipe verifier'); |
|
| 218 | 218 | |
| 219 | - if ($form = $args['form'] |
|
| 220 | - and ($e = cvtmulti_recuperer_post_precedents($form)) !== false |
|
| 221 | - ) { |
|
| 222 | - // recuperer l'etape saisie et le nombre d'etapes total |
|
| 223 | - list($etape, $etapes) = $e; |
|
| 224 | - $etape_demandee = _request('aller_a_etape'); // possibilite de poster en entier dans aller_a_etape |
|
| 219 | + if ($form = $args['form'] |
|
| 220 | + and ($e = cvtmulti_recuperer_post_precedents($form)) !== false |
|
| 221 | + ) { |
|
| 222 | + // recuperer l'etape saisie et le nombre d'etapes total |
|
| 223 | + list($etape, $etapes) = $e; |
|
| 224 | + $etape_demandee = _request('aller_a_etape'); // possibilite de poster en entier dans aller_a_etape |
|
| 225 | 225 | |
| 226 | - // lancer les verifs pour chaque etape deja saisie de 1 a $etape |
|
| 227 | - $erreurs_etapes = array(); |
|
| 228 | - $derniere_etape_ok = 0; |
|
| 229 | - $e = 0; |
|
| 230 | - while ($e < $etape and $e < $etapes) { |
|
| 231 | - $e++; |
|
| 232 | - $erreurs_etapes[$e] = array(); |
|
| 233 | - if ($verifier = charger_fonction("verifier_$e", "formulaires/$form/", true)) { |
|
| 234 | - $erreurs_etapes[$e] = call_user_func_array($verifier, $args['args']); |
|
| 235 | - } elseif ($verifier = charger_fonction("verifier_etape", "formulaires/$form/", true)) { |
|
| 236 | - $a = $args['args']; |
|
| 237 | - array_unshift($a, $e); |
|
| 238 | - $erreurs_etapes[$e] = call_user_func_array($verifier, $a); |
|
| 239 | - } |
|
| 240 | - // et on appelle un pipeline dedie aux etapes, plus easy |
|
| 241 | - $args['etape'] = $e; |
|
| 242 | - $erreurs_etapes[$e] = pipeline( |
|
| 243 | - 'formulaire_verifier_etape', |
|
| 244 | - array( |
|
| 245 | - 'args' => $args, |
|
| 246 | - 'data' => $erreurs_etapes[$e] |
|
| 247 | - ) |
|
| 248 | - ); |
|
| 226 | + // lancer les verifs pour chaque etape deja saisie de 1 a $etape |
|
| 227 | + $erreurs_etapes = array(); |
|
| 228 | + $derniere_etape_ok = 0; |
|
| 229 | + $e = 0; |
|
| 230 | + while ($e < $etape and $e < $etapes) { |
|
| 231 | + $e++; |
|
| 232 | + $erreurs_etapes[$e] = array(); |
|
| 233 | + if ($verifier = charger_fonction("verifier_$e", "formulaires/$form/", true)) { |
|
| 234 | + $erreurs_etapes[$e] = call_user_func_array($verifier, $args['args']); |
|
| 235 | + } elseif ($verifier = charger_fonction("verifier_etape", "formulaires/$form/", true)) { |
|
| 236 | + $a = $args['args']; |
|
| 237 | + array_unshift($a, $e); |
|
| 238 | + $erreurs_etapes[$e] = call_user_func_array($verifier, $a); |
|
| 239 | + } |
|
| 240 | + // et on appelle un pipeline dedie aux etapes, plus easy |
|
| 241 | + $args['etape'] = $e; |
|
| 242 | + $erreurs_etapes[$e] = pipeline( |
|
| 243 | + 'formulaire_verifier_etape', |
|
| 244 | + array( |
|
| 245 | + 'args' => $args, |
|
| 246 | + 'data' => $erreurs_etapes[$e] |
|
| 247 | + ) |
|
| 248 | + ); |
|
| 249 | 249 | |
| 250 | - if ($derniere_etape_ok == $e - 1 and !count($erreurs_etapes[$e])) { |
|
| 251 | - $derniere_etape_ok = $e; |
|
| 252 | - } |
|
| 253 | - // possibilite de poster dans _retour_etape_x |
|
| 254 | - if (!is_null(_request("_retour_etape_$e"))) { |
|
| 255 | - $etape_demandee = $e; |
|
| 256 | - } |
|
| 257 | - } |
|
| 250 | + if ($derniere_etape_ok == $e - 1 and !count($erreurs_etapes[$e])) { |
|
| 251 | + $derniere_etape_ok = $e; |
|
| 252 | + } |
|
| 253 | + // possibilite de poster dans _retour_etape_x |
|
| 254 | + if (!is_null(_request("_retour_etape_$e"))) { |
|
| 255 | + $etape_demandee = $e; |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | - // si la derniere etape OK etait la derniere |
|
| 260 | - // on renvoie le flux inchange et ca declenche traiter |
|
| 261 | - if ($derniere_etape_ok == $etapes and !$etape_demandee) { |
|
| 262 | - return $erreurs; |
|
| 263 | - } else { |
|
| 264 | - $etape = $derniere_etape_ok + 1; |
|
| 265 | - if ($etape_demandee > 0 and $etape_demandee < $etape) { |
|
| 266 | - $etape = $etape_demandee; |
|
| 267 | - } |
|
| 268 | - $etape = min($etape, $etapes); |
|
| 269 | - #var_dump("prochaine etape $etape"); |
|
| 270 | - // retourner les erreurs de l'etape ciblee |
|
| 271 | - $erreurs = isset($erreurs_etapes[$etape]) ? $erreurs_etapes[$etape] : array(); |
|
| 272 | - // Ne pas se tromper dans le texte du message d'erreur : la clé '_etapes' n'est pas une erreur ! |
|
| 273 | - if ($erreurs) { |
|
| 274 | - if (empty($erreurs['message_erreur'])) { |
|
| 275 | - $erreurs['message_erreur'] = singulier_ou_pluriel(count($erreurs), 'avis_1_erreur_saisie', 'avis_nb_erreurs_saisie'); |
|
| 276 | - } |
|
| 277 | - } else { |
|
| 278 | - $erreurs['message_erreur'] = ''; |
|
| 279 | - } |
|
| 280 | - $erreurs['_etapes'] = "etape suivante $etape"; |
|
| 281 | - set_request('_etape', $etape); |
|
| 282 | - } |
|
| 283 | - } |
|
| 259 | + // si la derniere etape OK etait la derniere |
|
| 260 | + // on renvoie le flux inchange et ca declenche traiter |
|
| 261 | + if ($derniere_etape_ok == $etapes and !$etape_demandee) { |
|
| 262 | + return $erreurs; |
|
| 263 | + } else { |
|
| 264 | + $etape = $derniere_etape_ok + 1; |
|
| 265 | + if ($etape_demandee > 0 and $etape_demandee < $etape) { |
|
| 266 | + $etape = $etape_demandee; |
|
| 267 | + } |
|
| 268 | + $etape = min($etape, $etapes); |
|
| 269 | + #var_dump("prochaine etape $etape"); |
|
| 270 | + // retourner les erreurs de l'etape ciblee |
|
| 271 | + $erreurs = isset($erreurs_etapes[$etape]) ? $erreurs_etapes[$etape] : array(); |
|
| 272 | + // Ne pas se tromper dans le texte du message d'erreur : la clé '_etapes' n'est pas une erreur ! |
|
| 273 | + if ($erreurs) { |
|
| 274 | + if (empty($erreurs['message_erreur'])) { |
|
| 275 | + $erreurs['message_erreur'] = singulier_ou_pluriel(count($erreurs), 'avis_1_erreur_saisie', 'avis_nb_erreurs_saisie'); |
|
| 276 | + } |
|
| 277 | + } else { |
|
| 278 | + $erreurs['message_erreur'] = ''; |
|
| 279 | + } |
|
| 280 | + $erreurs['_etapes'] = "etape suivante $etape"; |
|
| 281 | + set_request('_etape', $etape); |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | 284 | |
| 285 | - return $erreurs; |
|
| 285 | + return $erreurs; |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /** |
@@ -294,16 +294,16 @@ discard block |
||
| 294 | 294 | * @return array |
| 295 | 295 | */ |
| 296 | 296 | function cvtmulti_styliser($flux) { |
| 297 | - if (strncmp($flux['args']['fond'], 'formulaires/', 12) == 0 |
|
| 298 | - and isset($flux['args']['contexte']['_etapes']) |
|
| 299 | - and isset($flux['args']['contexte']['_etape']) |
|
| 300 | - and ($e = $flux['args']['contexte']['_etape']) > 1 |
|
| 301 | - and $ext = $flux['args']['ext'] |
|
| 302 | - and $f = $flux['data'] |
|
| 303 | - and file_exists($f . "_$e.$ext") |
|
| 304 | - ) { |
|
| 305 | - $flux['data'] = $f . "_$e"; |
|
| 306 | - } |
|
| 297 | + if (strncmp($flux['args']['fond'], 'formulaires/', 12) == 0 |
|
| 298 | + and isset($flux['args']['contexte']['_etapes']) |
|
| 299 | + and isset($flux['args']['contexte']['_etape']) |
|
| 300 | + and ($e = $flux['args']['contexte']['_etape']) > 1 |
|
| 301 | + and $ext = $flux['args']['ext'] |
|
| 302 | + and $f = $flux['data'] |
|
| 303 | + and file_exists($f . "_$e.$ext") |
|
| 304 | + ) { |
|
| 305 | + $flux['data'] = $f . "_$e"; |
|
| 306 | + } |
|
| 307 | 307 | |
| 308 | - return $flux; |
|
| 308 | + return $flux; |
|
| 309 | 309 | } |
@@ -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'])) { |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | $boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position) |
| 112 | 112 | + array( |
| 113 | 113 | $id => new Bouton( |
| 114 | - ($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '', // icone |
|
| 115 | - $infos['titre'], // titre |
|
| 114 | + ($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '', // icone |
|
| 115 | + $infos['titre'], // titre |
|
| 116 | 116 | (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
| 117 | 117 | (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
| 118 | 118 | ) |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | $boutons_admin = array_slice($boutons_admin, 0, $position) |
| 129 | 129 | + array( |
| 130 | 130 | $id => new Bouton( |
| 131 | - ($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '', // icone |
|
| 132 | - $infos['titre'], // titre |
|
| 131 | + ($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '', // icone |
|
| 132 | + $infos['titre'], // titre |
|
| 133 | 133 | (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
| 134 | 134 | (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
| 135 | 135 | ) |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $libelles = $isfavoris = $favoris = array(); |
| 171 | 171 | foreach ($menu->sousmenu as $key => $item) { |
| 172 | 172 | $libelles[$key] = strtolower(translitteration(_T($item->libelle))); |
| 173 | - $isfavoris[$key] = (bool)$item->favori; |
|
| 173 | + $isfavoris[$key] = (bool) $item->favori; |
|
| 174 | 174 | $favoris[$key] = $item->favori; |
| 175 | 175 | } |
| 176 | 176 | if ($avec_favoris) { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $url = str_replace('&', '&', $url); |
| 213 | 213 | while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) { |
| 214 | 214 | if ($matches[2] == 'id_secteur' and !isset($contexte['id_secteur']) and isset($contexte['id_rubrique'])) { |
| 215 | - $contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($contexte['id_rubrique'])); |
|
| 215 | + $contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.intval($contexte['id_rubrique'])); |
|
| 216 | 216 | } |
| 217 | 217 | $val = _request($matches[2], $contexte); |
| 218 | 218 | $url = parametre_url($url, $matches[1], $val ? $val : '', '&'); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/boutons'); |
@@ -37,33 +37,33 @@ discard block |
||
| 37 | 37 | * Contexte |
| 38 | 38 | **/ |
| 39 | 39 | function definir_barre_contexte($contexte = null) { |
| 40 | - if (is_null($contexte)) { |
|
| 41 | - $contexte = $_GET; |
|
| 42 | - } elseif (is_string($contexte)) { |
|
| 43 | - $contexte = unserialize($contexte); |
|
| 44 | - } |
|
| 45 | - if (!isset($contexte['id_rubrique']) and isset($contexte['exec'])) { |
|
| 46 | - if (!function_exists('trouver_objet_exec')) { |
|
| 47 | - include_spip('inc/pipelines_ecrire'); |
|
| 48 | - } |
|
| 49 | - if ($e = trouver_objet_exec($contexte['exec'])) { |
|
| 50 | - $_id = $e['id_table_objet']; |
|
| 51 | - if (isset($contexte[$_id]) and $id = intval($contexte[$_id])) { |
|
| 52 | - $table = $e['table_objet_sql']; |
|
| 53 | - $row = sql_fetsel('*', $table, "$_id=" . intval($id)); |
|
| 54 | - if (isset($row['id_rubrique'])) { |
|
| 55 | - $contexte['id_rubrique'] = $row['id_rubrique']; |
|
| 56 | - if (isset($row['id_secteur'])) { |
|
| 57 | - $contexte['id_secteur'] = $row['id_secteur']; |
|
| 58 | - } |
|
| 59 | - } elseif (isset($row['id_groupe'])) { |
|
| 60 | - // TODO supprimer ce bloc quand https://core.spip.net/issues/3844 sera réalisé |
|
| 61 | - $contexte['id_groupe'] = $row['id_groupe']; |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - return $contexte; |
|
| 40 | + if (is_null($contexte)) { |
|
| 41 | + $contexte = $_GET; |
|
| 42 | + } elseif (is_string($contexte)) { |
|
| 43 | + $contexte = unserialize($contexte); |
|
| 44 | + } |
|
| 45 | + if (!isset($contexte['id_rubrique']) and isset($contexte['exec'])) { |
|
| 46 | + if (!function_exists('trouver_objet_exec')) { |
|
| 47 | + include_spip('inc/pipelines_ecrire'); |
|
| 48 | + } |
|
| 49 | + if ($e = trouver_objet_exec($contexte['exec'])) { |
|
| 50 | + $_id = $e['id_table_objet']; |
|
| 51 | + if (isset($contexte[$_id]) and $id = intval($contexte[$_id])) { |
|
| 52 | + $table = $e['table_objet_sql']; |
|
| 53 | + $row = sql_fetsel('*', $table, "$_id=" . intval($id)); |
|
| 54 | + if (isset($row['id_rubrique'])) { |
|
| 55 | + $contexte['id_rubrique'] = $row['id_rubrique']; |
|
| 56 | + if (isset($row['id_secteur'])) { |
|
| 57 | + $contexte['id_secteur'] = $row['id_secteur']; |
|
| 58 | + } |
|
| 59 | + } elseif (isset($row['id_groupe'])) { |
|
| 60 | + // TODO supprimer ce bloc quand https://core.spip.net/issues/3844 sera réalisé |
|
| 61 | + $contexte['id_groupe'] = $row['id_groupe']; |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + return $contexte; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -79,88 +79,88 @@ discard block |
||
| 79 | 79 | * @return array |
| 80 | 80 | */ |
| 81 | 81 | function definir_barre_boutons($contexte = array(), $icones = true, $autorise = true) { |
| 82 | - include_spip('inc/autoriser'); |
|
| 83 | - $boutons_admin = array(); |
|
| 82 | + include_spip('inc/autoriser'); |
|
| 83 | + $boutons_admin = array(); |
|
| 84 | 84 | |
| 85 | - // les boutons du core, issus de prive/navigation.xml |
|
| 86 | - $liste_boutons = array(); |
|
| 85 | + // les boutons du core, issus de prive/navigation.xml |
|
| 86 | + $liste_boutons = array(); |
|
| 87 | 87 | |
| 88 | - // ajouter les boutons issus des plugin via plugin.xml |
|
| 89 | - if (function_exists('boutons_plugins') |
|
| 90 | - and is_array($liste_boutons_plugins = boutons_plugins()) |
|
| 91 | - ) { |
|
| 92 | - $liste_boutons = &$liste_boutons_plugins; |
|
| 93 | - } |
|
| 88 | + // ajouter les boutons issus des plugin via plugin.xml |
|
| 89 | + if (function_exists('boutons_plugins') |
|
| 90 | + and is_array($liste_boutons_plugins = boutons_plugins()) |
|
| 91 | + ) { |
|
| 92 | + $liste_boutons = &$liste_boutons_plugins; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - foreach ($liste_boutons as $id => $infos) { |
|
| 96 | - $parent = ''; |
|
| 97 | - // les boutons principaux ne sont pas soumis a autorisation |
|
| 98 | - if (!isset($infos['parent']) |
|
| 99 | - or !($parent = $infos['parent']) |
|
| 100 | - or !$autorise |
|
| 101 | - or autoriser('menu', "_$id", 0, null, array('contexte' => $contexte)) |
|
| 102 | - ) { |
|
| 103 | - if ($parent |
|
| 104 | - and $parent = preg_replace(',^bando_,', 'menu_', $parent) |
|
| 105 | - and isset($boutons_admin[$parent]) |
|
| 106 | - ) { |
|
| 107 | - if (!is_array($boutons_admin[$parent]->sousmenu)) { |
|
| 108 | - $boutons_admin[$parent]->sousmenu = array(); |
|
| 109 | - } |
|
| 110 | - $position = (isset($infos['position']) and strlen($infos['position'])) ? intval($infos['position']) : count($boutons_admin[$parent]->sousmenu); |
|
| 111 | - if ($position < 0) { |
|
| 112 | - $position = count($boutons_admin[$parent]->sousmenu) + 1 + $position; |
|
| 113 | - } |
|
| 114 | - $boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position) |
|
| 115 | - + array( |
|
| 116 | - $id => new Bouton( |
|
| 117 | - ($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '', // icone |
|
| 118 | - $infos['titre'], // titre |
|
| 119 | - (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
|
| 120 | - (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
|
| 121 | - ) |
|
| 122 | - ) |
|
| 123 | - + array_slice($boutons_admin[$parent]->sousmenu, $position, 100); |
|
| 124 | - } |
|
| 125 | - if (!$parent |
|
| 126 | - // provisoire, eviter les vieux boutons |
|
| 127 | - and (!in_array($id, array('forum', 'statistiques_visites'))) |
|
| 128 | - and (!$autorise or autoriser('menugrandeentree', "_$id", 0, null, array('contexte' => $contexte))) |
|
| 129 | - ) { |
|
| 130 | - $position = (isset($infos['position']) and $infos['position']) ? $infos['position'] : count($boutons_admin); |
|
| 131 | - $boutons_admin = array_slice($boutons_admin, 0, $position) |
|
| 132 | - + array( |
|
| 133 | - $id => new Bouton( |
|
| 134 | - ($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '', // icone |
|
| 135 | - $infos['titre'], // titre |
|
| 136 | - (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
|
| 137 | - (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
|
| 138 | - ) |
|
| 139 | - ) |
|
| 140 | - + array_slice($boutons_admin, $position, 100); |
|
| 141 | - } |
|
| 142 | - } |
|
| 143 | - } |
|
| 144 | - $boutons_admin = pipeline('ajouter_menus', $boutons_admin); |
|
| 95 | + foreach ($liste_boutons as $id => $infos) { |
|
| 96 | + $parent = ''; |
|
| 97 | + // les boutons principaux ne sont pas soumis a autorisation |
|
| 98 | + if (!isset($infos['parent']) |
|
| 99 | + or !($parent = $infos['parent']) |
|
| 100 | + or !$autorise |
|
| 101 | + or autoriser('menu', "_$id", 0, null, array('contexte' => $contexte)) |
|
| 102 | + ) { |
|
| 103 | + if ($parent |
|
| 104 | + and $parent = preg_replace(',^bando_,', 'menu_', $parent) |
|
| 105 | + and isset($boutons_admin[$parent]) |
|
| 106 | + ) { |
|
| 107 | + if (!is_array($boutons_admin[$parent]->sousmenu)) { |
|
| 108 | + $boutons_admin[$parent]->sousmenu = array(); |
|
| 109 | + } |
|
| 110 | + $position = (isset($infos['position']) and strlen($infos['position'])) ? intval($infos['position']) : count($boutons_admin[$parent]->sousmenu); |
|
| 111 | + if ($position < 0) { |
|
| 112 | + $position = count($boutons_admin[$parent]->sousmenu) + 1 + $position; |
|
| 113 | + } |
|
| 114 | + $boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position) |
|
| 115 | + + array( |
|
| 116 | + $id => new Bouton( |
|
| 117 | + ($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '', // icone |
|
| 118 | + $infos['titre'], // titre |
|
| 119 | + (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
|
| 120 | + (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
|
| 121 | + ) |
|
| 122 | + ) |
|
| 123 | + + array_slice($boutons_admin[$parent]->sousmenu, $position, 100); |
|
| 124 | + } |
|
| 125 | + if (!$parent |
|
| 126 | + // provisoire, eviter les vieux boutons |
|
| 127 | + and (!in_array($id, array('forum', 'statistiques_visites'))) |
|
| 128 | + and (!$autorise or autoriser('menugrandeentree', "_$id", 0, null, array('contexte' => $contexte))) |
|
| 129 | + ) { |
|
| 130 | + $position = (isset($infos['position']) and $infos['position']) ? $infos['position'] : count($boutons_admin); |
|
| 131 | + $boutons_admin = array_slice($boutons_admin, 0, $position) |
|
| 132 | + + array( |
|
| 133 | + $id => new Bouton( |
|
| 134 | + ($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '', // icone |
|
| 135 | + $infos['titre'], // titre |
|
| 136 | + (isset($infos['action']) and $infos['action']) ? $infos['action'] : null, |
|
| 137 | + (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null |
|
| 138 | + ) |
|
| 139 | + ) |
|
| 140 | + + array_slice($boutons_admin, $position, 100); |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + $boutons_admin = pipeline('ajouter_menus', $boutons_admin); |
|
| 145 | 145 | |
| 146 | - // définir les favoris et positions d’origine |
|
| 147 | - if ($boutons_admin) { |
|
| 148 | - $menus_favoris = obtenir_menus_favoris(); |
|
| 149 | - $i = 1; |
|
| 150 | - foreach ($boutons_admin as $key => $menu) { |
|
| 151 | - $menu->favori = table_valeur($menus_favoris, $key, false); |
|
| 152 | - $menu->position = $i++; |
|
| 153 | - if ($menu->sousmenu) { |
|
| 154 | - $j = 1; |
|
| 155 | - foreach ($menu->sousmenu as $key => $bouton) { |
|
| 156 | - $bouton->favori = table_valeur($menus_favoris, $key, false); |
|
| 157 | - $bouton->position = $j++; |
|
| 158 | - } |
|
| 159 | - } |
|
| 160 | - } |
|
| 161 | - } |
|
| 146 | + // définir les favoris et positions d’origine |
|
| 147 | + if ($boutons_admin) { |
|
| 148 | + $menus_favoris = obtenir_menus_favoris(); |
|
| 149 | + $i = 1; |
|
| 150 | + foreach ($boutons_admin as $key => $menu) { |
|
| 151 | + $menu->favori = table_valeur($menus_favoris, $key, false); |
|
| 152 | + $menu->position = $i++; |
|
| 153 | + if ($menu->sousmenu) { |
|
| 154 | + $j = 1; |
|
| 155 | + foreach ($menu->sousmenu as $key => $bouton) { |
|
| 156 | + $bouton->favori = table_valeur($menus_favoris, $key, false); |
|
| 157 | + $bouton->position = $j++; |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - return $boutons_admin; |
|
| 163 | + return $boutons_admin; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -172,22 +172,22 @@ discard block |
||
| 172 | 172 | * @return Bouton[] |
| 173 | 173 | */ |
| 174 | 174 | function trier_boutons_enfants_par_alpha($menus, $avec_favoris = false) { |
| 175 | - foreach ($menus as $menu) { |
|
| 176 | - if ($menu->sousmenu) { |
|
| 177 | - $libelles = $isfavoris = $favoris = array(); |
|
| 178 | - foreach ($menu->sousmenu as $key => $item) { |
|
| 179 | - $libelles[$key] = strtolower(translitteration(_T($item->libelle))); |
|
| 180 | - $isfavoris[$key] = (bool)$item->favori; |
|
| 181 | - $favoris[$key] = $item->favori; |
|
| 182 | - } |
|
| 183 | - if ($avec_favoris) { |
|
| 184 | - array_multisort($isfavoris, SORT_DESC, $favoris, SORT_ASC, $libelles, SORT_ASC, $menu->sousmenu); |
|
| 185 | - } else { |
|
| 186 | - array_multisort($libelles, SORT_ASC, $menu->sousmenu); |
|
| 187 | - } |
|
| 188 | - } |
|
| 189 | - } |
|
| 190 | - return $menus; |
|
| 175 | + foreach ($menus as $menu) { |
|
| 176 | + if ($menu->sousmenu) { |
|
| 177 | + $libelles = $isfavoris = $favoris = array(); |
|
| 178 | + foreach ($menu->sousmenu as $key => $item) { |
|
| 179 | + $libelles[$key] = strtolower(translitteration(_T($item->libelle))); |
|
| 180 | + $isfavoris[$key] = (bool)$item->favori; |
|
| 181 | + $favoris[$key] = $item->favori; |
|
| 182 | + } |
|
| 183 | + if ($avec_favoris) { |
|
| 184 | + array_multisort($isfavoris, SORT_DESC, $favoris, SORT_ASC, $libelles, SORT_ASC, $menu->sousmenu); |
|
| 185 | + } else { |
|
| 186 | + array_multisort($libelles, SORT_ASC, $menu->sousmenu); |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | + return $menus; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @return Bouton[] |
| 199 | 199 | */ |
| 200 | 200 | function trier_boutons_enfants_par_favoris_alpha($menus) { |
| 201 | - return trier_boutons_enfants_par_alpha($menus, true); |
|
| 201 | + return trier_boutons_enfants_par_alpha($menus, true); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -211,23 +211,23 @@ discard block |
||
| 211 | 211 | * @return string |
| 212 | 212 | */ |
| 213 | 213 | function bandeau_creer_url($url, $args = '', $contexte = null) { |
| 214 | - if (!preg_match(',[\/\?],', $url)) { |
|
| 215 | - $url = generer_url_ecrire($url, $args, true); |
|
| 216 | - // recuperer les parametres du contexte demande par l'url sous la forme |
|
| 217 | - // &truc=@machin@ |
|
| 218 | - // @machin@ etant remplace par _request('machin') |
|
| 219 | - $url = str_replace('&', '&', $url); |
|
| 220 | - while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) { |
|
| 221 | - if ($matches[2] == 'id_secteur' and !isset($contexte['id_secteur']) and isset($contexte['id_rubrique'])) { |
|
| 222 | - $contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($contexte['id_rubrique'])); |
|
| 223 | - } |
|
| 224 | - $val = _request($matches[2], $contexte); |
|
| 225 | - $url = parametre_url($url, $matches[1], $val ? $val : '', '&'); |
|
| 226 | - } |
|
| 227 | - $url = str_replace('&', '&', $url); |
|
| 228 | - } |
|
| 214 | + if (!preg_match(',[\/\?],', $url)) { |
|
| 215 | + $url = generer_url_ecrire($url, $args, true); |
|
| 216 | + // recuperer les parametres du contexte demande par l'url sous la forme |
|
| 217 | + // &truc=@machin@ |
|
| 218 | + // @machin@ etant remplace par _request('machin') |
|
| 219 | + $url = str_replace('&', '&', $url); |
|
| 220 | + while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) { |
|
| 221 | + if ($matches[2] == 'id_secteur' and !isset($contexte['id_secteur']) and isset($contexte['id_rubrique'])) { |
|
| 222 | + $contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($contexte['id_rubrique'])); |
|
| 223 | + } |
|
| 224 | + $val = _request($matches[2], $contexte); |
|
| 225 | + $url = parametre_url($url, $matches[1], $val ? $val : '', '&'); |
|
| 226 | + } |
|
| 227 | + $url = str_replace('&', '&', $url); |
|
| 228 | + } |
|
| 229 | 229 | |
| 230 | - return $url; |
|
| 230 | + return $url; |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * Code HTML du bandeau |
| 238 | 238 | */ |
| 239 | 239 | function inc_bandeau_dist() { |
| 240 | - return recuperer_fond('prive/squelettes/inclure/barre-nav', $_GET); |
|
| 240 | + return recuperer_fond('prive/squelettes/inclure/barre-nav', $_GET); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | |
@@ -246,13 +246,13 @@ discard block |
||
| 246 | 246 | * @return array |
| 247 | 247 | */ |
| 248 | 248 | function obtenir_menus_favoris() { |
| 249 | - if ( |
|
| 250 | - isset($GLOBALS['visiteur_session']['prefs']['menus_favoris']) |
|
| 251 | - and is_array($GLOBALS['visiteur_session']['prefs']['menus_favoris']) |
|
| 252 | - and $GLOBALS['visiteur_session']['prefs']['menus_favoris'] |
|
| 253 | - ) { |
|
| 254 | - return $GLOBALS['visiteur_session']['prefs']['menus_favoris']; |
|
| 255 | - } |
|
| 256 | - $definir_menus_favoris = charger_fonction('definir_menus_favoris', 'inc'); |
|
| 257 | - return $definir_menus_favoris(); |
|
| 249 | + if ( |
|
| 250 | + isset($GLOBALS['visiteur_session']['prefs']['menus_favoris']) |
|
| 251 | + and is_array($GLOBALS['visiteur_session']['prefs']['menus_favoris']) |
|
| 252 | + and $GLOBALS['visiteur_session']['prefs']['menus_favoris'] |
|
| 253 | + ) { |
|
| 254 | + return $GLOBALS['visiteur_session']['prefs']['menus_favoris']; |
|
| 255 | + } |
|
| 256 | + $definir_menus_favoris = charger_fonction('definir_menus_favoris', 'inc'); |
|
| 257 | + return $definir_menus_favoris(); |
|
| 258 | 258 | } |
| 259 | 259 | \ No newline at end of file |
@@ -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 | /** |
@@ -29,49 +29,49 @@ discard block |
||
| 29 | 29 | * @return string Erreur éventuelle |
| 30 | 30 | */ |
| 31 | 31 | function inc_completer_traduction_dist($objet, $id_objet, $id_trad) { |
| 32 | - // dupliquer tous les liens sauf les auteurs : le nouvel auteur est celui qui traduit |
|
| 33 | - // cf API editer_liens |
|
| 34 | - include_spip('action/editer_liens'); |
|
| 35 | - objet_dupliquer_liens($objet, $id_trad, $id_objet, null, array('auteur')); |
|
| 36 | - $_id_table = id_table_objet($objet); |
|
| 32 | + // dupliquer tous les liens sauf les auteurs : le nouvel auteur est celui qui traduit |
|
| 33 | + // cf API editer_liens |
|
| 34 | + include_spip('action/editer_liens'); |
|
| 35 | + objet_dupliquer_liens($objet, $id_trad, $id_objet, null, array('auteur')); |
|
| 36 | + $_id_table = id_table_objet($objet); |
|
| 37 | 37 | |
| 38 | - // recuperer le logo |
|
| 39 | - $chercher_logo = charger_fonction('chercher_logo','inc'); |
|
| 40 | - include_spip('action/editer_logo'); |
|
| 41 | - foreach (array('on', 'off') as $etat) { |
|
| 42 | - $logo = $chercher_logo($id_trad, $_id_table, $etat); |
|
| 43 | - if ($logo AND $file = reset($logo)) { |
|
| 44 | - logo_modifier($objet, $id_objet, $etat, $file); |
|
| 45 | - } |
|
| 46 | - } |
|
| 38 | + // recuperer le logo |
|
| 39 | + $chercher_logo = charger_fonction('chercher_logo','inc'); |
|
| 40 | + include_spip('action/editer_logo'); |
|
| 41 | + foreach (array('on', 'off') as $etat) { |
|
| 42 | + $logo = $chercher_logo($id_trad, $_id_table, $etat); |
|
| 43 | + if ($logo AND $file = reset($logo)) { |
|
| 44 | + logo_modifier($objet, $id_objet, $etat, $file); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - // dupliquer certains champs |
|
| 49 | - $trouver_table = charger_fonction('trouver_table','base'); |
|
| 50 | - $desc = $trouver_table(table_objet_sql($objet)); |
|
| 51 | - $champs = $set = array(); |
|
| 48 | + // dupliquer certains champs |
|
| 49 | + $trouver_table = charger_fonction('trouver_table','base'); |
|
| 50 | + $desc = $trouver_table(table_objet_sql($objet)); |
|
| 51 | + $champs = $set = array(); |
|
| 52 | 52 | |
| 53 | - // un éventuel champ 'virtuel' (redirections) |
|
| 54 | - if (!empty($desc['field']['virtuel'])) { |
|
| 55 | - $champs[] = 'virtuel'; |
|
| 56 | - } |
|
| 53 | + // un éventuel champ 'virtuel' (redirections) |
|
| 54 | + if (!empty($desc['field']['virtuel'])) { |
|
| 55 | + $champs[] = 'virtuel'; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - if ($champs) { |
|
| 59 | - $set = sql_fetsel($champs, $desc['table'], $_id_table . '=' . intval($id_trad)); |
|
| 60 | - } |
|
| 58 | + if ($champs) { |
|
| 59 | + $set = sql_fetsel($champs, $desc['table'], $_id_table . '=' . intval($id_trad)); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /* |
|
| 62 | + /* |
|
| 63 | 63 | * Le pipeline 'pre_edition' sera appelé avec l'action 'completer_traduction'. |
| 64 | 64 | * Des plugins pourront ainsi compléter les champs d'un objet traduit lors d'une nouvelle traduction. |
| 65 | 65 | */ |
| 66 | - $err = objet_modifier_champs( |
|
| 67 | - $objet, |
|
| 68 | - $id_objet, |
|
| 69 | - array( |
|
| 70 | - 'data' => $set, |
|
| 71 | - 'action' => 'completer_traduction', |
|
| 72 | - ), |
|
| 73 | - $set |
|
| 74 | - ); |
|
| 66 | + $err = objet_modifier_champs( |
|
| 67 | + $objet, |
|
| 68 | + $id_objet, |
|
| 69 | + array( |
|
| 70 | + 'data' => $set, |
|
| 71 | + 'action' => 'completer_traduction', |
|
| 72 | + ), |
|
| 73 | + $set |
|
| 74 | + ); |
|
| 75 | 75 | |
| 76 | - return $err; |
|
| 76 | + return $err; |
|
| 77 | 77 | } |
| 78 | 78 | \ No newline at end of file |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $_id_table = id_table_objet($objet); |
| 37 | 37 | |
| 38 | 38 | // recuperer le logo |
| 39 | - $chercher_logo = charger_fonction('chercher_logo','inc'); |
|
| 39 | + $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 40 | 40 | include_spip('action/editer_logo'); |
| 41 | 41 | foreach (array('on', 'off') as $etat) { |
| 42 | 42 | $logo = $chercher_logo($id_trad, $_id_table, $etat); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // dupliquer certains champs |
| 49 | - $trouver_table = charger_fonction('trouver_table','base'); |
|
| 49 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 50 | 50 | $desc = $trouver_table(table_objet_sql($objet)); |
| 51 | 51 | $champs = $set = array(); |
| 52 | 52 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | if ($champs) { |
| 59 | - $set = sql_fetsel($champs, $desc['table'], $_id_table . '=' . intval($id_trad)); |
|
| 59 | + $set = sql_fetsel($champs, $desc['table'], $_id_table.'='.intval($id_trad)); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /* |
@@ -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 | /** |
@@ -26,41 +26,41 @@ discard block |
||
| 26 | 26 | * @return string Code HTML du cadre dépliable |
| 27 | 27 | **/ |
| 28 | 28 | function cadre_depliable($icone, $titre, $deplie, $contenu, $ids = '', $style_cadre = 'r') { |
| 29 | - $bouton = bouton_block_depliable($titre, $deplie, $ids); |
|
| 30 | - |
|
| 31 | - return |
|
| 32 | - debut_cadre($style_cadre, $icone, '', $bouton, '', '', false) |
|
| 33 | - . debut_block_depliable($deplie, $ids) |
|
| 34 | - . "<div class='cadre_padding'>\n" |
|
| 35 | - . $contenu |
|
| 36 | - . "</div>\n" |
|
| 37 | - . fin_block() |
|
| 38 | - . fin_cadre(); |
|
| 29 | + $bouton = bouton_block_depliable($titre, $deplie, $ids); |
|
| 30 | + |
|
| 31 | + return |
|
| 32 | + debut_cadre($style_cadre, $icone, '', $bouton, '', '', false) |
|
| 33 | + . debut_block_depliable($deplie, $ids) |
|
| 34 | + . "<div class='cadre_padding'>\n" |
|
| 35 | + . $contenu |
|
| 36 | + . "</div>\n" |
|
| 37 | + . fin_block() |
|
| 38 | + . fin_cadre(); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // http://code.spip.net/@block_parfois_visible |
| 42 | 42 | function block_parfois_visible($nom, $invite, $masque, $style = '', $visible = false) { |
| 43 | - return "\n" |
|
| 44 | - . bouton_block_depliable($invite, $visible, $nom) |
|
| 45 | - . debut_block_depliable($visible, $nom) |
|
| 46 | - . $masque |
|
| 47 | - . fin_block(); |
|
| 43 | + return "\n" |
|
| 44 | + . bouton_block_depliable($invite, $visible, $nom) |
|
| 45 | + . debut_block_depliable($visible, $nom) |
|
| 46 | + . $masque |
|
| 47 | + . fin_block(); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // http://code.spip.net/@debut_block_depliable |
| 51 | 51 | function debut_block_depliable($deplie, $id = "") { |
| 52 | - $class = ' blocdeplie'; |
|
| 53 | - // si on n'accepte pas js, ne pas fermer |
|
| 54 | - if (!$deplie) { |
|
| 55 | - $class = " blocreplie"; |
|
| 56 | - } |
|
| 52 | + $class = ' blocdeplie'; |
|
| 53 | + // si on n'accepte pas js, ne pas fermer |
|
| 54 | + if (!$deplie) { |
|
| 55 | + $class = " blocreplie"; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - return "<div " . ($id ? "id='$id' " : "") . "class='bloc_depliable$class'>"; |
|
| 58 | + return "<div " . ($id ? "id='$id' " : "") . "class='bloc_depliable$class'>"; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // http://code.spip.net/@fin_block |
| 62 | 62 | function fin_block() { |
| 63 | - return "<div class='nettoyeur'></div>\n</div>"; |
|
| 63 | + return "<div class='nettoyeur'></div>\n</div>"; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // $texte : texte du bouton |
@@ -68,32 +68,32 @@ discard block |
||
| 68 | 68 | // $ids : id des div lies au bouton (facultatif, par defaut c'est le div.bloc_depliable qui suit) |
| 69 | 69 | // http://code.spip.net/@bouton_block_depliable |
| 70 | 70 | function bouton_block_depliable($texte, $deplie, $ids = "") { |
| 71 | - $bouton_id = 'b' . substr(md5($texte . microtime()), 0, 8); |
|
| 72 | - |
|
| 73 | - $class = ($deplie === true) ? " deplie" : (($deplie == -1) ? " impliable" : " replie"); |
|
| 74 | - if (strlen($ids)) { |
|
| 75 | - $cible = explode(',', $ids); |
|
| 76 | - $cible = '#' . implode(",#", $cible); |
|
| 77 | - } else { |
|
| 78 | - $cible = "#$bouton_id + div.bloc_depliable"; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - $b = (strpos($texte, "<h") === false ? 'h3' : 'div'); |
|
| 82 | - |
|
| 83 | - return "<$b " |
|
| 84 | - . ($bouton_id ? "id='$bouton_id' " : "") |
|
| 85 | - . "class='titrem$class'" |
|
| 86 | - . (($deplie === -1) |
|
| 87 | - ? "" |
|
| 88 | - : " onmouseover=\"jQuery(this).depliant('$cible');\"" |
|
| 89 | - ) |
|
| 90 | - . ">" |
|
| 91 | - // une ancre pour rendre accessible au clavier le depliage du sous bloc |
|
| 92 | - . "<a href='#' onclick=\"return jQuery(this).depliant_clicancre('$cible');\" class='titremancre'></a>" |
|
| 93 | - . "$texte</$b>" |
|
| 94 | - . http_script(($deplie === 'incertain') |
|
| 95 | - ? "jQuery(function($){if ($('$cible').is(':visible')) { $('#$bouton_id').addClass('deplie').removeClass('replie'); }});" |
|
| 96 | - : ''); |
|
| 71 | + $bouton_id = 'b' . substr(md5($texte . microtime()), 0, 8); |
|
| 72 | + |
|
| 73 | + $class = ($deplie === true) ? " deplie" : (($deplie == -1) ? " impliable" : " replie"); |
|
| 74 | + if (strlen($ids)) { |
|
| 75 | + $cible = explode(',', $ids); |
|
| 76 | + $cible = '#' . implode(",#", $cible); |
|
| 77 | + } else { |
|
| 78 | + $cible = "#$bouton_id + div.bloc_depliable"; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + $b = (strpos($texte, "<h") === false ? 'h3' : 'div'); |
|
| 82 | + |
|
| 83 | + return "<$b " |
|
| 84 | + . ($bouton_id ? "id='$bouton_id' " : "") |
|
| 85 | + . "class='titrem$class'" |
|
| 86 | + . (($deplie === -1) |
|
| 87 | + ? "" |
|
| 88 | + : " onmouseover=\"jQuery(this).depliant('$cible');\"" |
|
| 89 | + ) |
|
| 90 | + . ">" |
|
| 91 | + // une ancre pour rendre accessible au clavier le depliage du sous bloc |
|
| 92 | + . "<a href='#' onclick=\"return jQuery(this).depliant_clicancre('$cible');\" class='titremancre'></a>" |
|
| 93 | + . "$texte</$b>" |
|
| 94 | + . http_script(($deplie === 'incertain') |
|
| 95 | + ? "jQuery(function($){if ($('$cible').is(':visible')) { $('#$bouton_id').addClass('deplie').removeClass('replie'); }});" |
|
| 96 | + : ''); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // |
@@ -102,62 +102,62 @@ discard block |
||
| 102 | 102 | // http://code.spip.net/@verif_butineur |
| 103 | 103 | function verif_butineur() { |
| 104 | 104 | |
| 105 | - preg_match(",^([A-Za-z]+)/([0-9]+\.[0-9]+) (.*)$,", $_SERVER['HTTP_USER_AGENT'], $match); |
|
| 106 | - $GLOBALS['browser_name'] = $match[1]; |
|
| 107 | - $GLOBALS['browser_version'] = $match[2]; |
|
| 108 | - $GLOBALS['browser_description'] = $match[3]; |
|
| 109 | - $GLOBALS['browser_layer'] = ' '; // compat avec vieux scripts qui testent la valeur |
|
| 110 | - $GLOBALS['browser_barre'] = ''; |
|
| 111 | - |
|
| 112 | - if (!preg_match(",opera,i", $GLOBALS['browser_description']) && preg_match(",opera,i", $GLOBALS['browser_name'])) { |
|
| 113 | - $GLOBALS['browser_name'] = "Opera"; |
|
| 114 | - $GLOBALS['browser_version'] = $match[2]; |
|
| 115 | - $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 8.5); |
|
| 116 | - } else { |
|
| 117 | - if (preg_match(",opera,i", $GLOBALS['browser_description'])) { |
|
| 118 | - preg_match(",Opera ([^\ ]*),i", $GLOBALS['browser_description'], $match); |
|
| 119 | - $GLOBALS['browser_name'] = "Opera"; |
|
| 120 | - $GLOBALS['browser_version'] = $match[1]; |
|
| 121 | - $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 8.5); |
|
| 122 | - } else { |
|
| 123 | - if (preg_match(",msie,i", $GLOBALS['browser_description'])) { |
|
| 124 | - preg_match(",MSIE ([^;]*),i", $GLOBALS['browser_description'], $match); |
|
| 125 | - $GLOBALS['browser_name'] = "MSIE"; |
|
| 126 | - $GLOBALS['browser_version'] = $match[1]; |
|
| 127 | - $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 5.5); |
|
| 128 | - } else { |
|
| 129 | - if (preg_match(",KHTML,i", $GLOBALS['browser_description']) && |
|
| 130 | - preg_match(",Safari/([^;]*),", $GLOBALS['browser_description'], $match) |
|
| 131 | - ) { |
|
| 132 | - $GLOBALS['browser_name'] = "Safari"; |
|
| 133 | - $GLOBALS['browser_version'] = $match[1]; |
|
| 134 | - $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 5.0); |
|
| 135 | - } else { |
|
| 136 | - if (preg_match(",mozilla,i", $GLOBALS['browser_name']) and $GLOBALS['browser_version'] >= 5) { |
|
| 137 | - // Numero de version pour Mozilla "authentique" |
|
| 138 | - if (preg_match(",rv:([0-9]+\.[0-9]+),", $GLOBALS['browser_description'], $match)) { |
|
| 139 | - $GLOBALS['browser_rev'] = doubleval($match[1]); |
|
| 140 | - } // Autres Gecko => equivalents 1.4 par defaut (Galeon, etc.) |
|
| 141 | - else { |
|
| 142 | - if (strpos($GLOBALS['browser_description'], "Gecko") and !strpos($GLOBALS['browser_description'], |
|
| 143 | - "KHTML") |
|
| 144 | - ) { |
|
| 145 | - $GLOBALS['browser_rev'] = 1.4; |
|
| 146 | - } // Machins quelconques => equivalents 1.0 par defaut (Konqueror, etc.) |
|
| 147 | - else { |
|
| 148 | - $GLOBALS['browser_rev'] = 1.0; |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - $GLOBALS['browser_barre'] = $GLOBALS['browser_rev'] >= 1.3; |
|
| 152 | - } |
|
| 153 | - } |
|
| 154 | - } |
|
| 155 | - } |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - if (!$GLOBALS['browser_name']) { |
|
| 159 | - $GLOBALS['browser_name'] = "Mozilla"; |
|
| 160 | - } |
|
| 105 | + preg_match(",^([A-Za-z]+)/([0-9]+\.[0-9]+) (.*)$,", $_SERVER['HTTP_USER_AGENT'], $match); |
|
| 106 | + $GLOBALS['browser_name'] = $match[1]; |
|
| 107 | + $GLOBALS['browser_version'] = $match[2]; |
|
| 108 | + $GLOBALS['browser_description'] = $match[3]; |
|
| 109 | + $GLOBALS['browser_layer'] = ' '; // compat avec vieux scripts qui testent la valeur |
|
| 110 | + $GLOBALS['browser_barre'] = ''; |
|
| 111 | + |
|
| 112 | + if (!preg_match(",opera,i", $GLOBALS['browser_description']) && preg_match(",opera,i", $GLOBALS['browser_name'])) { |
|
| 113 | + $GLOBALS['browser_name'] = "Opera"; |
|
| 114 | + $GLOBALS['browser_version'] = $match[2]; |
|
| 115 | + $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 8.5); |
|
| 116 | + } else { |
|
| 117 | + if (preg_match(",opera,i", $GLOBALS['browser_description'])) { |
|
| 118 | + preg_match(",Opera ([^\ ]*),i", $GLOBALS['browser_description'], $match); |
|
| 119 | + $GLOBALS['browser_name'] = "Opera"; |
|
| 120 | + $GLOBALS['browser_version'] = $match[1]; |
|
| 121 | + $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 8.5); |
|
| 122 | + } else { |
|
| 123 | + if (preg_match(",msie,i", $GLOBALS['browser_description'])) { |
|
| 124 | + preg_match(",MSIE ([^;]*),i", $GLOBALS['browser_description'], $match); |
|
| 125 | + $GLOBALS['browser_name'] = "MSIE"; |
|
| 126 | + $GLOBALS['browser_version'] = $match[1]; |
|
| 127 | + $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 5.5); |
|
| 128 | + } else { |
|
| 129 | + if (preg_match(",KHTML,i", $GLOBALS['browser_description']) && |
|
| 130 | + preg_match(",Safari/([^;]*),", $GLOBALS['browser_description'], $match) |
|
| 131 | + ) { |
|
| 132 | + $GLOBALS['browser_name'] = "Safari"; |
|
| 133 | + $GLOBALS['browser_version'] = $match[1]; |
|
| 134 | + $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 5.0); |
|
| 135 | + } else { |
|
| 136 | + if (preg_match(",mozilla,i", $GLOBALS['browser_name']) and $GLOBALS['browser_version'] >= 5) { |
|
| 137 | + // Numero de version pour Mozilla "authentique" |
|
| 138 | + if (preg_match(",rv:([0-9]+\.[0-9]+),", $GLOBALS['browser_description'], $match)) { |
|
| 139 | + $GLOBALS['browser_rev'] = doubleval($match[1]); |
|
| 140 | + } // Autres Gecko => equivalents 1.4 par defaut (Galeon, etc.) |
|
| 141 | + else { |
|
| 142 | + if (strpos($GLOBALS['browser_description'], "Gecko") and !strpos($GLOBALS['browser_description'], |
|
| 143 | + "KHTML") |
|
| 144 | + ) { |
|
| 145 | + $GLOBALS['browser_rev'] = 1.4; |
|
| 146 | + } // Machins quelconques => equivalents 1.0 par defaut (Konqueror, etc.) |
|
| 147 | + else { |
|
| 148 | + $GLOBALS['browser_rev'] = 1.0; |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + $GLOBALS['browser_barre'] = $GLOBALS['browser_rev'] >= 1.3; |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + if (!$GLOBALS['browser_name']) { |
|
| 159 | + $GLOBALS['browser_name'] = "Mozilla"; |
|
| 160 | + } |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | verif_butineur(); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $class = " blocreplie"; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - return "<div " . ($id ? "id='$id' " : "") . "class='bloc_depliable$class'>"; |
|
| 58 | + return "<div ".($id ? "id='$id' " : "")."class='bloc_depliable$class'>"; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // http://code.spip.net/@fin_block |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | // $ids : id des div lies au bouton (facultatif, par defaut c'est le div.bloc_depliable qui suit) |
| 69 | 69 | // http://code.spip.net/@bouton_block_depliable |
| 70 | 70 | function bouton_block_depliable($texte, $deplie, $ids = "") { |
| 71 | - $bouton_id = 'b' . substr(md5($texte . microtime()), 0, 8); |
|
| 71 | + $bouton_id = 'b'.substr(md5($texte.microtime()), 0, 8); |
|
| 72 | 72 | |
| 73 | 73 | $class = ($deplie === true) ? " deplie" : (($deplie == -1) ? " impliable" : " replie"); |
| 74 | 74 | if (strlen($ids)) { |
| 75 | 75 | $cible = explode(',', $ids); |
| 76 | - $cible = '#' . implode(",#", $cible); |
|
| 76 | + $cible = '#'.implode(",#", $cible); |
|
| 77 | 77 | } else { |
| 78 | 78 | $cible = "#$bouton_id + div.bloc_depliable"; |
| 79 | 79 | } |
@@ -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 | |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | * @param array $opt |
| 25 | 25 | */ |
| 26 | 26 | function inc_journal_dist($phrase, $opt = array()) { |
| 27 | - if (!strlen($phrase)) { |
|
| 28 | - return; |
|
| 29 | - } |
|
| 30 | - if ($opt) { |
|
| 31 | - $phrase .= ' :: ' . str_replace("\n", ' ', join(', ', $opt)); |
|
| 32 | - } |
|
| 33 | - spip_log($phrase, 'journal'); |
|
| 27 | + if (!strlen($phrase)) { |
|
| 28 | + return; |
|
| 29 | + } |
|
| 30 | + if ($opt) { |
|
| 31 | + $phrase .= ' :: ' . str_replace("\n", ' ', join(', ', $opt)); |
|
| 32 | + } |
|
| 33 | + spip_log($phrase, 'journal'); |
|
| 34 | 34 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | return; |
| 29 | 29 | } |
| 30 | 30 | if ($opt) { |
| 31 | - $phrase .= ' :: ' . str_replace("\n", ' ', join(', ', $opt)); |
|
| 31 | + $phrase .= ' :: '.str_replace("\n", ' ', join(', ', $opt)); |
|
| 32 | 32 | } |
| 33 | 33 | spip_log($phrase, 'journal'); |
| 34 | 34 | } |
@@ -144,11 +144,13 @@ |
||
| 144 | 144 | |
| 145 | 145 | // creer l'<option> pour la rubrique $root |
| 146 | 146 | |
| 147 | - if (isset($data[$root])) # pas de racine sauf pour les rubriques |
|
| 147 | + if (isset($data[$root])) { |
|
| 148 | + # pas de racine sauf pour les rubriques |
|
| 148 | 149 | { |
| 149 | 150 | $r = "<option$selected value='$root' class='$class' style='$style'>$espace" |
| 150 | 151 | . $data[$root] |
| 151 | 152 | . '</option>' . "\n"; |
| 153 | + } |
|
| 152 | 154 | } else { |
| 153 | 155 | $r = ''; |
| 154 | 156 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | { |
| 141 | 141 | $r = "<option$selected value='$root' class='$class' style='$style'>$espace" |
| 142 | 142 | . $data[$root] |
| 143 | - . '</option>' . "\n"; |
|
| 143 | + . '</option>'."\n"; |
|
| 144 | 144 | } else { |
| 145 | 145 | $r = ''; |
| 146 | 146 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | // et voila le travail |
| 163 | - return $r . $sous; |
|
| 163 | + return $r.$sous; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -202,11 +202,11 @@ discard block |
||
| 202 | 202 | while ($r = sql_fetch($q)) { |
| 203 | 203 | if (autoriser('voir', 'rubrique', $r['id_rubrique'])) { |
| 204 | 204 | // titre largeur maxi a 50 |
| 205 | - $titre = couper(supprimer_tags(typo($r['titre'])) . " ", 50); |
|
| 205 | + $titre = couper(supprimer_tags(typo($r['titre']))." ", 50); |
|
| 206 | 206 | if ($GLOBALS['meta']['multi_rubriques'] == 'oui' |
| 207 | 207 | and ($r['langue_choisie'] == "oui" or $r['id_parent'] == 0) |
| 208 | 208 | ) { |
| 209 | - $titre .= ' [' . traduire_nom_langue($r['lang']) . ']'; |
|
| 209 | + $titre .= ' ['.traduire_nom_langue($r['lang']).']'; |
|
| 210 | 210 | } |
| 211 | 211 | $data[$r['id_rubrique']] = $titre; |
| 212 | 212 | $enfants[$r['id_parent']][] = $r['id_rubrique']; |
@@ -232,9 +232,9 @@ discard block |
||
| 232 | 232 | $att = " id='id_parent' name='id_parent'\nclass='selecteur_parent verdana1'"; |
| 233 | 233 | |
| 234 | 234 | if (preg_match(',^<option[^<>]*value=.(\d*).[^<>]*>([^<]*)</option>$,', $opt, $r)) { |
| 235 | - $r = "<input$att type='hidden' value='" . $r[1] . "' />" . $r[2]; |
|
| 235 | + $r = "<input$att type='hidden' value='".$r[1]."' />".$r[2]; |
|
| 236 | 236 | } else { |
| 237 | - $r = "<select" . $att . " size='1'>\n$opt</select>\n"; |
|
| 237 | + $r = "<select".$att." size='1'>\n$opt</select>\n"; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | # message pour neuneus (a supprimer ?) |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | function selecteur_rubrique_ajax($id_rubrique, $type, $restreint, $idem = 0, $do) { |
| 277 | 277 | |
| 278 | 278 | if ($id_rubrique) { |
| 279 | - $titre = sql_getfetsel("titre", "spip_rubriques", "id_rubrique=" . intval($id_rubrique)); |
|
| 279 | + $titre = sql_getfetsel("titre", "spip_rubriques", "id_rubrique=".intval($id_rubrique)); |
|
| 280 | 280 | } else { |
| 281 | 281 | if ($type == 'auteur') { |
| 282 | 282 | $titre = ' '; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | $titre = str_replace('&', '&', entites_html(textebrut(typo($titre)))); |
| 289 | - $init = " disabled='disabled' type='text' value=\"" . $titre . "\"\nstyle='width:300px;'"; |
|
| 289 | + $init = " disabled='disabled' type='text' value=\"".$titre."\"\nstyle='width:300px;'"; |
|
| 290 | 290 | |
| 291 | 291 | $url = generer_url_ecrire('selectionner', "id=$id_rubrique&type=$type&do=$do" |
| 292 | 292 | . (!$idem ? '' : "&exclus=$idem") |
@@ -331,9 +331,9 @@ discard block |
||
| 331 | 331 | . $js |
| 332 | 332 | . "return charger_node_url_si_vide('" |
| 333 | 333 | . $url |
| 334 | - . "', this.parentNode.nextSibling, this.nextSibling,'',event)\" title='" . attribut_html(_T('titre_image_selecteur')) . "'><img src='" |
|
| 334 | + . "', this.parentNode.nextSibling, this.nextSibling,'',event)\" title='".attribut_html(_T('titre_image_selecteur'))."'><img src='" |
|
| 335 | 335 | . chemin_image($icone) |
| 336 | - . "'\nstyle='vertical-align: middle;' alt='" . attribut_html(_T('titre_image_selecteur')) . "' /></a><img src='" |
|
| 336 | + . "'\nstyle='vertical-align: middle;' alt='".attribut_html(_T('titre_image_selecteur'))."' /></a><img src='" |
|
| 337 | 337 | . chemin_image('searching.gif') |
| 338 | 338 | . "' id='img_" |
| 339 | 339 | . $idom |
@@ -18,16 +18,16 @@ discard block |
||
| 18 | 18 | **/ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | if (!defined('_SPIP_SELECT_RUBRIQUES')) { |
| 25 | - /** |
|
| 26 | - * @var int Nombre de rubriques maximum du sélecteur de rubriques. |
|
| 27 | - * Au delà, on bascule sur un sélecteur ajax. |
|
| 28 | - * mettre 100000 pour desactiver ajax |
|
| 29 | - */ |
|
| 30 | - define('_SPIP_SELECT_RUBRIQUES', 20); |
|
| 25 | + /** |
|
| 26 | + * @var int Nombre de rubriques maximum du sélecteur de rubriques. |
|
| 27 | + * Au delà, on bascule sur un sélecteur ajax. |
|
| 28 | + * mettre 100000 pour desactiver ajax |
|
| 29 | + */ |
|
| 30 | + define('_SPIP_SELECT_RUBRIQUES', 20); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -55,21 +55,21 @@ discard block |
||
| 55 | 55 | * Code HTML du sélecteur |
| 56 | 56 | **/ |
| 57 | 57 | function inc_chercher_rubrique_dist($id_rubrique, $type, $restreint, $idem = 0, $do = 'aff') { |
| 58 | - if (sql_countsel('spip_rubriques') < 1) { |
|
| 59 | - return ''; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - // Mode sans Ajax : |
|
| 63 | - // - soit parce que le cookie ajax n'est pas la |
|
| 64 | - // - soit parce qu'il y a peu de rubriques |
|
| 65 | - if (_SPIP_AJAX < 1 |
|
| 66 | - or $type == 'breve' |
|
| 67 | - or sql_countsel('spip_rubriques') < _SPIP_SELECT_RUBRIQUES |
|
| 68 | - ) { |
|
| 69 | - return selecteur_rubrique_html($id_rubrique, $type, $restreint, $idem); |
|
| 70 | - } else { |
|
| 71 | - return selecteur_rubrique_ajax($id_rubrique, $type, $restreint, $idem, $do); |
|
| 72 | - } |
|
| 58 | + if (sql_countsel('spip_rubriques') < 1) { |
|
| 59 | + return ''; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + // Mode sans Ajax : |
|
| 63 | + // - soit parce que le cookie ajax n'est pas la |
|
| 64 | + // - soit parce qu'il y a peu de rubriques |
|
| 65 | + if (_SPIP_AJAX < 1 |
|
| 66 | + or $type == 'breve' |
|
| 67 | + or sql_countsel('spip_rubriques') < _SPIP_SELECT_RUBRIQUES |
|
| 68 | + ) { |
|
| 69 | + return selecteur_rubrique_html($id_rubrique, $type, $restreint, $idem); |
|
| 70 | + } else { |
|
| 71 | + return selecteur_rubrique_ajax($id_rubrique, $type, $restreint, $idem, $do); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | 74 | } |
| 75 | 75 | |
@@ -87,17 +87,17 @@ discard block |
||
| 87 | 87 | **/ |
| 88 | 88 | function style_menu_rubriques($i) { |
| 89 | 89 | |
| 90 | - $espace = ''; |
|
| 91 | - $style = ''; |
|
| 92 | - for ($count = 1; $count <= $i; $count++) { |
|
| 93 | - $espace .= " "; |
|
| 94 | - } |
|
| 95 | - if ($i == 1) { |
|
| 96 | - $espace = ""; |
|
| 97 | - } |
|
| 98 | - $class = "niveau_$i"; |
|
| 99 | - |
|
| 100 | - return array($class, $style, $espace); |
|
| 90 | + $espace = ''; |
|
| 91 | + $style = ''; |
|
| 92 | + for ($count = 1; $count <= $i; $count++) { |
|
| 93 | + $espace .= " "; |
|
| 94 | + } |
|
| 95 | + if ($i == 1) { |
|
| 96 | + $espace = ""; |
|
| 97 | + } |
|
| 98 | + $class = "niveau_$i"; |
|
| 99 | + |
|
| 100 | + return array($class, $style, $espace); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -121,52 +121,52 @@ discard block |
||
| 121 | 121 | * Code HTML du sélecteur |
| 122 | 122 | **/ |
| 123 | 123 | function sous_menu_rubriques($id_rubrique, $root, $niv, &$data, &$enfants, $exclus, $restreint, $type) { |
| 124 | - static $decalage_secteur; |
|
| 125 | - |
|
| 126 | - // Si on a demande l'exclusion ne pas descendre dans la rubrique courante |
|
| 127 | - if ($exclus > 0 |
|
| 128 | - and $root == $exclus |
|
| 129 | - ) { |
|
| 130 | - return ''; |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - // en fonction du niveau faire un affichage plus ou moins kikoo |
|
| 134 | - |
|
| 135 | - // selected ? |
|
| 136 | - $selected = ($root == $id_rubrique) ? ' selected="selected"' : ''; |
|
| 137 | - |
|
| 138 | - // le style en fonction de la profondeur |
|
| 139 | - list($class, $style, $espace) = style_menu_rubriques($niv); |
|
| 140 | - |
|
| 141 | - $class .= " selec_rub"; |
|
| 142 | - |
|
| 143 | - // creer l'<option> pour la rubrique $root |
|
| 144 | - |
|
| 145 | - if (isset($data[$root])) # pas de racine sauf pour les rubriques |
|
| 146 | - { |
|
| 147 | - $r = "<option$selected value='$root' class='$class' style='$style'>$espace" |
|
| 148 | - . $data[$root] |
|
| 149 | - . '</option>' . "\n"; |
|
| 150 | - } else { |
|
| 151 | - $r = ''; |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - // et le sous-menu pour ses enfants |
|
| 155 | - $sous = ''; |
|
| 156 | - if (isset($enfants[$root])) { |
|
| 157 | - foreach ($enfants[$root] as $sousrub) { |
|
| 158 | - $sous .= sous_menu_rubriques($id_rubrique, $sousrub, |
|
| 159 | - $niv + 1, $data, $enfants, $exclus, $restreint, $type); |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - // si l'objet a deplacer est publie, verifier qu'on a acces aux rubriques |
|
| 164 | - if ($restreint and $root != $id_rubrique and !autoriser('publierdans', 'rubrique', $root)) { |
|
| 165 | - return $sous; |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - // et voila le travail |
|
| 169 | - return $r . $sous; |
|
| 124 | + static $decalage_secteur; |
|
| 125 | + |
|
| 126 | + // Si on a demande l'exclusion ne pas descendre dans la rubrique courante |
|
| 127 | + if ($exclus > 0 |
|
| 128 | + and $root == $exclus |
|
| 129 | + ) { |
|
| 130 | + return ''; |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + // en fonction du niveau faire un affichage plus ou moins kikoo |
|
| 134 | + |
|
| 135 | + // selected ? |
|
| 136 | + $selected = ($root == $id_rubrique) ? ' selected="selected"' : ''; |
|
| 137 | + |
|
| 138 | + // le style en fonction de la profondeur |
|
| 139 | + list($class, $style, $espace) = style_menu_rubriques($niv); |
|
| 140 | + |
|
| 141 | + $class .= " selec_rub"; |
|
| 142 | + |
|
| 143 | + // creer l'<option> pour la rubrique $root |
|
| 144 | + |
|
| 145 | + if (isset($data[$root])) # pas de racine sauf pour les rubriques |
|
| 146 | + { |
|
| 147 | + $r = "<option$selected value='$root' class='$class' style='$style'>$espace" |
|
| 148 | + . $data[$root] |
|
| 149 | + . '</option>' . "\n"; |
|
| 150 | + } else { |
|
| 151 | + $r = ''; |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + // et le sous-menu pour ses enfants |
|
| 155 | + $sous = ''; |
|
| 156 | + if (isset($enfants[$root])) { |
|
| 157 | + foreach ($enfants[$root] as $sousrub) { |
|
| 158 | + $sous .= sous_menu_rubriques($id_rubrique, $sousrub, |
|
| 159 | + $niv + 1, $data, $enfants, $exclus, $restreint, $type); |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + // si l'objet a deplacer est publie, verifier qu'on a acces aux rubriques |
|
| 164 | + if ($restreint and $root != $id_rubrique and !autoriser('publierdans', 'rubrique', $root)) { |
|
| 165 | + return $sous; |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + // et voila le travail |
|
| 169 | + return $r . $sous; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -187,67 +187,67 @@ discard block |
||
| 187 | 187 | * Code HTML du sélecteur |
| 188 | 188 | **/ |
| 189 | 189 | function selecteur_rubrique_html($id_rubrique, $type, $restreint, $idem = 0) { |
| 190 | - $data = array(); |
|
| 191 | - if ($type == 'rubrique' and autoriser('publierdans', 'rubrique', 0)) { |
|
| 192 | - $data[0] = _T('info_racine_site'); |
|
| 193 | - } |
|
| 194 | - # premier choix = neant |
|
| 195 | - # si auteur (rubriques restreintes) |
|
| 196 | - # ou si creation avec id_rubrique=0 |
|
| 197 | - elseif ($type == 'auteur' or !$id_rubrique) { |
|
| 198 | - $data[0] = ' '; |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - // |
|
| 202 | - // creer une structure contenant toute l'arborescence |
|
| 203 | - // |
|
| 204 | - |
|
| 205 | - include_spip('base/abstract_sql'); |
|
| 206 | - $q = sql_select("id_rubrique, id_parent, titre, statut, lang, langue_choisie", "spip_rubriques", |
|
| 207 | - ($type == 'breve' ? ' id_parent=0 ' : ''), '', "0+titre,titre"); |
|
| 208 | - while ($r = sql_fetch($q)) { |
|
| 209 | - if (autoriser('voir', 'rubrique', $r['id_rubrique'])) { |
|
| 210 | - // titre largeur maxi a 50 |
|
| 211 | - $titre = couper(supprimer_tags(typo($r['titre'])) . " ", 50); |
|
| 212 | - if ($GLOBALS['meta']['multi_rubriques'] == 'oui' |
|
| 213 | - and ($r['langue_choisie'] == "oui" or $r['id_parent'] == 0) |
|
| 214 | - ) { |
|
| 215 | - $titre .= ' [' . traduire_nom_langue($r['lang']) . ']'; |
|
| 216 | - } |
|
| 217 | - $data[$r['id_rubrique']] = $titre; |
|
| 218 | - $enfants[$r['id_parent']][] = $r['id_rubrique']; |
|
| 219 | - if ($id_rubrique == $r['id_rubrique']) { |
|
| 220 | - $id_parent = $r['id_parent']; |
|
| 221 | - } |
|
| 222 | - } |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - // si une seule rubrique comme choix possible, |
|
| 226 | - // inutile de mettre le selecteur sur un choix vide par defaut |
|
| 227 | - // sauf si le selecteur s'adresse a une rubrique puisque on peut la mettre a la racine dans ce cas |
|
| 228 | - if (count($data) == 2 |
|
| 229 | - and isset($data[0]) |
|
| 230 | - and !in_array($type, array('auteur', 'rubrique')) |
|
| 231 | - and !$id_rubrique |
|
| 232 | - ) { |
|
| 233 | - unset($data[0]); |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - |
|
| 237 | - $opt = sous_menu_rubriques($id_rubrique, 0, 0, $data, $enfants, $idem, $restreint, $type); |
|
| 238 | - $att = " id='id_parent' name='id_parent'\nclass='selecteur_parent verdana1'"; |
|
| 239 | - |
|
| 240 | - if (preg_match(',^<option[^<>]*value=.(\d*).[^<>]*>([^<]*)</option>$,', $opt, $r)) { |
|
| 241 | - $r = "<input$att type='hidden' value='" . $r[1] . "' />" . $r[2]; |
|
| 242 | - } else { |
|
| 243 | - $r = "<select" . $att . " size='1'>\n$opt</select>\n"; |
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - # message pour neuneus (a supprimer ?) |
|
| 190 | + $data = array(); |
|
| 191 | + if ($type == 'rubrique' and autoriser('publierdans', 'rubrique', 0)) { |
|
| 192 | + $data[0] = _T('info_racine_site'); |
|
| 193 | + } |
|
| 194 | + # premier choix = neant |
|
| 195 | + # si auteur (rubriques restreintes) |
|
| 196 | + # ou si creation avec id_rubrique=0 |
|
| 197 | + elseif ($type == 'auteur' or !$id_rubrique) { |
|
| 198 | + $data[0] = ' '; |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + // |
|
| 202 | + // creer une structure contenant toute l'arborescence |
|
| 203 | + // |
|
| 204 | + |
|
| 205 | + include_spip('base/abstract_sql'); |
|
| 206 | + $q = sql_select("id_rubrique, id_parent, titre, statut, lang, langue_choisie", "spip_rubriques", |
|
| 207 | + ($type == 'breve' ? ' id_parent=0 ' : ''), '', "0+titre,titre"); |
|
| 208 | + while ($r = sql_fetch($q)) { |
|
| 209 | + if (autoriser('voir', 'rubrique', $r['id_rubrique'])) { |
|
| 210 | + // titre largeur maxi a 50 |
|
| 211 | + $titre = couper(supprimer_tags(typo($r['titre'])) . " ", 50); |
|
| 212 | + if ($GLOBALS['meta']['multi_rubriques'] == 'oui' |
|
| 213 | + and ($r['langue_choisie'] == "oui" or $r['id_parent'] == 0) |
|
| 214 | + ) { |
|
| 215 | + $titre .= ' [' . traduire_nom_langue($r['lang']) . ']'; |
|
| 216 | + } |
|
| 217 | + $data[$r['id_rubrique']] = $titre; |
|
| 218 | + $enfants[$r['id_parent']][] = $r['id_rubrique']; |
|
| 219 | + if ($id_rubrique == $r['id_rubrique']) { |
|
| 220 | + $id_parent = $r['id_parent']; |
|
| 221 | + } |
|
| 222 | + } |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + // si une seule rubrique comme choix possible, |
|
| 226 | + // inutile de mettre le selecteur sur un choix vide par defaut |
|
| 227 | + // sauf si le selecteur s'adresse a une rubrique puisque on peut la mettre a la racine dans ce cas |
|
| 228 | + if (count($data) == 2 |
|
| 229 | + and isset($data[0]) |
|
| 230 | + and !in_array($type, array('auteur', 'rubrique')) |
|
| 231 | + and !$id_rubrique |
|
| 232 | + ) { |
|
| 233 | + unset($data[0]); |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + |
|
| 237 | + $opt = sous_menu_rubriques($id_rubrique, 0, 0, $data, $enfants, $idem, $restreint, $type); |
|
| 238 | + $att = " id='id_parent' name='id_parent'\nclass='selecteur_parent verdana1'"; |
|
| 239 | + |
|
| 240 | + if (preg_match(',^<option[^<>]*value=.(\d*).[^<>]*>([^<]*)</option>$,', $opt, $r)) { |
|
| 241 | + $r = "<input$att type='hidden' value='" . $r[1] . "' />" . $r[2]; |
|
| 242 | + } else { |
|
| 243 | + $r = "<select" . $att . " size='1'>\n$opt</select>\n"; |
|
| 244 | + } |
|
| 245 | + |
|
| 246 | + # message pour neuneus (a supprimer ?) |
|
| 247 | 247 | # if ($type != 'auteur' AND $type != 'breve') |
| 248 | 248 | # $r .= "\n<br />"._T('texte_rappel_selection_champs'); |
| 249 | 249 | |
| 250 | - return $r; |
|
| 250 | + return $r; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -281,26 +281,26 @@ discard block |
||
| 281 | 281 | */ |
| 282 | 282 | function selecteur_rubrique_ajax($id_rubrique, $type, $restreint, $idem = 0, $do) { |
| 283 | 283 | |
| 284 | - if ($id_rubrique) { |
|
| 285 | - $titre = sql_getfetsel("titre", "spip_rubriques", "id_rubrique=" . intval($id_rubrique)); |
|
| 286 | - } else { |
|
| 287 | - if ($type == 'auteur') { |
|
| 288 | - $titre = ' '; |
|
| 289 | - } else { |
|
| 290 | - $titre = _T('info_racine_site'); |
|
| 291 | - } |
|
| 292 | - } |
|
| 284 | + if ($id_rubrique) { |
|
| 285 | + $titre = sql_getfetsel("titre", "spip_rubriques", "id_rubrique=" . intval($id_rubrique)); |
|
| 286 | + } else { |
|
| 287 | + if ($type == 'auteur') { |
|
| 288 | + $titre = ' '; |
|
| 289 | + } else { |
|
| 290 | + $titre = _T('info_racine_site'); |
|
| 291 | + } |
|
| 292 | + } |
|
| 293 | 293 | |
| 294 | - $titre = str_replace('&', '&', entites_html(textebrut(typo($titre)))); |
|
| 295 | - $init = " disabled='disabled' type='text' value=\"" . $titre . "\"\nstyle='width:300px;'"; |
|
| 294 | + $titre = str_replace('&', '&', entites_html(textebrut(typo($titre)))); |
|
| 295 | + $init = " disabled='disabled' type='text' value=\"" . $titre . "\"\nstyle='width:300px;'"; |
|
| 296 | 296 | |
| 297 | - $url = generer_url_ecrire('selectionner', "id=$id_rubrique&type=$type&do=$do" |
|
| 298 | - . (!$idem ? '' : "&exclus=$idem") |
|
| 299 | - . ($restreint ? "" : "&racine=oui") |
|
| 300 | - . (isset($GLOBALS['var_profile']) ? '&var_profile=1' : '')); |
|
| 297 | + $url = generer_url_ecrire('selectionner', "id=$id_rubrique&type=$type&do=$do" |
|
| 298 | + . (!$idem ? '' : "&exclus=$idem") |
|
| 299 | + . ($restreint ? "" : "&racine=oui") |
|
| 300 | + . (isset($GLOBALS['var_profile']) ? '&var_profile=1' : '')); |
|
| 301 | 301 | |
| 302 | 302 | |
| 303 | - return construire_selecteur($url, '', 'selection_rubrique', 'id_parent', $init, $id_rubrique); |
|
| 303 | + return construire_selecteur($url, '', 'selection_rubrique', 'id_parent', $init, $id_rubrique); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | /** |
@@ -330,26 +330,26 @@ discard block |
||
| 330 | 330 | * Code HTML du sélecteur de rubrique AJAX |
| 331 | 331 | **/ |
| 332 | 332 | function construire_selecteur($url, $js, $idom, $name, $init = '', $id = 0) { |
| 333 | - $icone = (strpos($idom, 'auteur') !== false) ? 'auteur-24.png' : 'rechercher-20.png'; |
|
| 334 | - |
|
| 335 | - return |
|
| 336 | - "<div class='rubrique_actuelle'><a href='#' onclick=\"" |
|
| 337 | - . $js |
|
| 338 | - . "return charger_node_url_si_vide('" |
|
| 339 | - . $url |
|
| 340 | - . "', this.parentNode.nextSibling, this.nextSibling,'',event)\" title='" . attribut_html(_T('titre_image_selecteur')) . "'><img src='" |
|
| 341 | - . chemin_image($icone) |
|
| 342 | - . "'\nstyle='vertical-align: middle;' alt='" . attribut_html(_T('titre_image_selecteur')) . "' /></a><img src='" |
|
| 343 | - . chemin_image('searching.gif') |
|
| 344 | - . "' id='img_" |
|
| 345 | - . $idom |
|
| 346 | - . "'\nstyle='visibility: hidden;' alt='*' />" |
|
| 347 | - . "<input id='titreparent' name='titreparent'" |
|
| 348 | - . $init |
|
| 349 | - . " />" |
|
| 350 | - . "<input type='hidden' id='$name' name='$name' value='" |
|
| 351 | - . $id |
|
| 352 | - . "' /><div class='nettoyeur'></div></div><div id='" |
|
| 353 | - . $idom |
|
| 354 | - . "'\nstyle='display: none;'></div>"; |
|
| 333 | + $icone = (strpos($idom, 'auteur') !== false) ? 'auteur-24.png' : 'rechercher-20.png'; |
|
| 334 | + |
|
| 335 | + return |
|
| 336 | + "<div class='rubrique_actuelle'><a href='#' onclick=\"" |
|
| 337 | + . $js |
|
| 338 | + . "return charger_node_url_si_vide('" |
|
| 339 | + . $url |
|
| 340 | + . "', this.parentNode.nextSibling, this.nextSibling,'',event)\" title='" . attribut_html(_T('titre_image_selecteur')) . "'><img src='" |
|
| 341 | + . chemin_image($icone) |
|
| 342 | + . "'\nstyle='vertical-align: middle;' alt='" . attribut_html(_T('titre_image_selecteur')) . "' /></a><img src='" |
|
| 343 | + . chemin_image('searching.gif') |
|
| 344 | + . "' id='img_" |
|
| 345 | + . $idom |
|
| 346 | + . "'\nstyle='visibility: hidden;' alt='*' />" |
|
| 347 | + . "<input id='titreparent' name='titreparent'" |
|
| 348 | + . $init |
|
| 349 | + . " />" |
|
| 350 | + . "<input type='hidden' id='$name' name='$name' value='" |
|
| 351 | + . $id |
|
| 352 | + . "' /><div class='nettoyeur'></div></div><div id='" |
|
| 353 | + . $idom |
|
| 354 | + . "'\nstyle='display: none;'></div>"; |
|
| 355 | 355 | } |
@@ -20,21 +20,21 @@ |
||
| 20 | 20 | * Retourne la liste des menus favoris par défaut ainsi que leur rang |
| 21 | 21 | */ |
| 22 | 22 | function inc_definir_menus_favoris_dist() { |
| 23 | - $liste = array( |
|
| 23 | + $liste = array( |
|
| 24 | 24 | |
| 25 | - // Menu Édition, |
|
| 26 | - 'auteurs' => 1, |
|
| 27 | - 'rubriques' => 2, |
|
| 28 | - 'articles' => 3, |
|
| 25 | + // Menu Édition, |
|
| 26 | + 'auteurs' => 1, |
|
| 27 | + 'rubriques' => 2, |
|
| 28 | + 'articles' => 3, |
|
| 29 | 29 | |
| 30 | - // Menu Maintenance |
|
| 31 | - 'admin_vider' => 1, |
|
| 30 | + // Menu Maintenance |
|
| 31 | + 'admin_vider' => 1, |
|
| 32 | 32 | |
| 33 | - // Menu Configurations |
|
| 34 | - 'configurer_identite' => 1, |
|
| 35 | - 'admin_plugin' => 2, |
|
| 33 | + // Menu Configurations |
|
| 34 | + 'configurer_identite' => 1, |
|
| 35 | + 'admin_plugin' => 2, |
|
| 36 | 36 | |
| 37 | - ); |
|
| 37 | + ); |
|
| 38 | 38 | |
| 39 | - return $liste; |
|
| 39 | + return $liste; |
|
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |