Subversion Repositories Applications.framework

Rev

Rev 166 | Rev 170 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 166 Rev 168
Line 10... Line 10...
10
 * @author		Aurélien PERONNET <aurelien@tela-botanica.org>
10
 * @author		Aurélien PERONNET <aurelien@tela-botanica.org>
11
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
11
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
12
 * @copyright	2009 Tela-Botanica
12
 * @copyright	2009 Tela-Botanica
13
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
13
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
14
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
14
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
15
 * @version		SVN: $$Id: Controleur.php 166 2010-03-10 16:32:13Z aurelien $$
15
 * @version		SVN: $$Id: Controleur.php 168 2010-03-19 17:19:31Z jpm $$
16
 * @link		/doc/framework/
16
 * @link		/doc/framework/
17
 *
17
 *
18
 */
18
 */
19
abstract class Controleur {
19
abstract class Controleur {
20
	/**
20
	/**
Line 133... Line 133...
133
 
133
 
134
	/**
134
	/**
135
	 * Procédure vérifiant l'encodage des tableaux $_GET et $_POST et les transcodant dans l'encodage de l'application
135
	 * Procédure vérifiant l'encodage des tableaux $_GET et $_POST et les transcodant dans l'encodage de l'application
136
	 */
136
	 */
137
	protected function verifierEtReencoderTableauRequete() {
137
	protected function verifierEtReencoderTableauRequete() {
138
		if(Config::get('sortie_encodage') != Config::get('appli_encodage')) {
-
 
139
 
138
		if (Config::get('sortie_encodage') != Config::get('appli_encodage')) {
140
			$_POST = $this->encoderTableau($_POST, Config::get('appli_encodage'),Config::get('sortie_encodage'));
139
			$_POST = $this->encoderTableau($_POST, Config::get('appli_encodage'), Config::get('sortie_encodage'));
141
			$_GET = $this->encoderTableau($_GET, Config::get('appli_encodage'),Config::get('sortie_encodage'));
-
 
142
 
140
			$_GET = $this->encoderTableau($_GET, Config::get('appli_encodage'), Config::get('sortie_encodage'));
143
		}
141
		}
Line 144... Line 142...
144
	}
142
	}
145
 
143
 
Line 149... Line 147...
149
	 * @param $encodage_sortie String l'encodage vers lequel on doit transcoder
147
	 * @param $encodage_sortie String l'encodage vers lequel on doit transcoder
150
	 * @param $encodage_entree String l'encodage original des chaines du tableau (optionnel)
148
	 * @param $encodage_entree String l'encodage original des chaines du tableau (optionnel)
151
	 * @return Array Le tableau encodé dans l'encodage de sortie
149
	 * @return Array Le tableau encodé dans l'encodage de sortie
152
	 *
150
	 *
153
	 */
151
	 */
154
	final protected function encoderTableau($tableau,$encodage_sortie,$encodage_entree = null) {
152
	final protected function encoderTableau($tableau, $encodage_sortie, $encodage_entree = null) {
155
 
-
 
156
		if (is_array($tableau)) {
153
		if (is_array($tableau)) {
157
 
-
 
158
			foreach ($tableau as $cle => $valeur) {
154
			foreach ($tableau as $cle => $valeur) {
159
 
-
 
160
				if (is_array($valeur)) {
155
				if (is_array($valeur)) {
161
				 	$tableau[$cle] = $this->encoderTableau($tableau[$cle]);
156
				 	$tableau[$cle] = $this->encoderTableau($tableau[$cle]);
162
				}
-
 
163
				else {
157
				} else {
164
					$tableau[$cle] = mb_convert_encoding($valeur,$encodage_sortie,$encodage_entree);
158
					$tableau[$cle] = mb_convert_encoding($valeur, $encodage_sortie, $encodage_entree);
165
				}
159
				}
166
			}
160
			}
167
		}
161
		}
Line 168... Line 162...
168
 
162