@@ -1,3 +1,3 @@ |
||
| 1 | 1 | <?php |
| 2 | - # appel SPIP |
|
| 3 | - include('spip.php'); |
|
| 2 | + # appel SPIP |
|
| 3 | + include('spip.php'); |
|
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('prive/objets/liste/auteurs_fonctions'); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/drapeau_edition'); |
@@ -154,7 +154,7 @@ |
||
| 154 | 154 | ) { |
| 155 | 155 | return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self()); |
| 156 | 156 | } elseif (strlen($email) and autoriser('voir', 'auteur', $id_auteur)) { |
| 157 | - return 'mailto:' . $email; |
|
| 157 | + return 'mailto:'.$email; |
|
| 158 | 158 | } else { |
| 159 | 159 | return ''; |
| 160 | 160 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Fonctions |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -29,29 +29,29 @@ discard block |
||
| 29 | 29 | * @param bool $left |
| 30 | 30 | */ |
| 31 | 31 | function critere_compteur_articles_filtres_dist($idb, &$boucles, $crit, $left = false) { |
| 32 | - $boucle = &$boucles[$idb]; |
|
| 32 | + $boucle = &$boucles[$idb]; |
|
| 33 | 33 | |
| 34 | - $_statut = calculer_liste($crit->param[0], [], $boucles, $boucle->id_parent); |
|
| 34 | + $_statut = calculer_liste($crit->param[0], [], $boucles, $boucle->id_parent); |
|
| 35 | 35 | |
| 36 | - $not = ''; |
|
| 37 | - if ($crit->not) { |
|
| 38 | - $not = ", 'NOT'"; |
|
| 39 | - } |
|
| 40 | - $boucle->from['LAA'] = 'spip_auteurs_liens'; |
|
| 41 | - $boucle->from_type['LAA'] = 'left'; |
|
| 42 | - $boucle->join['LAA'] = ["'auteurs'", "'id_auteur'", "'id_auteur'", "'LAA.objet=\'article\''"]; |
|
| 36 | + $not = ''; |
|
| 37 | + if ($crit->not) { |
|
| 38 | + $not = ", 'NOT'"; |
|
| 39 | + } |
|
| 40 | + $boucle->from['LAA'] = 'spip_auteurs_liens'; |
|
| 41 | + $boucle->from_type['LAA'] = 'left'; |
|
| 42 | + $boucle->join['LAA'] = ["'auteurs'", "'id_auteur'", "'id_auteur'", "'LAA.objet=\'article\''"]; |
|
| 43 | 43 | |
| 44 | - $boucle->from['articles'] = 'spip_articles'; |
|
| 45 | - $boucle->from_type['articles'] = 'left'; |
|
| 46 | - $boucle->join['articles'] = [ |
|
| 47 | - "'LAA'", |
|
| 48 | - "'id_article'", |
|
| 49 | - "'id_objet'", |
|
| 50 | - "'(articles.statut IS NULL OR '.sql_in('articles.statut',_q($_statut)$not).')'" |
|
| 51 | - ]; |
|
| 44 | + $boucle->from['articles'] = 'spip_articles'; |
|
| 45 | + $boucle->from_type['articles'] = 'left'; |
|
| 46 | + $boucle->join['articles'] = [ |
|
| 47 | + "'LAA'", |
|
| 48 | + "'id_article'", |
|
| 49 | + "'id_objet'", |
|
| 50 | + "'(articles.statut IS NULL OR '.sql_in('articles.statut',_q($_statut)$not).')'" |
|
| 51 | + ]; |
|
| 52 | 52 | |
| 53 | - $boucle->select[] = 'COUNT(articles.id_article) AS compteur_articles'; |
|
| 54 | - $boucle->group[] = 'auteurs.id_auteur'; |
|
| 53 | + $boucle->select[] = 'COUNT(articles.id_article) AS compteur_articles'; |
|
| 54 | + $boucle->group[] = 'auteurs.id_auteur'; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * Pile complétée par le code à générer |
| 70 | 70 | */ |
| 71 | 71 | function balise_COMPTEUR_ARTICLES_dist($p) { |
| 72 | - return rindex_pile($p, 'compteur_articles', 'compteur_articles_filtres'); |
|
| 72 | + return rindex_pile($p, 'compteur_articles', 'compteur_articles_filtres'); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
@@ -85,44 +85,44 @@ discard block |
||
| 85 | 85 | * @return string |
| 86 | 86 | */ |
| 87 | 87 | function afficher_initiale($url, $initiale, $compteur, $debut, $pas) { |
| 88 | - static $memo = null; |
|
| 89 | - static $res = []; |
|
| 90 | - $out = ''; |
|
| 91 | - if ( |
|
| 92 | - !$memo |
|
| 93 | - or (!$initiale and !$url) |
|
| 94 | - or ($initiale !== $memo['initiale']) |
|
| 95 | - ) { |
|
| 96 | - $newcompt = intval(floor(($compteur - 1) / $pas) * $pas); |
|
| 97 | - // si fin de la pagination et une seule entree, ne pas l'afficher, ca ne sert a rien |
|
| 98 | - if (!$initiale and !$url and !$memo['compteur']) { |
|
| 99 | - $memo = null; |
|
| 100 | - } |
|
| 101 | - if ($memo) { |
|
| 102 | - $on = (($memo['compteur'] <= $debut) |
|
| 103 | - and ( |
|
| 104 | - $newcompt > $debut or ($newcompt == $debut and $newcompt == $memo['compteur']) |
|
| 105 | - )); |
|
| 106 | - $res[] = lien_ou_expose($memo['url'], $memo['initiale'], $on, 'lien_pagination'); |
|
| 107 | - } |
|
| 108 | - if ($initiale) { |
|
| 109 | - $memo = [ |
|
| 110 | - 'entree' => isset($memo['entree']) ? $memo['entree'] + 1 : 0, |
|
| 111 | - 'initiale' => $initiale, |
|
| 112 | - 'url' => parametre_url($url, 'i', $initiale), |
|
| 113 | - 'compteur' => $newcompt |
|
| 114 | - ]; |
|
| 115 | - } |
|
| 116 | - } |
|
| 117 | - if (!$initiale and !$url) { |
|
| 118 | - if (count($res) > 1) { |
|
| 119 | - $out = implode(' ', $res); |
|
| 120 | - } |
|
| 121 | - $memo = null; |
|
| 122 | - $res = []; |
|
| 123 | - } |
|
| 88 | + static $memo = null; |
|
| 89 | + static $res = []; |
|
| 90 | + $out = ''; |
|
| 91 | + if ( |
|
| 92 | + !$memo |
|
| 93 | + or (!$initiale and !$url) |
|
| 94 | + or ($initiale !== $memo['initiale']) |
|
| 95 | + ) { |
|
| 96 | + $newcompt = intval(floor(($compteur - 1) / $pas) * $pas); |
|
| 97 | + // si fin de la pagination et une seule entree, ne pas l'afficher, ca ne sert a rien |
|
| 98 | + if (!$initiale and !$url and !$memo['compteur']) { |
|
| 99 | + $memo = null; |
|
| 100 | + } |
|
| 101 | + if ($memo) { |
|
| 102 | + $on = (($memo['compteur'] <= $debut) |
|
| 103 | + and ( |
|
| 104 | + $newcompt > $debut or ($newcompt == $debut and $newcompt == $memo['compteur']) |
|
| 105 | + )); |
|
| 106 | + $res[] = lien_ou_expose($memo['url'], $memo['initiale'], $on, 'lien_pagination'); |
|
| 107 | + } |
|
| 108 | + if ($initiale) { |
|
| 109 | + $memo = [ |
|
| 110 | + 'entree' => isset($memo['entree']) ? $memo['entree'] + 1 : 0, |
|
| 111 | + 'initiale' => $initiale, |
|
| 112 | + 'url' => parametre_url($url, 'i', $initiale), |
|
| 113 | + 'compteur' => $newcompt |
|
| 114 | + ]; |
|
| 115 | + } |
|
| 116 | + } |
|
| 117 | + if (!$initiale and !$url) { |
|
| 118 | + if (count($res) > 1) { |
|
| 119 | + $out = implode(' ', $res); |
|
| 120 | + } |
|
| 121 | + $memo = null; |
|
| 122 | + $res = []; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - return $out; |
|
| 125 | + return $out; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -141,24 +141,24 @@ discard block |
||
| 141 | 141 | * @return string |
| 142 | 142 | */ |
| 143 | 143 | function auteur_lien_messagerie($id_auteur, $en_ligne, $statut, $imessage, $email = '') { |
| 144 | - static $time = null; |
|
| 145 | - if (!in_array($statut, ['0minirezo', '1comite'])) { |
|
| 146 | - return ''; |
|
| 147 | - } |
|
| 144 | + static $time = null; |
|
| 145 | + if (!in_array($statut, ['0minirezo', '1comite'])) { |
|
| 146 | + return ''; |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - if (is_null($time)) { |
|
| 150 | - $time = time(); |
|
| 151 | - } |
|
| 152 | - $parti = (($time - strtotime($en_ligne)) > 15 * 60); |
|
| 149 | + if (is_null($time)) { |
|
| 150 | + $time = time(); |
|
| 151 | + } |
|
| 152 | + $parti = (($time - strtotime($en_ligne)) > 15 * 60); |
|
| 153 | 153 | |
| 154 | - if ( |
|
| 155 | - $imessage != 'non' and !$parti // historique : est-ce que ca a encore un sens de limiter vu qu'on a la notification par email ? |
|
| 156 | - and $GLOBALS['meta']['messagerie_agenda'] != 'non' |
|
| 157 | - ) { |
|
| 158 | - return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self()); |
|
| 159 | - } elseif (strlen($email) and autoriser('voir', 'auteur', $id_auteur)) { |
|
| 160 | - return 'mailto:' . $email; |
|
| 161 | - } else { |
|
| 162 | - return ''; |
|
| 163 | - } |
|
| 154 | + if ( |
|
| 155 | + $imessage != 'non' and !$parti // historique : est-ce que ca a encore un sens de limiter vu qu'on a la notification par email ? |
|
| 156 | + and $GLOBALS['meta']['messagerie_agenda'] != 'non' |
|
| 157 | + ) { |
|
| 158 | + return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self()); |
|
| 159 | + } elseif (strlen($email) and autoriser('voir', 'auteur', $id_auteur)) { |
|
| 160 | + return 'mailto:' . $email; |
|
| 161 | + } else { |
|
| 162 | + return ''; |
|
| 163 | + } |
|
| 164 | 164 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 7 | - return; |
|
| 7 | + return; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | include_spip('inc/filtres_selecteur_generique'); |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | // Attention a l'ordre: |
| 81 | 81 | // si l'un des 3 est un sous-rep d'un autre, le mettre avant. |
| 82 | 82 | |
| 83 | -define('_EXTRAIRE_PLUGIN', '@(' . _DIR_PLUGINS_AUTO . '|' . _DIR_PLUGINS . '|' . _DIR_PLUGINS_DIST . ')/?([^/]+)/@'); |
|
| 83 | +define('_EXTRAIRE_PLUGIN', '@('._DIR_PLUGINS_AUTO.'|'._DIR_PLUGINS.'|'._DIR_PLUGINS_DIST.')/?([^/]+)/@'); |
|
| 84 | 84 | |
| 85 | 85 | // Recuperer la version compilee de plugin.xml et normaliser |
| 86 | 86 | // Si ce n'est pas un plugin, dire qu'il faut prendre la table std des meta. |
| 87 | 87 | function formulaires_configurer_metas_infos($form) { |
| 88 | 88 | |
| 89 | - $path = find_in_path($form . '.' . _EXTENSION_SQUELETTES, 'formulaires/'); |
|
| 89 | + $path = find_in_path($form.'.'._EXTENSION_SQUELETTES, 'formulaires/'); |
|
| 90 | 90 | if (!$path) { |
| 91 | 91 | return ''; |
| 92 | 92 | } // cas traite en amont normalement. |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $prefix = $infos['prefix']; |
| 106 | 106 | $infos['path'] = $path; |
| 107 | 107 | if (!isset($infos['meta'])) { |
| 108 | - $infos['meta'] = ($prefix . '_metas'); |
|
| 108 | + $infos['meta'] = ($prefix.'_metas'); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | return $infos; |
@@ -11,68 +11,68 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function formulaires_configurer_metas_charger_dist($form) { |
| 18 | - $f = charger_fonction('charger', "formulaires/$form", true); |
|
| 19 | - if ($f) { |
|
| 20 | - return $f($form); |
|
| 21 | - } else { |
|
| 22 | - $infos = formulaires_configurer_metas_infos($form); |
|
| 23 | - if (!is_array($infos)) { |
|
| 24 | - return $infos; |
|
| 25 | - } |
|
| 18 | + $f = charger_fonction('charger', "formulaires/$form", true); |
|
| 19 | + if ($f) { |
|
| 20 | + return $f($form); |
|
| 21 | + } else { |
|
| 22 | + $infos = formulaires_configurer_metas_infos($form); |
|
| 23 | + if (!is_array($infos)) { |
|
| 24 | + return $infos; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - return $GLOBALS[$infos['meta']]; |
|
| 28 | - } |
|
| 27 | + return $GLOBALS[$infos['meta']]; |
|
| 28 | + } |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | function formulaires_configurer_metas_verifier_dist($form) { |
| 32 | - $f = charger_fonction('verifier', "formulaires/$form", true); |
|
| 32 | + $f = charger_fonction('verifier', "formulaires/$form", true); |
|
| 33 | 33 | |
| 34 | - return $f ? $f($form) : []; |
|
| 34 | + return $f ? $f($form) : []; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | function formulaires_configurer_metas_traiter_dist($form) { |
| 38 | - $f = charger_fonction('traiter', "formulaires/$form", true); |
|
| 39 | - if ($f) { |
|
| 40 | - return $f($form); |
|
| 41 | - } else { |
|
| 42 | - $infos = formulaires_configurer_metas_infos($form); |
|
| 43 | - if (!is_array($infos)) { |
|
| 44 | - return $infos; |
|
| 45 | - } // fait ci-dessus en fait |
|
| 46 | - $vars = formulaires_configurer_metas_recense($infos['path'], PREG_PATTERN_ORDER); |
|
| 47 | - $meta = $infos['meta']; |
|
| 48 | - foreach (array_unique($vars[2]) as $k) { |
|
| 49 | - $v = _request($k); |
|
| 50 | - ecrire_meta($k, is_array($v) ? serialise($v) : $v, 'oui', $meta); |
|
| 51 | - } |
|
| 38 | + $f = charger_fonction('traiter', "formulaires/$form", true); |
|
| 39 | + if ($f) { |
|
| 40 | + return $f($form); |
|
| 41 | + } else { |
|
| 42 | + $infos = formulaires_configurer_metas_infos($form); |
|
| 43 | + if (!is_array($infos)) { |
|
| 44 | + return $infos; |
|
| 45 | + } // fait ci-dessus en fait |
|
| 46 | + $vars = formulaires_configurer_metas_recense($infos['path'], PREG_PATTERN_ORDER); |
|
| 47 | + $meta = $infos['meta']; |
|
| 48 | + foreach (array_unique($vars[2]) as $k) { |
|
| 49 | + $v = _request($k); |
|
| 50 | + ecrire_meta($k, is_array($v) ? serialise($v) : $v, 'oui', $meta); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - return !isset($infos['prefix']) ? [] |
|
| 54 | - : ['redirect' => generer_url_ecrire($infos['prefix'])]; |
|
| 55 | - } |
|
| 53 | + return !isset($infos['prefix']) ? [] |
|
| 54 | + : ['redirect' => generer_url_ecrire($infos['prefix'])]; |
|
| 55 | + } |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // version amelioree de la RegExp de cfg_formulaire. |
| 59 | 59 | define( |
| 60 | - '_EXTRAIRE_SAISIES', |
|
| 61 | - '#<(select|textarea|input)[^>]*\sname=["\'](\w+)(\[\w*\])?["\'](?: class=["\']([^\'"]*)["\'])?( multiple=)?[^>]*?>#ims' |
|
| 60 | + '_EXTRAIRE_SAISIES', |
|
| 61 | + '#<(select|textarea|input)[^>]*\sname=["\'](\w+)(\[\w*\])?["\'](?: class=["\']([^\'"]*)["\'])?( multiple=)?[^>]*?>#ims' |
|
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | 64 | // determiner la liste des noms des saisies d'un formulaire |
| 65 | 65 | // (a refaire avec SAX) |
| 66 | 66 | function formulaires_configurer_metas_recense($form, $opt = '') { |
| 67 | - if (!$opt) { |
|
| 68 | - $opt = PREG_SET_ORDER; |
|
| 69 | - } |
|
| 70 | - $f = file_get_contents($form); |
|
| 71 | - if ($f and preg_match_all(_EXTRAIRE_SAISIES, $f, $r, $opt)) { |
|
| 72 | - return $r; |
|
| 73 | - } else { |
|
| 74 | - return []; |
|
| 75 | - } |
|
| 67 | + if (!$opt) { |
|
| 68 | + $opt = PREG_SET_ORDER; |
|
| 69 | + } |
|
| 70 | + $f = file_get_contents($form); |
|
| 71 | + if ($f and preg_match_all(_EXTRAIRE_SAISIES, $f, $r, $opt)) { |
|
| 72 | + return $r; |
|
| 73 | + } else { |
|
| 74 | + return []; |
|
| 75 | + } |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // Repertoires potentiels des plugins, ce serait bien d'avoir ça ailleurs |
@@ -86,27 +86,27 @@ discard block |
||
| 86 | 86 | // Si ce n'est pas un plugin, dire qu'il faut prendre la table std des meta. |
| 87 | 87 | function formulaires_configurer_metas_infos($form) { |
| 88 | 88 | |
| 89 | - $path = find_in_path($form . '.' . _EXTENSION_SQUELETTES, 'formulaires/'); |
|
| 90 | - if (!$path) { |
|
| 91 | - return ''; |
|
| 92 | - } // cas traite en amont normalement. |
|
| 93 | - if (!preg_match(_EXTRAIRE_PLUGIN, $path, $m)) { |
|
| 94 | - return ['path' => $path, 'meta' => 'meta']; |
|
| 95 | - } |
|
| 96 | - $plugin = $m[2]; |
|
| 97 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 98 | - $infos = $get_infos($plugin, false, $m[1]); |
|
| 99 | - if (!is_array($infos)) { |
|
| 100 | - return _T('erreur_plugin_nom_manquant'); |
|
| 101 | - } |
|
| 102 | - if (isset($infos['erreur'])) { |
|
| 103 | - return $infos['erreur'][0]; |
|
| 104 | - } |
|
| 105 | - $prefix = $infos['prefix']; |
|
| 106 | - $infos['path'] = $path; |
|
| 107 | - if (!isset($infos['meta'])) { |
|
| 108 | - $infos['meta'] = ($prefix . '_metas'); |
|
| 109 | - } |
|
| 89 | + $path = find_in_path($form . '.' . _EXTENSION_SQUELETTES, 'formulaires/'); |
|
| 90 | + if (!$path) { |
|
| 91 | + return ''; |
|
| 92 | + } // cas traite en amont normalement. |
|
| 93 | + if (!preg_match(_EXTRAIRE_PLUGIN, $path, $m)) { |
|
| 94 | + return ['path' => $path, 'meta' => 'meta']; |
|
| 95 | + } |
|
| 96 | + $plugin = $m[2]; |
|
| 97 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 98 | + $infos = $get_infos($plugin, false, $m[1]); |
|
| 99 | + if (!is_array($infos)) { |
|
| 100 | + return _T('erreur_plugin_nom_manquant'); |
|
| 101 | + } |
|
| 102 | + if (isset($infos['erreur'])) { |
|
| 103 | + return $infos['erreur'][0]; |
|
| 104 | + } |
|
| 105 | + $prefix = $infos['prefix']; |
|
| 106 | + $infos['path'] = $path; |
|
| 107 | + if (!isset($infos['meta'])) { |
|
| 108 | + $infos['meta'] = ($prefix . '_metas'); |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - return $infos; |
|
| 111 | + return $infos; |
|
| 112 | 112 | } |
@@ -142,5 +142,5 @@ |
||
| 142 | 142 | break; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - return generer_url_action('tester', "arg=$process&time=" . time()); |
|
| 145 | + return generer_url_action('tester', "arg=$process&time=".time()); |
|
| 146 | 146 | } |
@@ -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 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | $checked = ($l == $selected) ? ' checked=\'checked\'' : ''; |
| 52 | 52 | $ret .= "<div class='choix'>" |
| 53 | 53 | . "<input type='radio' name='$name' id='{$id}_$l' value='$l'$checked />" |
| 54 | - . "<label for='{$id}_$l'>" . traduire_nom_langue($l) . '</label>' |
|
| 54 | + . "<label for='{$id}_$l'>".traduire_nom_langue($l).'</label>' |
|
| 55 | 55 | . '</div>'; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -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,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,20 +24,20 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | function deplacement_restreint($objet, $statut) { |
| 26 | 26 | |
| 27 | - switch ($objet) { |
|
| 28 | - case 'rubrique': |
|
| 29 | - return (!$GLOBALS['connect_toutes_rubriques']); |
|
| 30 | - break; |
|
| 31 | - case 'article': |
|
| 32 | - case 'site': |
|
| 33 | - case 'syndic': |
|
| 34 | - case 'breve': |
|
| 35 | - return ($statut == 'publie'); |
|
| 36 | - break; |
|
| 37 | - default: |
|
| 38 | - return ($statut ? $statut == 'publie' : false); |
|
| 39 | - break; |
|
| 40 | - } |
|
| 27 | + switch ($objet) { |
|
| 28 | + case 'rubrique': |
|
| 29 | + return (!$GLOBALS['connect_toutes_rubriques']); |
|
| 30 | + break; |
|
| 31 | + case 'article': |
|
| 32 | + case 'site': |
|
| 33 | + case 'syndic': |
|
| 34 | + case 'breve': |
|
| 35 | + return ($statut == 'publie'); |
|
| 36 | + break; |
|
| 37 | + default: |
|
| 38 | + return ($statut ? $statut == 'publie' : false); |
|
| 39 | + break; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - return false; |
|
| 42 | + return false; |
|
| 43 | 43 | } |