Subversion Repositories eFlore/Applications.cel

Rev

Rev 1123 | Rev 1215 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1123 Rev 1209
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Widget fournissant des interfaces de saisies simplifiée pour différent projets.
4
 * Widget fournissant des interfaces de saisies simplifiée pour différent projets.
5
 * Encodage en entrée : utf8
5
 * Encodage en entrée : utf8
6
 * Encodage en sortie : utf8
6
 * Encodage en sortie : utf8
7
 *
7
 *
8
 * Cas d'utilisation et documentation :
8
 * Cas d'utilisation et documentation :
9
 * @link http://www.tela-botanica.org/wikini/eflore/wakka.php?wiki=AideCELWidgetSaisie
9
 * @link http://www.tela-botanica.org/wikini/eflore/wakka.php?wiki=AideCELWidgetSaisie
10
 *
10
 *
11
 * Paramètres :
11
 * Paramètres :
12
 * ===> projet = chaine  [par défaut : Biodiversite34]
12
 * ===> projet = chaine  [par défaut : Biodiversite34]
13
 * Indique quel projet nous voulons charger
13
 * Indique quel projet nous voulons charger
14
 *
14
 *
15
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
15
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
16
 * @license		GPL v3 <http://www.gnu.org/licenses/gpl.txt>
16
 * @license		GPL v3 <http://www.gnu.org/licenses/gpl.txt>
17
 * @license		CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
17
 * @license		CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
18
 * @version		$Id$
18
 * @version		$Id$
19
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
19
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
20
 */
20
 */
