| Line 19... |
Line 19... |
| 19 |
// | |
|
19 |
// | |
|
| 20 |
// | You should have received a copy of the GNU General Public License |
|
20 |
// | You should have received a copy of the GNU General Public License |
|
| 21 |
// | along with Foobar; if not, write to the Free Software |
|
21 |
// | along with Foobar; if not, write to the Free Software |
|
| 22 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
22 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
// +------------------------------------------------------------------------------------------------------+
|
23 |
// +------------------------------------------------------------------------------------------------------+
|
| 24 |
// CVS : $Id: carto.php,v 1.2 2005-02-22 16:35:16 jpm Exp $
|
24 |
// CVS : $Id: carto.php,v 1.3 2005-02-22 19:35:08 jpm Exp $
|
| 25 |
/**
|
25 |
/**
|
| 26 |
* Fournie une image cartographique.
|
26 |
* Fournie une image cartographique.
|
| 27 |
*
|
27 |
*
|
| 28 |
* Fichier permettant de récupérer l'image d'une carte créer par la bibliothèque cartographique
|
28 |
* Fichier permettant de récupérer l'image d'une carte créer par la bibliothèque cartographique
|
| 29 |
* et de la faire passer dans les entête HTTP.
|
29 |
* et de la faire passer dans les entête HTTP.
|
| Line 33... |
Line 33... |
| 33 |
*@author Nicolas MATHIEU
|
33 |
*@author Nicolas MATHIEU
|
| 34 |
//Autres auteurs :
|
34 |
//Autres auteurs :
|
| 35 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
35 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
| 36 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
36 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
| 37 |
*@copyright Tela-Botanica 2000-2004
|
37 |
*@copyright Tela-Botanica 2000-2004
|
| 38 |
*@version $Revision: 1.2 $ $Date: 2005-02-22 16:35:16 $
|
38 |
*@version $Revision: 1.3 $ $Date: 2005-02-22 19:35:08 $
|
| 39 |
// +------------------------------------------------------------------------------------------------------+
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
| 40 |
*/
|
40 |
*/
|
| Line 41... |
Line 41... |
| 41 |
|
41 |
|
| 42 |
// +------------------------------------------------------------------------------------------------------+
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
| 43 |
// | ENTETE du PROGRAMME |
|
43 |
// | ENTETE du PROGRAMME |
|
| 44 |
// +------------------------------------------------------------------------------------------------------+
|
44 |
// +------------------------------------------------------------------------------------------------------+
|
| - |
|
45 |
session_name($_GET['session']);
|
| Line 45... |
Line 46... |
| 45 |
$_GET['chemin'] = urldecode($_GET['chemin']);
|
46 |
session_start();
|
| 46 |
|
47 |
|
| 47 |
// +------------------------------------------------------------------------------------------------------+
|
48 |
// +------------------------------------------------------------------------------------------------------+
|
| 48 |
// | CORPS du PROGRAMME |
|
49 |
// | CORPS du PROGRAMME |
|
| - |
|
50 |
// +------------------------------------------------------------------------------------------------------+
|
| - |
|
51 |
$image = imagecreatefrompng($_SESSION['chemin'].$_SESSION['fichier'].'.png');
|
| - |
|
52 |
if (!$image) {
|
| 49 |
// +------------------------------------------------------------------------------------------------------+
|
53 |
echo session_name();
|
| 50 |
$image = imagecreatefrompng($_GET['chemin'].$_GET['fichier'].'.png');
|
54 |
echo session_id();
|
| 51 |
chmod($_GET['chemin'].$_GET['fichier'].'.png', 755) ;
|
55 |
trigger_error($image);
|
| 52 |
|
56 |
} else {
|
| 53 |
header("Expires: Wen, 01 Dec 1999 01:00:00 GMT");// Date du passé
|
57 |
header("Expires: Wen, 01 Dec 1999 01:00:00 GMT");// Date du passé
|
| 54 |
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");// toujours modifié
|
58 |
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");// toujours modifié
|
| 55 |
header("Cache-Control: no-cache, must-revalidate");// HTTP/1.1
|
59 |
header("Cache-Control: no-cache, must-revalidate");// HTTP/1.1
|
| - |
|
60 |
header("Pragma: no-cache"); // HTTP/1.0
|
| 56 |
header("Pragma: no-cache"); // HTTP/1.0
|
61 |
header ("content-type:image/png");
|
| 57 |
header ("content-type:image/png");
|
62 |
chmod($_SESSION['chemin'].$_SESSION['fichier'].'.png', 755);
|
| 58 |
imagepng($image);
|
63 |
imagepng($image);
|
| 59 |
unlink($_GET['chemin'].$_GET['fichier'].'.png');
|
64 |
unlink($_SESSION['chemin'].$_SESSION['fichier'].'.png');
|
| 60 |
//Nous nettoyons le dossier tmp des fichiers qu'il contient:
|
65 |
//Nous nettoyons le dossier tmp des fichiers qu'il contient:
|
| 61 |
$poignet_de_dossier = opendir($_GET['chemin']);
|
66 |
$poignet_de_dossier = opendir($_SESSION['chemin']);
|
| 62 |
while ($fichier_dechet = readdir($poignet_de_dossier)) {
|
67 |
while ($fichier_dechet = readdir($poignet_de_dossier)) {
|
| - |
|
68 |
if ($fichier_dechet != '.' && $fichier_dechet != '..') {
|
| 63 |
if ($fichier_dechet != '.' && $fichier_dechet != '..') {
|
69 |
unlink($_SESSION['chemin'].$fichier_dechet);
|
| - |
|
70 |
}
|
| 64 |
unlink($_GET['chemin'].$fichier_dechet);
|
71 |
}
|
| Line 65... |
Line 72... |
| 65 |
}
|
72 |
closedir($poignet_de_dossier);
|
| 66 |
}
|
73 |
}
|
| 67 |
|
74 |
|
| 68 |
// +------------------------------------------------------------------------------------------------------+
|
- |
|
| 69 |
// | PIED du PROGRAMME |
|
75 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 70... |
Line 76... |
| 70 |
// +------------------------------------------------------------------------------------------------------+
|
76 |
// | PIED du PROGRAMME |
|
| 71 |
closedir($poignet_de_dossier);
|
77 |
// +------------------------------------------------------------------------------------------------------+
|
| 72 |
exit();
|
78 |
exit();
|
| - |
|
79 |
|
| - |
|
80 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
| - |
|
81 |
*
|
| - |
|
82 |
* $Log: not supported by cvs2svn $
|
| - |
|
83 |
* Revision 1.2 2005/02/22 16:35:16 jpm
|
| 73 |
|
84 |
* Mise en forme.
|
| 74 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
85 |
* Utilisation de constantes pour les chemins d'accès aux fichiers.
|
| 75 |
*
|
86 |
* Ajout de commentaires.
|
| 76 |
* $Log: not supported by cvs2svn $
|
87 |
*
|
| 77 |
* Revision 1.1 2005/02/22 12:02:57 jpm
|
88 |
* Revision 1.1 2005/02/22 12:02:57 jpm
|