En P.J.

- ajout de la page pluginimage.send.php
- petite correction de inc/log.function.php (le "security" déjà utilisé
dans document.send.php a été oublié)
- ajout de la traduction : $LANG["log"][66]="Security"

@Moyo si ça te convient...

@Tsmr dans ce cas :

echo
"<img src='plugin_activity.image.php?name=" .
$fileCamembert ."&clean=1' />";

Devient

echo
"<img src='../../../front/pluginimage.send.php?plugin=activity&name=" .
$fileCamembert . "&clean=1' />";



A+
--- ./inc/log.function.php.image	2007-07-21 06:25:52.000000000 +0200
+++ ./inc/log.function.php	2007-07-23 12:48:44.000000000 +0200
@@ -350,6 +350,7 @@ function logArray(){
 			"setup"=>$LANG["log"][57],
 			"reservation"=>$LANG["log"][58],
 			"cron"=>$LANG["log"][59],
+			"security"=>$LANG["log"][66],
 			"document"=>$LANG["log"][56]);
 
 	return array($logItemtype,$logService);
@@ -600,7 +601,7 @@ function showEvents($target,$order,$sort
 		echo "<tr class='tab_bg_2'>";
 		echo "<td>".(isset($logItemtype[$itemtype])?$logItemtype[$itemtype]:"&nbsp;").":</td><td class='center'><strong>"; 
 		displayItemLogID($itemtype,$item);	
-		echo "</strong></td><td>".convDateTime($date)."</td><td class='center'>".$logService[$service]."</td><td class='center'>$level</td><td>$message</td>";
+		echo "</strong></td><td>".convDateTime($date)."</td><td class='center'>".(isset($logService[$service])?$logService[$service]:$service)."</td><td class='center'>$level</td><td>$message</td>";
 		echo "</tr>";
 
 		$i++; 
--- ./front/pluginimage.send.php.image	2007-07-23 12:44:07.000000000 +0200
+++ ./front/pluginimage.send.php	2007-07-23 12:38:02.000000000 +0200
@@ -0,0 +1,64 @@
+<?php
+/*
+   ----------------------------------------------------------------------
+   GLPI - Gestionnaire Libre de Parc Informatique
+   Copyright (C) 2003-2005 by the INDEPNET Development Team.
+
+   http://indepnet.net/   http://glpi-project.org/
+   ----------------------------------------------------------------------
+
+   LICENSE
+
+   This file is part of GLPI.
+
+   GLPI is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   GLPI is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GLPI; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+   ------------------------------------------------------------------------
+ */
+
+/* ----------------------------------------------------------------------
+	Purpose of file: Send image generated by a plugin to browser
+	
+	Argument :
+	- plugin : name of the plugin, also the subdir in files/_plugins
+	- name : of the image in the files/_plugins/xxxx dir
+	- clean : delete the image after send it
+   ---------------------------------------------------------------------- */
+
+define('GLPI_ROOT', '..'); 
+include (GLPI_ROOT . "/inc/includes.php");
+
+if (!isset($_GET["name"]) || !isset($_GET["plugin"])) {
+	logEvent("-1", "system", 2, "security", $_SESSION["glpiname"]." bad usage.");
+	die("security");
+}
+if (basename($_GET["name"]) != $_GET["name"] || basename($_GET["plugin"]) != $_GET["plugin"])  {
+	logEvent("-1", "system", 1, "security", $_SESSION["glpiname"]." try to use a non standard path.");
+	die("security");
+}
+$Path = GLPI_PLUGIN_DOC_DIR."/".$_GET["plugin"]."/";
+
+// Now send the file with header() magic
+header("Expires: Sun, 30 Jan 1966 06:30:00 GMT");
+header('Pragma: private'); /// IE BUG + SSL
+header('Cache-control: private, must-revalidate'); /// IE BUG + SSL
+header('Content-disposition: filename="' . $_GET["name"] . '"');
+header("Content-type: image/png");
+
+if (file_exists($Path.$_GET["name"])){
+	readfile($Path.$_GET["name"]);
+	if (isset($_GET["clean"])) unlink($Path.$_GET["name"]);
+}
+else	readfile(GLPI_ROOT . "/pics/warning.png");
+?>
--- ./locales/en_GB.php.image	2007-07-23 12:47:54.000000000 +0200
+++ ./locales/en_GB.php	2007-07-23 12:48:12.000000000 +0200
@@ -768,6 +768,7 @@ $LANG["log"][62]="remove this user compl
 $LANG["log"][63]="entity"; 
 $LANG["log"][64]="change of comments"; 
 $LANG["log"][65]="rule"; 
+$LANG["log"][66]="Security"; 
 
 $LANG["login"][0]="Last login"; 
 $LANG["login"][1]="Log in again"; 
@@ -1649,4 +1650,4 @@ $LANG["update"][135]="Root location"; 
 $LANG["update"][136]="This is the new hierarchy. If it's OK, you can validate it."; 
 $LANG["update"][137]="New hierarchy"; 
 $LANG["update"][138]="Actual locations"; 
-?>
\ Pas de fin de ligne à la fin du fichier.
+?>
--- ./locales/fr_FR.php.image	2007-07-23 12:48:01.000000000 +0200
+++ ./locales/fr_FR.php	2007-07-23 12:48:12.000000000 +0200
@@ -778,6 +778,7 @@ $LANG["log"][62]="suppression utilisateu
 $LANG["log"][63]="entité";
 $LANG["log"][64]="modification des commentaires";
 $LANG["log"][65]="règle";
+$LANG["log"][66]="Securité"; 
 
 $LANG["login"][0]="Dernière connexion";
 $LANG["login"][1]="Se reconnecter";
_______________________________________________
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev

Reply via email to