ryxeo-glpi-git / htdocs / front / document.abuledu_view.php @ 1c14bcc4
Historique | Voir | Annoter | Télécharger (2,55 ko)
1 | 1c14bcc4 | Eric Seigne | <?php
|
---|---|---|---|
2 | /*
|
||
3 | * @version $Id: document.send.php 7763 2009-01-06 18:44:50Z moyo $
|
||
4 | -------------------------------------------------------------------------
|
||
5 | GLPI - Gestionnaire Libre de Parc Informatique
|
||
6 | Copyright (C) 2003-2009 by the INDEPNET Development Team.
|
||
7 | |||
8 | http://indepnet.net/ http://glpi-project.org
|
||
9 | -------------------------------------------------------------------------
|
||
10 | |||
11 | LICENSE
|
||
12 | |||
13 | This file is part of GLPI.
|
||
14 | |||
15 | GLPI is free software; you can redistribute it and/or modify
|
||
16 | it under the terms of the GNU General Public License as published by
|
||
17 | the Free Software Foundation; either version 2 of the License, or
|
||
18 | (at your option) any later version.
|
||
19 | |||
20 | GLPI is distributed in the hope that it will be useful,
|
||
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
23 | GNU General Public License for more details.
|
||
24 | |||
25 | You should have received a copy of the GNU General Public License
|
||
26 | along with GLPI; if not, write to the Free Software
|
||
27 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
28 | --------------------------------------------------------------------------
|
||
29 | */
|
||
30 | |||
31 | // ----------------------------------------------------------------------
|
||
32 | // Original Author of file: Julien Dombre
|
||
33 | // Purpose of file:
|
||
34 | // ----------------------------------------------------------------------
|
||
35 | |||
36 | |||
37 | $NEEDED_ITEMS=array("document","tracking"); |
||
38 | |||
39 | define('GLPI_ROOT', '..'); |
||
40 | include (GLPI_ROOT . "/inc/includes.php"); |
||
41 | |||
42 | if ($CFG_GLPI["public_faq"] == 0) |
||
43 | checkLoginUser(); |
||
44 | |||
45 | if (isset($_GET["file"])){ |
||
46 | $splitter=split("/",$_GET["file"]); |
||
47 | if (count($splitter)==2){ |
||
48 | $send=false; |
||
49 | |||
50 | if ($splitter[0]=="_dumps"&&haveRight("backup","w")) $send=true; |
||
51 | |||
52 | if (!$send){ |
||
53 | $doc=new Document; |
||
54 | $founded=$doc->getFromDBbyFilename($_GET["file"]); |
||
55 | |||
56 | if ($founded){ |
||
57 | // Check if it is my doc
|
||
58 | if (isset($_SESSION["glpiID"])&&$doc->fields["FK_users"]==$_SESSION["glpiID"]){ |
||
59 | $send=true; |
||
60 | } else {
|
||
61 | $send=true; |
||
62 | } |
||
63 | |||
64 | if ($job->fields["author"]==$_SESSION["glpiID"]){ |
||
65 | $query = "SELECT * FROM glpi_doc_device WHERE glpi_doc_device.FK_device = '".$_GET["tracking"]."' AND glpi_doc_device.device_type = '".TRACKING_TYPE."' AND FK_doc='".$doc->fields["ID"]."'"; |
||
66 | $result=$DB->query($query); |
||
67 | if ($DB->numrows($result)>0) |
||
68 | $send=true; |
||
69 | } |
||
70 | } |
||
71 | else echo $LANG["document"][43]; |
||
72 | } |
||
73 | |||
74 | |||
75 | if ($send&&file_exists(GLPI_DOC_DIR."/".$_GET["file"])) |
||
76 | sendFile(GLPI_DOC_DIR."/".$_GET["file"],$splitter[1]); |
||
77 | else echo $LANG["document"][45]; |
||
78 | } else echo $LANG["document"][44]; |
||
79 | } |
||
80 | |||
81 | ?> |