cde88c5a063e006b555318ccace6625a294a5777
1 <?php
2 /*
3 This code is part of GOsa (https://gosa.gonicus.de)
4 Copyright (C) 2003 Cajus Pollmeier
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
21 function getkiosk ($id)
22 {
24 if(!file_exists($id)){
25 echo sprintf(_("Can't open file '%s', possibly the file does not exist."),$id);
26 exit();
27 }
29 if(!is_readable($id)){
30 echo sprintf(_("Can't read file '%s', check permissions."),$id);
31 exit();
32 }
34 $display = file_get_contents($id);
36 $nn = preg_replace("/^.*\//","",$id);
38 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
39 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
40 header("Cache-Control: no-cache");
41 header("Pragma: no-cache");
42 header("Cache-Control: post-check=0, pre-check=0");
43 header("Content-type: application/octet-stream");
44 header("Content-Disposition: attachment; filename=".$nn);
45 echo $display;
46 }
49 /* Basic setup, remove eventually registered sessions */
50 @require_once ("../include/php_setup.inc");
51 @require_once ("functions.inc");
52 error_reporting (E_ALL);
53 session_start ();
55 /* Logged in? Simple security check */
56 if (!isset($_SESSION['ui'])){
57 new log("security","fai","",array(),"Error: getkiosk.php called without session") ;
58 header ("Location: index.php");
59 exit;
60 }
61 $ui= $_SESSION["ui"];
62 $config= $_SESSION['config'];
64 /* Check ACL's */
65 #FIXME Use more specific acl categories instead of all/all
66 $ui = get_userinfo();
67 $acl = $ui->get_permissions(base64_decode($_GET['id']),"all/all");
68 if(!preg_match("/r/",$acl)){
69 header ("Location: index.php");
70 exit;
71 }
72 $dir = search_config($config->data,"environment", "KIOSKPATH");
73 getkiosk($dir."/".$_GET['id']);
75 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
76 ?>