21
class Saisie extends WidgetCommun {
21
class Saisie extends WidgetCommun {
22
 
22
 
23
	const DS = DIRECTORY_SEPARATOR;
23
	const DS = DIRECTORY_SEPARATOR;
24
	const PROJET_DEFAUT = 'biodiversite34';
24
	const PROJET_DEFAUT = 'defaut';
25
	const WS_SAISIE = "CelWidgetSaisie";
25
	const WS_SAISIE = "CelWidgetSaisie";
-
 
26
	const WS_NOM = "noms";
-
 
27
	const NS_PROJET = "bdtfx";
-
 
28
	const EFLORE_API_VERSION = "0.1";
26
 
29
 
27
	private $projet = null;
30
	private $projet = null;
28
	private $configProjet = null;
31
	private $configProjet = null;
29
 
32
 
30
	/**
33
	/**
31
	 * Méthode appelée par défaut pour charger ce widget.
34
	 * Méthode appelée par défaut pour charger ce widget.
32
	 */
35
	 */
33
	public function executer() {
36
	public function executer() {
34
		$retour = null;
37
		$retour = null;
35
		extract($this->parametres);
38
		extract($this->parametres);
36
 
-
 
37
		if (!isset($projet)) {
39
 
38
			$this->projet = self::PROJET_DEFAUT;
-
 
39
		} else {
-
 
40
			$this->projet = $projet;
-
 
41
		}
40
		$this->projet = isset($projet) ? $projet : self::PROJET_DEFAUT;
42
		$this->chargerConfigProjet();
41
		$this->chargerConfigProjet();
43
 
42
 
44
		$service = (isset($service)) ? $service : $this->projet;
43
		$service = isset($service) ? $service : 'widget';
45
		$methode = $this->traiterNomMethodeExecuter($service);
44
		$methode = $this->traiterNomMethodeExecuter($service);
46
		if (method_exists($this, $methode)) {
45
		if (method_exists($this, $methode)) {
47
			$retour = $this->$methode();
46
			$retour = $this->$methode();
48
		} else {
47
		} else {
49
			$this->messages[] = "Ce type de service '$methode' n'est pas disponible.";
48
			$this->messages[] = "Ce type de service '$methode' n'est pas disponible.";
50
		}
49
		}
51
 
50
 
52
		$contenu = null;
51
		$contenu = null;
53
		$mime = null;
52
		$mime = null;
54
		if (is_array($retour) && array_key_exists('squelette', $retour)) {
53
		if (is_array($retour) && array_key_exists('squelette', $retour)) {
55
			$ext = (isset($retour['squelette_ext'])) ? $retour['squelette_ext'] : '.tpl.html';
54
			$ext = (isset($retour['squelette_ext'])) ? $retour['squelette_ext'] : '.tpl.html';
56
			$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.$this->projet.self::DS.$retour['squelette'].$ext;
55
			$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.$this->projet.self::DS.$retour['squelette'].$ext;
57
			$contenu = $this->traiterSquelettePhp($squelette, $retour['donnees']);
56
			$contenu = $this->traiterSquelettePhp($squelette, $retour['donnees']);
58
			$mime = isset($retour['mime']) ? $retour['mime'] : null;
57
			$mime = isset($retour['mime']) ? $retour['mime'] : null;
59
		} else {
58
		} else {
60
			if (count($this->messages) == 0) {
59
			if (count($this->messages) == 0) {
61
				$this->messages[] = "La méthode du sous-service ne renvoie pas les données dans le bon format.";
60
				$this->messages[] = "La méthode du sous-service ne renvoie pas les données dans le bon format.";
62
			}
61
			}
63
			$contenu = 'Un problème est survenu : '.print_r($this->messages, true);
62
			$contenu = 'Un problème est survenu : '.print_r($this->messages, true);
64
		}
63
		}
65
 
64
 
66
		$this->envoyer($contenu, $mime);
65
		$this->envoyer($contenu, $mime);
67
	}
66
	}
68
 
67
 
69
	private function chargerConfigProjet() {
68
	private function chargerConfigProjet() {
70
		$fichier_config = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'.ini';
69
		$fichier_config = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'.ini';
71
		if (file_exists($fichier_config)) {
70
		if (file_exists($fichier_config)) {
72
			if (!$this->configProjet	= parse_ini_file($fichier_config)) {
71
			if (!$this->configProjet	= parse_ini_file($fichier_config)) {
73
				$this->messages[] = "Le fichier ini '$fichier_config' du projet n'a pu être chargé.";
72
				$this->messages[] = "Le fichier ini '$fichier_config' du projet n'a pu être chargé.";
74
			}
73
			}
75
		} else {
74
		} else {
76
			$this->messages[] = "Le fichier ini '$fichier_config' du projet n'existe pas.";
75
			$this->messages[] = "Le fichier ini '$fichier_config' du projet n'existe pas.";
77
		}
76
		}
78
	}
77
	}
79
 
78
 
80
	public function executerTaxons() {
-
 
81
		$widget['squelette'] = $this->projet.'_taxons';
-
 
82
		$widget['squelette_ext'] = '.tpl.js';
-
 
83
		$widget['donnees'] = array();
-
 
84
		$methode = 'recupererListeTaxon'.str_replace(' ', '', ucwords(str_replace('-', ' ', strtolower($this->projet))));
-
 
85
		$taxons = $this->$methode();
-
 
86
		$taxons_tries = array();
-
 
87
		foreach ($taxons as $taxon) {
-
 
88
			$taxons_tries[$taxon['num_nom_sel']] = $taxon;
-
 
89
		}
-
 
90
		$widget['donnees']['taxons'] = json_encode($taxons_tries);
-
 
91
		return  $widget;
-
 
92
	}
-
 
93
 
-
 
94
	public function executerUploadImage() {
-
 
95
		$retour = array(
-
 
96
			'squelette' => $this->projet.'_image',
-
 
97
			'squelette_ext' => '.tpl.xml',
-
 
98
			'mime' => 'text/xml',
-
 
99
			'donnees' => array(
-
 
100
				'urlMiniature' => '',
-
 
101
				'imageNom' => '',
-
 
102
				'message' => '',
-
 
103
				'debogage' => ''));
-
 
104
		$message = '';
-
 
105
		$debogage = '';
-
 
106
		if ($_FILES['fichier']['error'] == UPLOAD_ERR_OK) {
-
 
107
			if (is_uploaded_file($_FILES['fichier']['tmp_name'])) {
-
 
108
				if ($_FILES['fichier']['type'] == 'image/jpeg') {
-
 
109
					$dossierStockage = $this->config['chemins']['imagesTempDossier'];
-
 
110
 
-
 
111
					$nomFichierOriginal = preg_replace('/[.](jpeg|jpg)$/i', '.jpg', strtolower($_FILES['fichier']['name']));
-
 
112
					$originalChemin = $dossierStockage.$nomFichierOriginal;
-
 
113
					$deplacementOk = move_uploaded_file($_FILES['fichier']['tmp_name'], $originalChemin);
-
 
114
 
-
 
115
					if ($deplacementOk === true) {
-
 
116
						$miniatureFichier = str_replace('.jpg', '_min.jpg', $nomFichierOriginal);
-
 
117
						$miniatureChemin = $dossierStockage.$miniatureFichier;
-
 
118
 
-
 
119
						// Parametres
-
 
120
						$largeurIdeale = 100;
-
 
121
						$hauteurIdeale = 100;
-
 
122
						$qualite = 85;
-
 
123
 
-
 
124
						// Calcul de la hauteur et de la largeur optimale de la miniature
-
 
125
						$taillesImgOriginale = getimagesize($originalChemin);
-
 
126
						$largeurOrigine = $taillesImgOriginale[0];
-
 
127
						$hauteurOrigine = $taillesImgOriginale[1];
-
 
128
 
-
 
129
						$largeurMin = $largeurIdeale;
-
 
130
						$hauteurMin = (int) ($hauteurOrigine * ($largeurIdeale / $largeurOrigine));
-
 
131
						if ($hauteurMin > $hauteurIdeale) {
-
 
132
							$hauteurMin = $hauteurIdeale;
-
 
133
							$largeurMin = (int)($largeurOrigine * ($hauteurMin / $hauteurOrigine));
-
 
134
						}
-
 
135
 
-
 
136
						// Création de la miniature
-
 
137
						$imageOriginale = imagecreatefromjpeg($originalChemin);
-
 
138
						$imageMiniature = imagecreatetruecolor($largeurMin, $hauteurMin);
-
 
139
						$couleurFond = imagecolorallocate($imageMiniature, 255, 255, 255);
-
 
140
						imagefill($imageMiniature, 0, 0, $couleurFond);
-
 
141
						imagecopyresized($imageMiniature, $imageOriginale, 0, 0, 0, 0, $largeurMin, $hauteurMin, $largeurOrigine, $hauteurOrigine);
-
 
142
						imagejpeg($imageMiniature, $miniatureChemin, $qualite);
-
 
143
						imagedestroy($imageMiniature);
-
 
144
						imagedestroy($imageOriginale);
-
 
145
 
-
 
146
						// Retour des infos
-
 
147
						$retour['donnees']['urlMiniature'] = sprintf($this->config['chemins']['imagesTempUrlTpl'], $miniatureFichier);
-
 
148
						$retour['donnees']['imageNom'] = $nomFichierOriginal;
-
 
149
					} else {
-
 
150
						$message = "L'image n'a pu être déplacé sur le serveur.";
-
 
151
					}
-
 
152
				} else {
-
 
153
					$message = "L'image n'est pas au format JPEG.";
-
 
154
				}
-
 
155
			} else {
-
 
156
				$message = "L'image n'a pu être téléversée.";
-
 
157
				$debogage = $message.print_r($_FILES, true);
-
 
158
			}
-
 
159
		} else {
-
 
160
			if ($_FILES['fichier']['error'] == UPLOAD_ERR_FORM_SIZE) {
-
 
161
				$message = "L'image téléversée excède la taille maximum autorisée.".
-
 
162
					"Veuillez modifier votre image avant de la téléverser à nouveau.";
-
 
163
			} else {
-
 
164
				$message = "Une erreur de transfert a eu lieu (téléversement interrompu).";
-
 
165
			}
-
 
166
			$debogage = "Code erreur : {$_FILES['fichier']['error']}. ".
-
 
167
				"Voir : http://php.net/manual/fr/features.file-upload.errors.php";
-
 
168
		}
-
 
169
		// Retour des infos
-
 
170
		$retour['donnees']['message'] = $message;
-
 
171
		$retour['donnees']['debogage'] = $debogage;
-
 
172
		return $retour;
-
 
173
	}
-
 
174
 
-
 
175
	public function executerBiodiversite34() {
79
	public function executerWidget() {
176
		$widget['squelette'] = $this->projet;
80
		$widget['squelette'] = $this->projet;
177
		$widget['donnees'] = array();
81
		$widget['donnees'] = array();
178
		$widget['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
82
		$widget['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
179
		$widget['donnees']['url_ws_saisie'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::WS_SAISIE);
83
		$widget['donnees']['url_ws_saisie'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::WS_SAISIE);
180
 
-
 
181
		$widget['donnees']['taxons'] = $this->recupererListeTaxonBiodiversite34();
-
 
182
		$widget['donnees']['milieux'] = $this->parserMilieuxBiodiversite34();
-
 
183
		return  $widget;
-
 
184
	}
-
 
185
 
-
 
186
	private function parserMilieuxBiodiversite34() {
-
 
187
		$infosMilieux = array();
-
 
188
		$milieux = explode('|', $this->configProjet['milieux']);
-
 
189
		foreach ($milieux as $milieu) {
-
 
190
			$details = explode(';', $milieu);
84
 
191
			if (isset($details[1])) {
-
 
192
				$infosMilieux[$details[0]] = $details[1];
-
 
193
			} else {
-
 
194
				$infosMilieux[$details[0]] = '';
-
 
195
			}
-
 
196
		}
-
 
197
		ksort($infosMilieux);
-
 
198
		return $infosMilieux;
-
 
199
	}
-
 
200
 
85
		if ($this->projet == 'defaut') {
201
	private function recupererListeTaxonBiodiversite34() {
-
 
202
		$taxons = null;
86
			$urlWsNsTpl = $this->config['chemins']['baseURLServicesEfloreTpl'];
203
		$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.'biodiversite34_taxons.tsv';
-
 
204
		if (file_exists($fichier_tsv) && is_readable($fichier_tsv)) {
87
			$urlWsNs = sprintf($urlWsNsTpl, self::EFLORE_API_VERSION, self::NS_PROJET, self::WS_NOM);
205
			$taxons = $this->decomposerFichierTsv($fichier_tsv);
88
			$widget['donnees']['url_ws_autocompletion_ns'] = $urlWsNs;
206
		} else {
89
		} else {
-
 
90
			$widget['donnees']['taxons'] = $this->recupererListeTaxon();
207
			$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_tsv'.";
91
			$widget['donnees']['milieux'] = $this->parserMilieux();
208
		}
-
 
209
 
-
 
210
		$taxons_tries = self::trierTableauMd($taxons, array('nom_fr' => SORT_ASC));
-
 
211
 
92
		}
212
		return $taxons_tries;
93
		return  $widget;
213
	}
94
	}
214
 
95
 
-
 
96
	public function executerTaxons() {
215
	public function executerSauvages() {
97
		$widget['squelette'] = $this->projet.'_taxons';
-
 
98
		$widget['squelette_ext'] = '.tpl.js';
-
 
99
		$widget['donnees'] = array();
-
 
100
		$taxons = $this->recupererListeTaxon();
-
 
101
		$taxons_tries = array();
-
 
102
		foreach ($taxons as $taxon) {
216
		$widget['squelette'] = $this->projet;
103
			$taxons_tries[$taxon['num_nom_sel']] = $taxon;
-
 
104
		}
-
 
105
		$widget['donnees']['taxons'] = json_encode($taxons_tries);
-
 
106
		return  $widget;
-
 
107
	}
-
 
108
 
217
		$widget['donnees'] = array();
109
	private function recupererListeTaxon() {
-
 
110
		$taxons = null;
-
 
111
		$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'_taxons.tsv';
-
 
112
		if (file_exists($fichier_tsv) && is_readable($fichier_tsv)) {
-
 
113
			$taxons = $this->decomposerFichierTsv($fichier_tsv);
-
 
114
		} else {
-
 
115
			$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_tsv'.";
-
 
116
		}
-
 
117
		$taxons_tries = self::trierTableauMd($taxons, array('nom_fr' => SORT_ASC));
218
		$widget['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
118
		return $taxons_tries;
219
		$widget['donnees']['url_ws_saisie'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::WS_SAISIE);
119
	}
-
 
120
 
-
 
121
	private function decomposerFichierTsv($fichier, $delimiter = "\t"){
-
 
122
		$header = NULL;
220
 
123
		$data = array();
-
 
124
		if (($handle = fopen($fichier, 'r')) !== FALSE) {
-
 
125
			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
-
 
126
				if (!$header) {
-
 
127
					$header = $row;
-
 
128
				} else {
-
 
129
					$data[] = array_combine($header, $row);
-
 
130
				}
-
 
131
			}
221
		$widget['donnees']['taxons'] = $this->recupererListeTaxonSauvages();
132
			fclose($handle);
222
		$widget['donnees']['milieux'] = $this->parserMilieuxSauvages();
133
		}
223
		return  $widget;
134
		return $data;
224
	}
135
	}
225
 
136
 
226
	private function parserMilieuxSauvages() {
137
	private function parserMilieux() {
227
		$infosMilieux = array();
138
		$infosMilieux = array();
228
		$milieux = explode('|', $this->configProjet['milieux']);
139
		$milieux = explode('|', $this->configProjet['milieux']);
229
		foreach ($milieux as $milieu) {
140
		foreach ($milieux as $milieu) {
230
			$details = explode(';', $milieu);
141
			$details = explode(';', $milieu);
231
			if (isset($details[1])) {
142
			if (isset($details[1])) {
232
				$infosMilieux[$details[0]] = $details[1];
143
				$infosMilieux[$details[0]] = $details[1];
233
			} else {
144
			} else {
234
				$infosMilieux[$details[0]] = '';
145
				$infosMilieux[$details[0]] = '';
235
			}
146
			}
236
		}
147
		}
-
 
148
		ksort($infosMilieux);
237
		return $infosMilieux;
149
		return $infosMilieux;
238
	}
150
	}
239
 
151
 
240
	private function recupererListeTaxonSauvages() {
152
	public function executerUploadImage() {
-
 
153
		$retour = array(
-
 
154
				'squelette' => $this->projet.'_image',
-
 
155
				'squelette_ext' => '.tpl.xml',
-
 
156
				'mime' => 'text/xml',
-
 
157
				'donnees' => array(
-
 
158
						'urlMiniature' => '',
-
 
159
						'imageNom' => '',
-
 
160
						'message' => '',
-
 
161
						'debogage' => ''));
-
 
162
		$message = '';
-
 
163
		$debogage = '';
241
		$taxons = null;
164
		if ($_FILES['fichier']['error'] == UPLOAD_ERR_OK) {
242
		$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.'sauvages_taxons.tsv';
165
			if (is_uploaded_file($_FILES['fichier']['tmp_name'])) {
-
 
166
				if ($_FILES['fichier']['type'] == 'image/jpeg') {
-
 
167
					$dossierStockage = $this->config['chemins']['imagesTempDossier'];
-
 
168
 
243
		if (file_exists($fichier_tsv) && is_readable($fichier_tsv)) {
169
					$nomFichierOriginal = preg_replace('/[.](jpeg|jpg)$/i', '.jpg', strtolower($_FILES['fichier']['name']));
-
 
170
					$originalChemin = $dossierStockage.$nomFichierOriginal;
-
 
171
					$deplacementOk = move_uploaded_file($_FILES['fichier']['tmp_name'], $originalChemin);
244
			$taxons = $this->decomposerFichierTsv($fichier_tsv);
172
 
-
 
173
					if ($deplacementOk === true) {
245
		} else {
174
						$miniatureFichier = str_replace('.jpg', '_min.jpg', $nomFichierOriginal);
246
			$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_tsv'.";
175
						$miniatureChemin = $dossierStockage.$miniatureFichier;
247
		}
176
 
-
 
177
						// Parametres
-
 
178
						$largeurIdeale = 100;
-
 
179
						$hauteurIdeale = 100;
248
		return $taxons;
180
						$qualite = 85;
-
 
181
 
-
 
182
						// Calcul de la hauteur et de la largeur optimale de la miniature
-
 
183
						$taillesImgOriginale = getimagesize($originalChemin);
-
 
184
						$largeurOrigine = $taillesImgOriginale[0];
249
	}
185
						$hauteurOrigine = $taillesImgOriginale[1];
-
 
186
 
250
 
187
						$largeurMin = $largeurIdeale;
-
 
188
						$hauteurMin = (int) ($hauteurOrigine * ($largeurIdeale / $largeurOrigine));
251
	private function decomposerFichierTsv($fichier, $delimiter = "\t"){
189
						if ($hauteurMin > $hauteurIdeale) {
-
 
190
							$hauteurMin = $hauteurIdeale;
-
 
191
							$largeurMin = (int)($largeurOrigine * ($hauteurMin / $hauteurOrigine));
-
 
192
						}
252
		$header = NULL;
193
 
253
	    $data = array();
194
						// Création de la miniature
-
 
195
						$imageOriginale = imagecreatefromjpeg($originalChemin);
254
	    if (($handle = fopen($fichier, 'r')) !== FALSE) {
196
						$imageMiniature = imagecreatetruecolor($largeurMin, $hauteurMin);
-
 
197
						$couleurFond = imagecolorallocate($imageMiniature, 255, 255, 255);
-
 
198
						imagefill($imageMiniature, 0, 0, $couleurFond);
-
 
199
						imagecopyresized($imageMiniature, $imageOriginale, 0, 0, 0, 0, $largeurMin, $hauteurMin, $largeurOrigine, $hauteurOrigine);
-
 
200
						imagejpeg($imageMiniature, $miniatureChemin, $qualite);
255
	        while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
201
						imagedestroy($imageMiniature);
-
 
202
						imagedestroy($imageOriginale);
256
	            if (!$header) {
203
 
-
 
204
						// Retour des infos
-
 
205
						$retour['donnees']['urlMiniature'] = sprintf($this->config['chemins']['imagesTempUrlTpl'], $miniatureFichier);
257
	                $header = $row;
206
						$retour['donnees']['imageNom'] = $nomFichierOriginal;
258
	            } else {
207
					} else {
-
 
208
						$message = "L'image n'a pu être déplacé sur le serveur.";
259
	                $data[] = array_combine($header, $row);
209
					}
-
 
210
				} else {
-
 
211
					$message = "L'image n'est pas au format JPEG.";
-
 
212
				}
-
 
213
			} else {
-
 
214
				$message = "L'image n'a pu être téléversée.";
-
 
215
				$debogage = $message.print_r($_FILES, true);
260
	            }
216
			}
-
 
217
		} else {
-
 
218
			if ($_FILES['fichier']['error'] == UPLOAD_ERR_FORM_SIZE) {
-
 
219
				$message = "L'image téléversée excède la taille maximum autorisée.".
261
	        }
220
						"Veuillez modifier votre image avant de la téléverser à nouveau.";
-
 
221
			} else {
262
	        fclose($handle);
222
				$message = "Une erreur de transfert a eu lieu (téléversement interrompu).";
-
 
223
			}
-
 
224
			$debogage = "Code erreur : {$_FILES['fichier']['error']}. ".
-
 
225
					"Voir : http://php.net/manual/fr/features.file-upload.errors.php";
-
 
226
		}
-
 
227
		// Retour des infos
-
 
228
		$retour['donnees']['message'] = $message;
263
	    }
229
		$retour['donnees']['debogage'] = $debogage;
264
	    return $data;
230
		return $retour;
265
	}
-
 
266
}
231
	}
-
 
232
}
-
 
233
?>
267
234