2012-12-14 08:26:53 +00:00
|
|
|
<?php
|
|
|
|
// MyDMS. Document Management System
|
|
|
|
// Copyright (C) 2002-2005 Markus Westphal
|
|
|
|
// Copyright (C) 2006-2008 Malcolm Cowe
|
|
|
|
// Copyright (C) 2010 Matteo Lucarelli
|
2016-08-09 05:34:30 +00:00
|
|
|
// Copyright (C) 2010-2016 Uwe Steinmann
|
2012-12-14 08:26:53 +00:00
|
|
|
//
|
|
|
|
// This program 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.
|
|
|
|
//
|
|
|
|
// This program 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 this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
include("../inc/inc.Settings.php");
|
|
|
|
include("../inc/inc.Utils.php");
|
2022-11-09 05:40:50 +00:00
|
|
|
include("../inc/inc.LogInit.php");
|
2012-12-14 08:26:53 +00:00
|
|
|
include("../inc/inc.Language.php");
|
2014-12-08 13:47:32 +00:00
|
|
|
include("../inc/inc.Init.php");
|
|
|
|
include("../inc/inc.Extension.php");
|
|
|
|
include("../inc/inc.DBInit.php");
|
2012-12-14 08:26:53 +00:00
|
|
|
include("../inc/inc.ClassUI.php");
|
2019-02-06 12:10:33 +00:00
|
|
|
include("../inc/inc.ClassController.php");
|
2012-12-14 08:26:53 +00:00
|
|
|
include("../inc/inc.Authentication.php");
|
|
|
|
|
2019-02-06 12:10:33 +00:00
|
|
|
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
|
|
|
$controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
|
|
|
|
|
2012-12-14 08:26:53 +00:00
|
|
|
$documentid = $_GET["documentid"];
|
|
|
|
if (!isset($documentid) || !is_numeric($documentid) || intval($documentid)<1) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$document = $dms->getDocument($documentid);
|
|
|
|
if (!is_object($document)) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($document->getAccessMode($user) < M_READ) {
|
2019-11-25 10:52:14 +00:00
|
|
|
header('Content-Type: image/svg+xml');
|
|
|
|
readfile('../views/'.$theme.'/images/empty.svg');
|
2012-12-14 08:26:53 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2021-10-06 13:03:03 +00:00
|
|
|
$controller->setParam('conversionmgr', $conversionmgr);
|
2022-08-05 11:32:46 +00:00
|
|
|
$controller->setParam('width', !empty($_GET["width"]) ? $_GET["width"] : null);
|
|
|
|
$controller->setParam('document', $document);
|
2013-04-29 17:32:00 +00:00
|
|
|
if(isset($_GET['version'])) {
|
|
|
|
$version = $_GET["version"];
|
2014-05-28 12:54:10 +00:00
|
|
|
if (!is_numeric($version))
|
2013-04-29 17:32:00 +00:00
|
|
|
exit;
|
2019-02-06 12:10:33 +00:00
|
|
|
|
2022-08-05 11:32:46 +00:00
|
|
|
$controller->setParam('action', 'version');
|
2019-02-06 12:10:33 +00:00
|
|
|
$controller->setParam('version', $version);
|
2022-07-29 19:44:04 +00:00
|
|
|
if(!$controller()) {
|
2020-12-09 18:54:31 +00:00
|
|
|
header('Content-Type: image/svg+xml');
|
|
|
|
readfile('../views/'.$theme.'/images/empty.svg');
|
|
|
|
exit;
|
2019-02-06 12:10:33 +00:00
|
|
|
}
|
|
|
|
exit;
|
2013-04-29 17:32:00 +00:00
|
|
|
} elseif(isset($_GET['file'])) {
|
|
|
|
$file = $_GET['file'];
|
|
|
|
if (!is_numeric($file) || intval($file)<1)
|
|
|
|
exit;
|
|
|
|
$object = $document->getDocumentFile($file);
|
2022-08-05 11:32:46 +00:00
|
|
|
$controller->setParam('action', 'file');
|
2020-12-09 18:54:31 +00:00
|
|
|
$controller->setParam('object', $object);
|
2022-08-05 11:32:46 +00:00
|
|
|
if(!$controller()) {
|
2020-12-09 18:54:31 +00:00
|
|
|
header('Content-Type: image/svg+xml');
|
|
|
|
readfile('../views/'.$theme.'/images/empty.svg');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
exit;
|
2013-04-29 17:32:00 +00:00
|
|
|
} else {
|
2012-12-14 08:26:53 +00:00
|
|
|
exit;
|
|
|
|
}
|