@@ -11,28 +11,28 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | include_spip('inc/presentation'); |
| 17 | 17 | |
| 18 | 18 | function formulaires_configurer_previsualiseur_charger_dist() { |
| 19 | - $valeurs = []; |
|
| 20 | - $valeurs['preview'] = explode(',', $GLOBALS['meta']['preview']); |
|
| 19 | + $valeurs = []; |
|
| 20 | + $valeurs['preview'] = explode(',', $GLOBALS['meta']['preview']); |
|
| 21 | 21 | |
| 22 | - return $valeurs; |
|
| 22 | + return $valeurs; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | function formulaires_configurer_previsualiseur_traiter_dist() { |
| 27 | - $res = ['editable' => true]; |
|
| 27 | + $res = ['editable' => true]; |
|
| 28 | 28 | |
| 29 | - if ($i = _request('preview') and is_array($i)) { |
|
| 30 | - $i = ',' . implode(',', $i) . ','; |
|
| 31 | - } |
|
| 29 | + if ($i = _request('preview') and is_array($i)) { |
|
| 30 | + $i = ',' . implode(',', $i) . ','; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - ecrire_meta('preview', $i); |
|
| 33 | + ecrire_meta('preview', $i); |
|
| 34 | 34 | |
| 35 | - $res['message_ok'] = _T('config_info_enregistree'); |
|
| 35 | + $res['message_ok'] = _T('config_info_enregistree'); |
|
| 36 | 36 | |
| 37 | - return $res; |
|
| 37 | + return $res; |
|
| 38 | 38 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | **/ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -28,24 +28,24 @@ discard block |
||
| 28 | 28 | * Environnement du formulaire |
| 29 | 29 | **/ |
| 30 | 30 | function formulaires_configurer_reducteur_charger_dist() { |
| 31 | - $valeurs = []; |
|
| 32 | - foreach ( |
|
| 33 | - [ |
|
| 34 | - 'image_process', |
|
| 35 | - 'formats_graphiques', |
|
| 36 | - 'creer_preview', |
|
| 37 | - 'taille_preview', |
|
| 38 | - ] as $m |
|
| 39 | - ) { |
|
| 40 | - $valeurs[$m] = isset($GLOBALS['meta'][$m]) ? $GLOBALS['meta'][$m] : null; |
|
| 41 | - } |
|
| 31 | + $valeurs = []; |
|
| 32 | + foreach ( |
|
| 33 | + [ |
|
| 34 | + 'image_process', |
|
| 35 | + 'formats_graphiques', |
|
| 36 | + 'creer_preview', |
|
| 37 | + 'taille_preview', |
|
| 38 | + ] as $m |
|
| 39 | + ) { |
|
| 40 | + $valeurs[$m] = isset($GLOBALS['meta'][$m]) ? $GLOBALS['meta'][$m] : null; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $valeurs['taille_preview'] = intval($valeurs['taille_preview']); |
|
| 44 | - if ($valeurs['taille_preview'] < 10) { |
|
| 45 | - $valeurs['taille_preview'] = 120; |
|
| 46 | - } |
|
| 43 | + $valeurs['taille_preview'] = intval($valeurs['taille_preview']); |
|
| 44 | + if ($valeurs['taille_preview'] < 10) { |
|
| 45 | + $valeurs['taille_preview'] = 120; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - return $valeurs; |
|
| 48 | + return $valeurs; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
@@ -56,53 +56,53 @@ discard block |
||
| 56 | 56 | * Retours des traitements |
| 57 | 57 | **/ |
| 58 | 58 | function formulaires_configurer_reducteur_traiter_dist() { |
| 59 | - $res = ['editable' => true]; |
|
| 59 | + $res = ['editable' => true]; |
|
| 60 | 60 | |
| 61 | - if (is_array($image_process = _request('image_process_'))) { |
|
| 62 | - $image_process = array_keys($image_process); |
|
| 63 | - $image_process = reset($image_process); |
|
| 61 | + if (is_array($image_process = _request('image_process_'))) { |
|
| 62 | + $image_process = array_keys($image_process); |
|
| 63 | + $image_process = reset($image_process); |
|
| 64 | 64 | |
| 65 | - // application du choix de vignette |
|
| 66 | - if ($image_process) { |
|
| 67 | - // mettre a jour les formats graphiques lisibles |
|
| 68 | - switch ($image_process) { |
|
| 69 | - case 'gd1': |
|
| 70 | - case 'gd2': |
|
| 71 | - $formats_graphiques = $GLOBALS['meta']['gd_formats_read']; |
|
| 72 | - break; |
|
| 73 | - case 'netpbm': |
|
| 74 | - $formats_graphiques = $GLOBALS['meta']['netpbm_formats']; |
|
| 75 | - break; |
|
| 76 | - case 'convert': |
|
| 77 | - case 'imagick': |
|
| 78 | - $formats_graphiques = 'gif,jpg,png,webp'; |
|
| 79 | - break; |
|
| 80 | - default: #debug |
|
| 81 | - $formats_graphiques = ''; |
|
| 82 | - $image_process = 'non'; |
|
| 83 | - break; |
|
| 84 | - } |
|
| 85 | - ecrire_meta('formats_graphiques', $formats_graphiques, 'non'); |
|
| 86 | - ecrire_meta('image_process', $image_process, 'non'); |
|
| 87 | - } |
|
| 88 | - } |
|
| 65 | + // application du choix de vignette |
|
| 66 | + if ($image_process) { |
|
| 67 | + // mettre a jour les formats graphiques lisibles |
|
| 68 | + switch ($image_process) { |
|
| 69 | + case 'gd1': |
|
| 70 | + case 'gd2': |
|
| 71 | + $formats_graphiques = $GLOBALS['meta']['gd_formats_read']; |
|
| 72 | + break; |
|
| 73 | + case 'netpbm': |
|
| 74 | + $formats_graphiques = $GLOBALS['meta']['netpbm_formats']; |
|
| 75 | + break; |
|
| 76 | + case 'convert': |
|
| 77 | + case 'imagick': |
|
| 78 | + $formats_graphiques = 'gif,jpg,png,webp'; |
|
| 79 | + break; |
|
| 80 | + default: #debug |
|
| 81 | + $formats_graphiques = ''; |
|
| 82 | + $image_process = 'non'; |
|
| 83 | + break; |
|
| 84 | + } |
|
| 85 | + ecrire_meta('formats_graphiques', $formats_graphiques, 'non'); |
|
| 86 | + ecrire_meta('image_process', $image_process, 'non'); |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - foreach ( |
|
| 91 | - [ |
|
| 92 | - 'creer_preview' |
|
| 93 | - ] as $m |
|
| 94 | - ) { |
|
| 95 | - if (!is_null($v = _request($m))) { |
|
| 96 | - ecrire_meta($m, $v == 'oui' ? 'oui' : 'non'); |
|
| 97 | - } |
|
| 98 | - } |
|
| 99 | - if (!is_null($v = _request('taille_preview'))) { |
|
| 100 | - ecrire_meta('taille_preview', intval($v)); |
|
| 101 | - } |
|
| 90 | + foreach ( |
|
| 91 | + [ |
|
| 92 | + 'creer_preview' |
|
| 93 | + ] as $m |
|
| 94 | + ) { |
|
| 95 | + if (!is_null($v = _request($m))) { |
|
| 96 | + ecrire_meta($m, $v == 'oui' ? 'oui' : 'non'); |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | + if (!is_null($v = _request('taille_preview'))) { |
|
| 100 | + ecrire_meta('taille_preview', intval($v)); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - $res['message_ok'] = _T('config_info_enregistree'); |
|
| 103 | + $res['message_ok'] = _T('config_info_enregistree'); |
|
| 104 | 104 | |
| 105 | - return $res; |
|
| 105 | + return $res; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -115,37 +115,37 @@ discard block |
||
| 115 | 115 | * URL d'action pour tester la librairie graphique en créant une vignette |
| 116 | 116 | **/ |
| 117 | 117 | function url_vignette_choix($process) { |
| 118 | - switch ($process) { |
|
| 119 | - case 'gd2': |
|
| 120 | - if (!function_exists('ImageCreateTrueColor')) { |
|
| 121 | - return ''; |
|
| 122 | - } |
|
| 123 | - break; |
|
| 124 | - case 'gd1': |
|
| 125 | - if ( |
|
| 126 | - !function_exists('ImageGif') |
|
| 127 | - and !function_exists('ImageJpeg') |
|
| 128 | - and !function_exists('ImagePng') |
|
| 129 | - ) { |
|
| 130 | - return ''; |
|
| 131 | - } |
|
| 132 | - break; |
|
| 133 | - case 'netpbm': |
|
| 134 | - if (defined('_PNMSCALE_COMMAND') and _PNMSCALE_COMMAND == '') { |
|
| 135 | - return ''; |
|
| 136 | - } |
|
| 137 | - break; |
|
| 138 | - case 'imagick': |
|
| 139 | - if (!method_exists('Imagick', 'readImage')) { |
|
| 140 | - return ''; |
|
| 141 | - } |
|
| 142 | - break; |
|
| 143 | - case 'convert': |
|
| 144 | - if (defined('_CONVERT_COMMAND') and _CONVERT_COMMAND == '') { |
|
| 145 | - return ''; |
|
| 146 | - } |
|
| 147 | - break; |
|
| 148 | - } |
|
| 118 | + switch ($process) { |
|
| 119 | + case 'gd2': |
|
| 120 | + if (!function_exists('ImageCreateTrueColor')) { |
|
| 121 | + return ''; |
|
| 122 | + } |
|
| 123 | + break; |
|
| 124 | + case 'gd1': |
|
| 125 | + if ( |
|
| 126 | + !function_exists('ImageGif') |
|
| 127 | + and !function_exists('ImageJpeg') |
|
| 128 | + and !function_exists('ImagePng') |
|
| 129 | + ) { |
|
| 130 | + return ''; |
|
| 131 | + } |
|
| 132 | + break; |
|
| 133 | + case 'netpbm': |
|
| 134 | + if (defined('_PNMSCALE_COMMAND') and _PNMSCALE_COMMAND == '') { |
|
| 135 | + return ''; |
|
| 136 | + } |
|
| 137 | + break; |
|
| 138 | + case 'imagick': |
|
| 139 | + if (!method_exists('Imagick', 'readImage')) { |
|
| 140 | + return ''; |
|
| 141 | + } |
|
| 142 | + break; |
|
| 143 | + case 'convert': |
|
| 144 | + if (defined('_CONVERT_COMMAND') and _CONVERT_COMMAND == '') { |
|
| 145 | + return ''; |
|
| 146 | + } |
|
| 147 | + break; |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - return generer_url_action('tester', "arg=$process&time=" . time()); |
|
| 150 | + return generer_url_action('tester', "arg=$process&time=" . time()); |
|
| 151 | 151 | } |
@@ -11,49 +11,49 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function formulaires_configurer_langage_charger_dist() { |
| 18 | 18 | |
| 19 | - include_spip('inc/lang'); |
|
| 20 | - $GLOBALS['meta']['langues_proposees'] = ''; |
|
| 21 | - init_langues(); |
|
| 22 | - $langues = explode(',', $GLOBALS['meta']['langues_proposees']); |
|
| 19 | + include_spip('inc/lang'); |
|
| 20 | + $GLOBALS['meta']['langues_proposees'] = ''; |
|
| 21 | + init_langues(); |
|
| 22 | + $langues = explode(',', $GLOBALS['meta']['langues_proposees']); |
|
| 23 | 23 | |
| 24 | 24 | |
| 25 | - $valeurs = [ |
|
| 26 | - 'var_lang_ecrire' => $GLOBALS['spip_lang'], |
|
| 27 | - '_langues' => $langues |
|
| 28 | - ]; |
|
| 25 | + $valeurs = [ |
|
| 26 | + 'var_lang_ecrire' => $GLOBALS['spip_lang'], |
|
| 27 | + '_langues' => $langues |
|
| 28 | + ]; |
|
| 29 | 29 | |
| 30 | - return $valeurs; |
|
| 30 | + return $valeurs; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | function formulaires_configurer_langage_traiter_dist() { |
| 35 | - include_spip('action/converser'); |
|
| 36 | - action_converser_changer_langue(true); |
|
| 35 | + include_spip('action/converser'); |
|
| 36 | + action_converser_changer_langue(true); |
|
| 37 | 37 | |
| 38 | - refuser_traiter_formulaire_ajax(); |
|
| 38 | + refuser_traiter_formulaire_ajax(); |
|
| 39 | 39 | |
| 40 | - // on ne peut pas changer la langue pour tout le hit ici, |
|
| 41 | - // car CVT repasse derriere et retablit la langue avant l'appel a traiter() |
|
| 42 | - // il faut rediriger ! |
|
| 43 | - return ['message_ok' => _T('config_info_enregistree'), 'editable' => true, 'redirect' => self()]; |
|
| 40 | + // on ne peut pas changer la langue pour tout le hit ici, |
|
| 41 | + // car CVT repasse derriere et retablit la langue avant l'appel a traiter() |
|
| 42 | + // il faut rediriger ! |
|
| 43 | + return ['message_ok' => _T('config_info_enregistree'), 'editable' => true, 'redirect' => self()]; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | function afficher_langues_choix($langues, $name, $id, $selected) { |
| 47 | - include_spip('inc/lang'); |
|
| 48 | - $ret = ''; |
|
| 49 | - sort($langues); |
|
| 50 | - foreach ($langues as $l) { |
|
| 51 | - $checked = ($l == $selected) ? ' checked=\'checked\'' : ''; |
|
| 52 | - $ret .= "<div class='choix'>" |
|
| 53 | - . "<input type='radio' name='$name' id='{$id}_$l' value='$l'$checked />" |
|
| 54 | - . "<label for='{$id}_$l'>" . traduire_nom_langue($l) . '</label>' |
|
| 55 | - . '</div>'; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - return $ret; |
|
| 47 | + include_spip('inc/lang'); |
|
| 48 | + $ret = ''; |
|
| 49 | + sort($langues); |
|
| 50 | + foreach ($langues as $l) { |
|
| 51 | + $checked = ($l == $selected) ? ' checked=\'checked\'' : ''; |
|
| 52 | + $ret .= "<div class='choix'>" |
|
| 53 | + . "<input type='radio' name='$name' id='{$id}_$l' value='$l'$checked />" |
|
| 54 | + . "<label for='{$id}_$l'>" . traduire_nom_langue($l) . '</label>' |
|
| 55 | + . '</div>'; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + return $ret; |
|
| 59 | 59 | } |
@@ -11,65 +11,65 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function formulaires_rediriger_article_charger_dist($id_article, $retour = '') { |
| 18 | 18 | |
| 19 | - include_spip('inc/autoriser'); |
|
| 20 | - if (!autoriser('modifier', 'article', $id_article)) { |
|
| 21 | - return false; |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - $row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article=' . intval($id_article)); |
|
| 25 | - if (!$row['id_article']) { |
|
| 26 | - return false; |
|
| 27 | - } |
|
| 28 | - include_spip('inc/lien'); |
|
| 29 | - $redirection = virtuel_redirige($row['virtuel']); |
|
| 30 | - |
|
| 31 | - if ( |
|
| 32 | - !$redirection |
|
| 33 | - and $GLOBALS['meta']['articles_redirection'] != 'oui' |
|
| 34 | - ) { |
|
| 35 | - return false; |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - |
|
| 39 | - include_spip('inc/texte'); |
|
| 40 | - $valeurs = [ |
|
| 41 | - 'redirection' => $redirection, |
|
| 42 | - 'id' => $id_article, |
|
| 43 | - '_afficher_url' => ($redirection ? propre("[->$redirection]") : ''), |
|
| 44 | - ]; |
|
| 45 | - |
|
| 46 | - return $valeurs; |
|
| 19 | + include_spip('inc/autoriser'); |
|
| 20 | + if (!autoriser('modifier', 'article', $id_article)) { |
|
| 21 | + return false; |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + $row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article=' . intval($id_article)); |
|
| 25 | + if (!$row['id_article']) { |
|
| 26 | + return false; |
|
| 27 | + } |
|
| 28 | + include_spip('inc/lien'); |
|
| 29 | + $redirection = virtuel_redirige($row['virtuel']); |
|
| 30 | + |
|
| 31 | + if ( |
|
| 32 | + !$redirection |
|
| 33 | + and $GLOBALS['meta']['articles_redirection'] != 'oui' |
|
| 34 | + ) { |
|
| 35 | + return false; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + |
|
| 39 | + include_spip('inc/texte'); |
|
| 40 | + $valeurs = [ |
|
| 41 | + 'redirection' => $redirection, |
|
| 42 | + 'id' => $id_article, |
|
| 43 | + '_afficher_url' => ($redirection ? propre("[->$redirection]") : ''), |
|
| 44 | + ]; |
|
| 45 | + |
|
| 46 | + return $valeurs; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | function formulaires_rediriger_article_verifier_dist($id_article, $retour = '') { |
| 50 | - $erreurs = []; |
|
| 50 | + $erreurs = []; |
|
| 51 | 51 | |
| 52 | - if (($redirection = _request('redirection')) == $id_article || $redirection == 'art' . $id_article) { |
|
| 53 | - $erreurs['redirection'] = _T('info_redirection_boucle'); |
|
| 54 | - } |
|
| 52 | + if (($redirection = _request('redirection')) == $id_article || $redirection == 'art' . $id_article) { |
|
| 53 | + $erreurs['redirection'] = _T('info_redirection_boucle'); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - return $erreurs; |
|
| 56 | + return $erreurs; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | function formulaires_rediriger_article_traiter_dist($id_article, $retour = '') { |
| 60 | 60 | |
| 61 | - $url = preg_replace(',^\s*https?://$,i', '', rtrim(_request('redirection'))); |
|
| 62 | - if ($url) { |
|
| 63 | - $url = corriger_caracteres($url); |
|
| 64 | - } |
|
| 61 | + $url = preg_replace(',^\s*https?://$,i', '', rtrim(_request('redirection'))); |
|
| 62 | + if ($url) { |
|
| 63 | + $url = corriger_caracteres($url); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - include_spip('action/editer_article'); |
|
| 67 | - article_modifier($id_article, ['virtuel' => $url]); |
|
| 66 | + include_spip('action/editer_article'); |
|
| 67 | + article_modifier($id_article, ['virtuel' => $url]); |
|
| 68 | 68 | |
| 69 | - $js = _AJAX ? '<script type="text/javascript">if (window.ajaxReload) ajaxReload("wysiwyg");</script>' : ''; |
|
| 69 | + $js = _AJAX ? '<script type="text/javascript">if (window.ajaxReload) ajaxReload("wysiwyg");</script>' : ''; |
|
| 70 | 70 | |
| 71 | - return [ |
|
| 72 | - 'message_ok' => ($url ? _T('info_redirection_activee') : _T('info_redirection_desactivee')) . $js, |
|
| 73 | - 'editable' => true |
|
| 74 | - ]; |
|
| 71 | + return [ |
|
| 72 | + 'message_ok' => ($url ? _T('info_redirection_activee') : _T('info_redirection_desactivee')) . $js, |
|
| 73 | + 'editable' => true |
|
| 74 | + ]; |
|
| 75 | 75 | } |
@@ -11,38 +11,38 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function formulaires_configurer_logos_charger_dist() { |
| 18 | - $valeurs = []; |
|
| 19 | - foreach ( |
|
| 20 | - [ |
|
| 21 | - 'activer_logos', |
|
| 22 | - 'activer_logos_survol' |
|
| 23 | - ] as $m |
|
| 24 | - ) { |
|
| 25 | - $valeurs[$m] = $GLOBALS['meta'][$m]; |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - return $valeurs; |
|
| 18 | + $valeurs = []; |
|
| 19 | + foreach ( |
|
| 20 | + [ |
|
| 21 | + 'activer_logos', |
|
| 22 | + 'activer_logos_survol' |
|
| 23 | + ] as $m |
|
| 24 | + ) { |
|
| 25 | + $valeurs[$m] = $GLOBALS['meta'][$m]; |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + return $valeurs; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | function formulaires_configurer_logos_traiter_dist() { |
| 33 | - $res = ['editable' => true]; |
|
| 34 | - foreach ( |
|
| 35 | - [ |
|
| 36 | - 'activer_logos', |
|
| 37 | - 'activer_logos_survol', |
|
| 38 | - ] as $m |
|
| 39 | - ) { |
|
| 40 | - if (!is_null($v = _request($m))) { |
|
| 41 | - ecrire_meta($m, $v == 'oui' ? 'oui' : 'non'); |
|
| 42 | - } |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - $res['message_ok'] = _T('config_info_enregistree'); |
|
| 46 | - |
|
| 47 | - return $res; |
|
| 33 | + $res = ['editable' => true]; |
|
| 34 | + foreach ( |
|
| 35 | + [ |
|
| 36 | + 'activer_logos', |
|
| 37 | + 'activer_logos_survol', |
|
| 38 | + ] as $m |
|
| 39 | + ) { |
|
| 40 | + if (!is_null($v = _request($m))) { |
|
| 41 | + ecrire_meta($m, $v == 'oui' ? 'oui' : 'non'); |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + $res['message_ok'] = _T('config_info_enregistree'); |
|
| 46 | + |
|
| 47 | + return $res; |
|
| 48 | 48 | } |
@@ -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/editer'); |
@@ -32,17 +32,17 @@ discard block |
||
| 32 | 32 | * @return array |
| 33 | 33 | */ |
| 34 | 34 | function lister_statuts_proposes($desc, $publiable = true) { |
| 35 | - if (!isset($desc['statut_textes_instituer'])) { |
|
| 36 | - return false; |
|
| 37 | - } |
|
| 35 | + if (!isset($desc['statut_textes_instituer'])) { |
|
| 36 | + return false; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - $l = $desc['statut_textes_instituer']; |
|
| 40 | - if (!$publiable) { |
|
| 41 | - unset($l['publie']); |
|
| 42 | - unset($l['refuse']); |
|
| 43 | - } |
|
| 39 | + $l = $desc['statut_textes_instituer']; |
|
| 40 | + if (!$publiable) { |
|
| 41 | + unset($l['publie']); |
|
| 42 | + unset($l['refuse']); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - return $l; |
|
| 45 | + return $l; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -64,54 +64,54 @@ discard block |
||
| 64 | 64 | * Environnement du formulaire ou false si aucun affichage à faire. |
| 65 | 65 | */ |
| 66 | 66 | function formulaires_instituer_objet_charger_dist($objet, $id_objet, $retour = '', $editable = true) { |
| 67 | - $editable = ($editable ? true : false); |
|
| 68 | - |
|
| 69 | - $table = table_objet_sql($objet); |
|
| 70 | - $desc = lister_tables_objets_sql($table); |
|
| 71 | - |
|
| 72 | - if (!isset($desc['statut_textes_instituer'])) { |
|
| 73 | - return false; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - if (!autoriser('modifier', $objet, $id_objet)) { |
|
| 77 | - $editable = false; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - // charger le contenu de l'objet |
|
| 81 | - // dont son champ statut |
|
| 82 | - $v = formulaires_editer_objet_charger($objet, $id_objet, 0, 0, '', ''); |
|
| 83 | - |
|
| 84 | - $publiable = true; |
|
| 85 | - $statuts = lister_statuts_proposes($desc); |
|
| 86 | - // tester si on a le droit de publier, si un statut publie existe |
|
| 87 | - if (isset($statuts['publie'])) { |
|
| 88 | - if (!autoriser('instituer', $objet, $id_objet, null, ['statut' => 'publie'])) { |
|
| 89 | - if ($v['statut'] == 'publie') { |
|
| 90 | - $editable = false; |
|
| 91 | - } else { |
|
| 92 | - $publiable = false; |
|
| 93 | - } |
|
| 94 | - } |
|
| 95 | - } |
|
| 96 | - $statuts = lister_statuts_proposes($desc, $editable ? $publiable : true); |
|
| 97 | - if (count($statuts) == 1 and isset($statuts[$v['statut']])) { |
|
| 98 | - $editable = false; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - $valeurs = [ |
|
| 102 | - 'editable' => $editable, |
|
| 103 | - 'statut' => $v['statut'], |
|
| 104 | - '_objet' => $objet, |
|
| 105 | - '_id_objet' => $id_objet, |
|
| 106 | - '_statuts' => $statuts, |
|
| 107 | - '_publiable' => $publiable, |
|
| 108 | - '_label' => isset($desc['texte_changer_statut']) ? $desc['texte_changer_statut'] : 'texte_article_statut', |
|
| 109 | - '_aide' => isset($desc['aide_changer_statut']) ? $desc['aide_changer_statut'] : '', |
|
| 110 | - '_hidden' => "<input type='hidden' name='statut_old' value='" . $v['statut'] . "' />", |
|
| 111 | - ]; |
|
| 112 | - |
|
| 113 | - #if (!count($valeurs['statuts'])) |
|
| 114 | - return $valeurs; |
|
| 67 | + $editable = ($editable ? true : false); |
|
| 68 | + |
|
| 69 | + $table = table_objet_sql($objet); |
|
| 70 | + $desc = lister_tables_objets_sql($table); |
|
| 71 | + |
|
| 72 | + if (!isset($desc['statut_textes_instituer'])) { |
|
| 73 | + return false; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + if (!autoriser('modifier', $objet, $id_objet)) { |
|
| 77 | + $editable = false; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + // charger le contenu de l'objet |
|
| 81 | + // dont son champ statut |
|
| 82 | + $v = formulaires_editer_objet_charger($objet, $id_objet, 0, 0, '', ''); |
|
| 83 | + |
|
| 84 | + $publiable = true; |
|
| 85 | + $statuts = lister_statuts_proposes($desc); |
|
| 86 | + // tester si on a le droit de publier, si un statut publie existe |
|
| 87 | + if (isset($statuts['publie'])) { |
|
| 88 | + if (!autoriser('instituer', $objet, $id_objet, null, ['statut' => 'publie'])) { |
|
| 89 | + if ($v['statut'] == 'publie') { |
|
| 90 | + $editable = false; |
|
| 91 | + } else { |
|
| 92 | + $publiable = false; |
|
| 93 | + } |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + $statuts = lister_statuts_proposes($desc, $editable ? $publiable : true); |
|
| 97 | + if (count($statuts) == 1 and isset($statuts[$v['statut']])) { |
|
| 98 | + $editable = false; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + $valeurs = [ |
|
| 102 | + 'editable' => $editable, |
|
| 103 | + 'statut' => $v['statut'], |
|
| 104 | + '_objet' => $objet, |
|
| 105 | + '_id_objet' => $id_objet, |
|
| 106 | + '_statuts' => $statuts, |
|
| 107 | + '_publiable' => $publiable, |
|
| 108 | + '_label' => isset($desc['texte_changer_statut']) ? $desc['texte_changer_statut'] : 'texte_article_statut', |
|
| 109 | + '_aide' => isset($desc['aide_changer_statut']) ? $desc['aide_changer_statut'] : '', |
|
| 110 | + '_hidden' => "<input type='hidden' name='statut_old' value='" . $v['statut'] . "' />", |
|
| 111 | + ]; |
|
| 112 | + |
|
| 113 | + #if (!count($valeurs['statuts'])) |
|
| 114 | + return $valeurs; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -131,35 +131,35 @@ discard block |
||
| 131 | 131 | * Tableau des erreurs |
| 132 | 132 | */ |
| 133 | 133 | function formulaires_instituer_objet_verifier_dist($objet, $id_objet, $retour = '', $editable = true) { |
| 134 | - $erreurs = []; |
|
| 135 | - // charger le contenu de l'objet |
|
| 136 | - // dont son champ statut |
|
| 137 | - $v = formulaires_editer_objet_charger($objet, $id_objet, 0, 0, '', ''); |
|
| 138 | - |
|
| 139 | - if ($v['statut'] !== _request('statut_old')) { |
|
| 140 | - $erreurs['statut'] = _T('instituer_erreur_statut_a_change'); |
|
| 141 | - } else { |
|
| 142 | - $table = table_objet_sql($objet); |
|
| 143 | - $desc = lister_tables_objets_sql($table); |
|
| 144 | - |
|
| 145 | - $publiable = true; |
|
| 146 | - if ( |
|
| 147 | - isset($v['id_rubrique']) |
|
| 148 | - and !autoriser('publierdans', 'rubrique', $v['id_rubrique']) |
|
| 149 | - ) { |
|
| 150 | - $publiable = false; |
|
| 151 | - } |
|
| 152 | - $l = lister_statuts_proposes($desc, $publiable); |
|
| 153 | - $statut = _request('statut'); |
|
| 154 | - if ( |
|
| 155 | - !isset($l[$statut]) |
|
| 156 | - or !autoriser('instituer', $objet, $id_objet, '', ['statut' => $statut]) |
|
| 157 | - ) { |
|
| 158 | - $erreurs['statut'] = _T('instituer_erreur_statut_non_autorise'); |
|
| 159 | - } |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - return $erreurs; |
|
| 134 | + $erreurs = []; |
|
| 135 | + // charger le contenu de l'objet |
|
| 136 | + // dont son champ statut |
|
| 137 | + $v = formulaires_editer_objet_charger($objet, $id_objet, 0, 0, '', ''); |
|
| 138 | + |
|
| 139 | + if ($v['statut'] !== _request('statut_old')) { |
|
| 140 | + $erreurs['statut'] = _T('instituer_erreur_statut_a_change'); |
|
| 141 | + } else { |
|
| 142 | + $table = table_objet_sql($objet); |
|
| 143 | + $desc = lister_tables_objets_sql($table); |
|
| 144 | + |
|
| 145 | + $publiable = true; |
|
| 146 | + if ( |
|
| 147 | + isset($v['id_rubrique']) |
|
| 148 | + and !autoriser('publierdans', 'rubrique', $v['id_rubrique']) |
|
| 149 | + ) { |
|
| 150 | + $publiable = false; |
|
| 151 | + } |
|
| 152 | + $l = lister_statuts_proposes($desc, $publiable); |
|
| 153 | + $statut = _request('statut'); |
|
| 154 | + if ( |
|
| 155 | + !isset($l[$statut]) |
|
| 156 | + or !autoriser('instituer', $objet, $id_objet, '', ['statut' => $statut]) |
|
| 157 | + ) { |
|
| 158 | + $erreurs['statut'] = _T('instituer_erreur_statut_non_autorise'); |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + return $erreurs; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -178,25 +178,25 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | function formulaires_instituer_objet_traiter_dist($objet, $id_objet, $retour = '', $editable = true) { |
| 180 | 180 | |
| 181 | - $c = ['statut' => _request('statut')]; |
|
| 182 | - // si on a envoye une 'date_posterieure', l'enregistrer |
|
| 183 | - // todo dans le HTML |
|
| 184 | - if ($d = _request('date_posterieure')) { |
|
| 185 | - $c['date'] = $d; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - |
|
| 189 | - include_spip('action/editer_objet'); |
|
| 190 | - if ($err = objet_instituer($objet, $id_objet, $c)) { |
|
| 191 | - $res = ['message_erreur' => $err]; |
|
| 192 | - } else { |
|
| 193 | - $res = ['message_ok' => _T('info_modification_enregistree')]; |
|
| 194 | - if ($retour) { |
|
| 195 | - $res['redirect'] = $retour; |
|
| 196 | - } |
|
| 197 | - set_request('statut'); |
|
| 198 | - set_request('date_posterieure'); |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - return $res; |
|
| 181 | + $c = ['statut' => _request('statut')]; |
|
| 182 | + // si on a envoye une 'date_posterieure', l'enregistrer |
|
| 183 | + // todo dans le HTML |
|
| 184 | + if ($d = _request('date_posterieure')) { |
|
| 185 | + $c['date'] = $d; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + |
|
| 189 | + include_spip('action/editer_objet'); |
|
| 190 | + if ($err = objet_instituer($objet, $id_objet, $c)) { |
|
| 191 | + $res = ['message_erreur' => $err]; |
|
| 192 | + } else { |
|
| 193 | + $res = ['message_ok' => _T('info_modification_enregistree')]; |
|
| 194 | + if ($retour) { |
|
| 195 | + $res['redirect'] = $retour; |
|
| 196 | + } |
|
| 197 | + set_request('statut'); |
|
| 198 | + set_request('date_posterieure'); |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + return $res; |
|
| 202 | 202 | } |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | * Environnement du formulaire |
| 31 | 31 | **/ |
| 32 | 32 | function formulaires_configurer_preferences_menus_charger_dist() { |
| 33 | - // travailler sur des meta fraîches |
|
| 34 | - include_spip('inc/meta'); |
|
| 35 | - lire_metas(); |
|
| 36 | - $valeurs = []; |
|
| 37 | - $valeurs['activer_menudev'] = table_valeur($GLOBALS['visiteur_session'], 'prefs/activer_menudev', 'non'); |
|
| 38 | - $valeurs['menus_favoris'] = obtenir_menus_favoris(); |
|
| 39 | - return $valeurs; |
|
| 33 | + // travailler sur des meta fraîches |
|
| 34 | + include_spip('inc/meta'); |
|
| 35 | + lire_metas(); |
|
| 36 | + $valeurs = []; |
|
| 37 | + $valeurs['activer_menudev'] = table_valeur($GLOBALS['visiteur_session'], 'prefs/activer_menudev', 'non'); |
|
| 38 | + $valeurs['menus_favoris'] = obtenir_menus_favoris(); |
|
| 39 | + return $valeurs; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -47,32 +47,32 @@ discard block |
||
| 47 | 47 | **/ |
| 48 | 48 | function formulaires_configurer_preferences_menus_traiter_dist() { |
| 49 | 49 | |
| 50 | - $activer_menudev = _request('activer_menudev'); |
|
| 51 | - $menus_favoris = _request('menus_favoris'); |
|
| 52 | - $menus_favoris = array_filter($menus_favoris); |
|
| 53 | - $menus_favoris = array_map('intval', $menus_favoris); |
|
| 50 | + $activer_menudev = _request('activer_menudev'); |
|
| 51 | + $menus_favoris = _request('menus_favoris'); |
|
| 52 | + $menus_favoris = array_filter($menus_favoris); |
|
| 53 | + $menus_favoris = array_map('intval', $menus_favoris); |
|
| 54 | 54 | |
| 55 | - if (_request('reset')) { |
|
| 56 | - $menus_favoris = []; |
|
| 57 | - set_request('menus_favoris', null); |
|
| 58 | - } |
|
| 55 | + if (_request('reset')) { |
|
| 56 | + $menus_favoris = []; |
|
| 57 | + set_request('menus_favoris', null); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - // si le menu dev change, ou les menus favoris, on recharge toute la page. |
|
| 61 | - if ( |
|
| 62 | - table_valeur($GLOBALS['visiteur_session'], 'prefs/activer_menudev') != $activer_menudev |
|
| 63 | - or $menus_favoris != obtenir_menus_favoris() |
|
| 64 | - ) { |
|
| 65 | - refuser_traiter_formulaire_ajax(); |
|
| 60 | + // si le menu dev change, ou les menus favoris, on recharge toute la page. |
|
| 61 | + if ( |
|
| 62 | + table_valeur($GLOBALS['visiteur_session'], 'prefs/activer_menudev') != $activer_menudev |
|
| 63 | + or $menus_favoris != obtenir_menus_favoris() |
|
| 64 | + ) { |
|
| 65 | + refuser_traiter_formulaire_ajax(); |
|
| 66 | 66 | |
| 67 | - $GLOBALS['visiteur_session']['prefs']['activer_menudev'] = $activer_menudev; |
|
| 68 | - $GLOBALS['visiteur_session']['prefs']['menus_favoris'] = $menus_favoris; |
|
| 67 | + $GLOBALS['visiteur_session']['prefs']['activer_menudev'] = $activer_menudev; |
|
| 68 | + $GLOBALS['visiteur_session']['prefs']['menus_favoris'] = $menus_favoris; |
|
| 69 | 69 | |
| 70 | - if (intval($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 71 | - include_spip('action/editer_auteur'); |
|
| 72 | - $c = ['prefs' => serialize($GLOBALS['visiteur_session']['prefs'])]; |
|
| 73 | - auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], $c); |
|
| 74 | - } |
|
| 75 | - } |
|
| 70 | + if (intval($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 71 | + include_spip('action/editer_auteur'); |
|
| 72 | + $c = ['prefs' => serialize($GLOBALS['visiteur_session']['prefs'])]; |
|
| 73 | + auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], $c); |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - return ['message_ok' => _T('config_info_enregistree'), 'editable' => true]; |
|
| 77 | + return ['message_ok' => _T('config_info_enregistree'), 'editable' => true]; |
|
| 78 | 78 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | **/ |
| 22 | 22 | |
| 23 | 23 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 24 | - return; |
|
| 24 | + return; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,28 +31,28 @@ discard block |
||
| 31 | 31 | * Environnement du formulaire |
| 32 | 32 | **/ |
| 33 | 33 | function formulaires_configurer_preferences_charger_dist() { |
| 34 | - // travailler sur des meta fraiches |
|
| 35 | - include_spip('inc/meta'); |
|
| 36 | - lire_metas(); |
|
| 34 | + // travailler sur des meta fraiches |
|
| 35 | + include_spip('inc/meta'); |
|
| 36 | + lire_metas(); |
|
| 37 | 37 | |
| 38 | - $valeurs = []; |
|
| 39 | - $valeurs['display_navigation'] = isset($GLOBALS['visiteur_session']['prefs']['display_navigation']) ? $GLOBALS['visiteur_session']['prefs']['display_navigation'] : 'navigation_avec_icones'; |
|
| 40 | - $valeurs['display_outils'] = isset($GLOBALS['visiteur_session']['prefs']['display_outils']) ? $GLOBALS['visiteur_session']['prefs']['display_outils'] : 'oui'; |
|
| 41 | - $valeurs['display'] = (isset($GLOBALS['visiteur_session']['prefs']['display']) and $GLOBALS['visiteur_session']['prefs']['display'] > 0) ? $GLOBALS['visiteur_session']['prefs']['display'] : 2; |
|
| 42 | - $valeurs['couleur'] = (isset($GLOBALS['visiteur_session']['prefs']['couleur']) and $GLOBALS['visiteur_session']['prefs']['couleur'] > 0) ? $GLOBALS['visiteur_session']['prefs']['couleur'] : 1; |
|
| 38 | + $valeurs = []; |
|
| 39 | + $valeurs['display_navigation'] = isset($GLOBALS['visiteur_session']['prefs']['display_navigation']) ? $GLOBALS['visiteur_session']['prefs']['display_navigation'] : 'navigation_avec_icones'; |
|
| 40 | + $valeurs['display_outils'] = isset($GLOBALS['visiteur_session']['prefs']['display_outils']) ? $GLOBALS['visiteur_session']['prefs']['display_outils'] : 'oui'; |
|
| 41 | + $valeurs['display'] = (isset($GLOBALS['visiteur_session']['prefs']['display']) and $GLOBALS['visiteur_session']['prefs']['display'] > 0) ? $GLOBALS['visiteur_session']['prefs']['display'] : 2; |
|
| 42 | + $valeurs['couleur'] = (isset($GLOBALS['visiteur_session']['prefs']['couleur']) and $GLOBALS['visiteur_session']['prefs']['couleur'] > 0) ? $GLOBALS['visiteur_session']['prefs']['couleur'] : 1; |
|
| 43 | 43 | |
| 44 | - $couleurs = charger_fonction('couleurs', 'inc'); |
|
| 45 | - $les_couleurs = $couleurs(); |
|
| 46 | - foreach ($les_couleurs as $k => $c) { |
|
| 47 | - $valeurs['_couleurs_url'][$k] = generer_url_public('style_prive.css', 'ltr=' |
|
| 48 | - . $GLOBALS['spip_lang_left'] . '&' |
|
| 49 | - . $couleurs($k)); |
|
| 50 | - $valeurs['couleurs'][$k] = $c; |
|
| 51 | - } |
|
| 44 | + $couleurs = charger_fonction('couleurs', 'inc'); |
|
| 45 | + $les_couleurs = $couleurs(); |
|
| 46 | + foreach ($les_couleurs as $k => $c) { |
|
| 47 | + $valeurs['_couleurs_url'][$k] = generer_url_public('style_prive.css', 'ltr=' |
|
| 48 | + . $GLOBALS['spip_lang_left'] . '&' |
|
| 49 | + . $couleurs($k)); |
|
| 50 | + $valeurs['couleurs'][$k] = $c; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - $valeurs['imessage'] = $GLOBALS['visiteur_session']['imessage']; |
|
| 53 | + $valeurs['imessage'] = $GLOBALS['visiteur_session']['imessage']; |
|
| 54 | 54 | |
| 55 | - return $valeurs; |
|
| 55 | + return $valeurs; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -63,36 +63,36 @@ discard block |
||
| 63 | 63 | **/ |
| 64 | 64 | function formulaires_configurer_preferences_traiter_dist() { |
| 65 | 65 | |
| 66 | - if ($couleur = _request('couleur')) { |
|
| 67 | - $couleurs = charger_fonction('couleurs', 'inc'); |
|
| 68 | - $les_couleurs = $couleurs([], true); |
|
| 69 | - if (isset($les_couleurs[$couleur])) { |
|
| 70 | - $GLOBALS['visiteur_session']['prefs']['couleur'] = $couleur; |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - if ($display = intval(_request('display'))) { |
|
| 74 | - $GLOBALS['visiteur_session']['prefs']['display'] = $display; |
|
| 75 | - } |
|
| 76 | - if ( |
|
| 77 | - $display_navigation = _request('display_navigation') |
|
| 78 | - and in_array($display_navigation, ['navigation_sans_icone', 'navigation_avec_icones']) |
|
| 79 | - ) { |
|
| 80 | - $GLOBALS['visiteur_session']['prefs']['display_navigation'] = $display_navigation; |
|
| 81 | - } |
|
| 82 | - if (!is_null($display_outils = _request('display_outils'))) { |
|
| 83 | - $GLOBALS['visiteur_session']['prefs']['display_outils'] = ($display_outils ? 'oui' : ''); |
|
| 84 | - } |
|
| 66 | + if ($couleur = _request('couleur')) { |
|
| 67 | + $couleurs = charger_fonction('couleurs', 'inc'); |
|
| 68 | + $les_couleurs = $couleurs([], true); |
|
| 69 | + if (isset($les_couleurs[$couleur])) { |
|
| 70 | + $GLOBALS['visiteur_session']['prefs']['couleur'] = $couleur; |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + if ($display = intval(_request('display'))) { |
|
| 74 | + $GLOBALS['visiteur_session']['prefs']['display'] = $display; |
|
| 75 | + } |
|
| 76 | + if ( |
|
| 77 | + $display_navigation = _request('display_navigation') |
|
| 78 | + and in_array($display_navigation, ['navigation_sans_icone', 'navigation_avec_icones']) |
|
| 79 | + ) { |
|
| 80 | + $GLOBALS['visiteur_session']['prefs']['display_navigation'] = $display_navigation; |
|
| 81 | + } |
|
| 82 | + if (!is_null($display_outils = _request('display_outils'))) { |
|
| 83 | + $GLOBALS['visiteur_session']['prefs']['display_outils'] = ($display_outils ? 'oui' : ''); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - if (intval($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 87 | - include_spip('action/editer_auteur'); |
|
| 88 | - $c = ['prefs' => serialize($GLOBALS['visiteur_session']['prefs'])]; |
|
| 86 | + if (intval($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 87 | + include_spip('action/editer_auteur'); |
|
| 88 | + $c = ['prefs' => serialize($GLOBALS['visiteur_session']['prefs'])]; |
|
| 89 | 89 | |
| 90 | - if ($imessage = _request('imessage') and in_array($imessage, ['oui', 'non'])) { |
|
| 91 | - $c['imessage'] = $imessage; |
|
| 92 | - } |
|
| 90 | + if ($imessage = _request('imessage') and in_array($imessage, ['oui', 'non'])) { |
|
| 91 | + $c['imessage'] = $imessage; |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], $c); |
|
| 95 | - } |
|
| 94 | + auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], $c); |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - return ['message_ok' => _T('config_info_enregistree'), 'editable' => true]; |
|
| 97 | + return ['message_ok' => _T('config_info_enregistree'), 'editable' => true]; |
|
| 98 | 98 | } |
@@ -11,74 +11,74 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Correction typographique francaise |
| 18 | 18 | |
| 19 | 19 | function typographie_fr_dist($letexte) { |
| 20 | 20 | |
| 21 | - static $trans; |
|
| 21 | + static $trans; |
|
| 22 | 22 | |
| 23 | - // Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ; |
|
| 24 | - // 147 = ldquo; 148 = rdquo; ' = zouli apostrophe |
|
| 25 | - if (!$trans) { |
|
| 26 | - $trans = [ |
|
| 27 | - "'" => '’', |
|
| 28 | - ' ' => '~', |
|
| 29 | - '»' => '»', |
|
| 30 | - '«' => '«', |
|
| 31 | - '”' => '”', |
|
| 32 | - '“' => '“', |
|
| 33 | - '°' => '°' |
|
| 34 | - ]; |
|
| 35 | - $chars = [160 => '~', 187 => '»', 171 => '«', 148 => '”', 147 => '“', 176 => '°']; |
|
| 36 | - $chars_trans = array_keys($chars); |
|
| 37 | - $chars = array_values($chars); |
|
| 38 | - $chars_trans = implode(' ', array_map('chr', $chars_trans)); |
|
| 39 | - $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer')); |
|
| 40 | - $chars_trans = explode(' ', $chars_trans); |
|
| 41 | - foreach ($chars as $k => $r) { |
|
| 42 | - $trans[$chars_trans[$k]] = $r; |
|
| 43 | - } |
|
| 44 | - } |
|
| 23 | + // Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ; |
|
| 24 | + // 147 = ldquo; 148 = rdquo; ' = zouli apostrophe |
|
| 25 | + if (!$trans) { |
|
| 26 | + $trans = [ |
|
| 27 | + "'" => '’', |
|
| 28 | + ' ' => '~', |
|
| 29 | + '»' => '»', |
|
| 30 | + '«' => '«', |
|
| 31 | + '”' => '”', |
|
| 32 | + '“' => '“', |
|
| 33 | + '°' => '°' |
|
| 34 | + ]; |
|
| 35 | + $chars = [160 => '~', 187 => '»', 171 => '«', 148 => '”', 147 => '“', 176 => '°']; |
|
| 36 | + $chars_trans = array_keys($chars); |
|
| 37 | + $chars = array_values($chars); |
|
| 38 | + $chars_trans = implode(' ', array_map('chr', $chars_trans)); |
|
| 39 | + $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer')); |
|
| 40 | + $chars_trans = explode(' ', $chars_trans); |
|
| 41 | + foreach ($chars as $k => $r) { |
|
| 42 | + $trans[$chars_trans[$k]] = $r; |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - $letexte = strtr($letexte, $trans); |
|
| 46 | + $letexte = strtr($letexte, $trans); |
|
| 47 | 47 | |
| 48 | - $cherche1 = [ |
|
| 49 | - /* 1 */ |
|
| 50 | - '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S', |
|
| 51 | - /* 2 */ |
|
| 52 | - '/»| --?,|(?::(?!:)| %)(?:\W|$)/S', |
|
| 53 | - /* 3 */ |
|
| 54 | - '/([^[<(!?.])([!?][!?\.]*)/iS', |
|
| 55 | - /* 4 */ |
|
| 56 | - '/«|(?:M(?:M?\.|mes?|r\.?)|[MnN]°) /S' |
|
| 57 | - ]; |
|
| 58 | - $remplace1 = [ |
|
| 59 | - /* 1 */ |
|
| 60 | - '\1~;', |
|
| 61 | - /* 2 */ |
|
| 62 | - '~\0', |
|
| 63 | - /* 3 */ |
|
| 64 | - '\1~\2', |
|
| 65 | - /* 4 */ |
|
| 66 | - '\0~' |
|
| 67 | - ]; |
|
| 68 | - $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 69 | - $letexte = preg_replace('/ *~+ */S', '~', $letexte); |
|
| 48 | + $cherche1 = [ |
|
| 49 | + /* 1 */ |
|
| 50 | + '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S', |
|
| 51 | + /* 2 */ |
|
| 52 | + '/»| --?,|(?::(?!:)| %)(?:\W|$)/S', |
|
| 53 | + /* 3 */ |
|
| 54 | + '/([^[<(!?.])([!?][!?\.]*)/iS', |
|
| 55 | + /* 4 */ |
|
| 56 | + '/«|(?:M(?:M?\.|mes?|r\.?)|[MnN]°) /S' |
|
| 57 | + ]; |
|
| 58 | + $remplace1 = [ |
|
| 59 | + /* 1 */ |
|
| 60 | + '\1~;', |
|
| 61 | + /* 2 */ |
|
| 62 | + '~\0', |
|
| 63 | + /* 3 */ |
|
| 64 | + '\1~\2', |
|
| 65 | + /* 4 */ |
|
| 66 | + '\0~' |
|
| 67 | + ]; |
|
| 68 | + $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 69 | + $letexte = preg_replace('/ *~+ */S', '~', $letexte); |
|
| 70 | 70 | |
| 71 | - $cherche2 = [ |
|
| 72 | - '/([^-\n]|^)--([^-]|$)/S', |
|
| 73 | - ',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 74 | - '/~/' |
|
| 75 | - ]; |
|
| 76 | - $remplace2 = [ |
|
| 77 | - '\1—\2', |
|
| 78 | - '\1\3\4', |
|
| 79 | - ' ' |
|
| 80 | - ]; |
|
| 81 | - $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 71 | + $cherche2 = [ |
|
| 72 | + '/([^-\n]|^)--([^-]|$)/S', |
|
| 73 | + ',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 74 | + '/~/' |
|
| 75 | + ]; |
|
| 76 | + $remplace2 = [ |
|
| 77 | + '\1—\2', |
|
| 78 | + '\1\3\4', |
|
| 79 | + ' ' |
|
| 80 | + ]; |
|
| 81 | + $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 82 | 82 | |
| 83 | - return $letexte; |
|
| 83 | + return $letexte; |
|
| 84 | 84 | } |