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);
35 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
36 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
37 header("Cache-Control: no-cache");
38 header("Pragma: no-cache");
39 header("Cache-Control: post-check=0, pre-check=0");
40 header("Content-type: application/octet-stream");
41 echo $display;
42 }
45 /* Basic setup, remove eventually registered sessions */
46 @require_once ("../include/php_setup.inc");
47 @require_once ("functions.inc");
48 error_reporting (E_ALL);
49 session_start ();
51 /* Logged in? Simple security check */
52 if (!isset($_SESSION['ui'])){
53 gosa_log ("Error: getkiosk.php called without session");
54 header ("Location: ../index.php");
55 exit;
56 }
57 $ui= $_SESSION["ui"];
58 $config= $_SESSION['config'];
60 /* Check ACL's */
61 $acl= get_permissions ($config->current['BASE'], $ui->subtreeACL);
62 $acl= get_module_permission($acl, "all", $config->current['BASE']);
63 if (chkacl($acl, "all") != ""){
64 header ("Location: ../index.php");
65 exit;
66 }
67 $dir = search_config($config->data,"environment", "KIOSKPATH");
68 getkiosk($dir."/".$_GET['id']);
70 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
71 ?>