| 1 |
<?php |
| 2 |
namespace LAM\UPLOAD; |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
use htmlDiv; |
| 25 |
use htmlJavaScript; |
| 26 |
use htmlResponsiveRow; |
| 27 |
use LAM\TYPES\TypeManager; |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
include_once(__DIR__ . "/../../lib/security.inc"); |
| 38 |
|
| 39 |
include_once(__DIR__ . '/../../lib/config.inc'); |
| 40 |
|
| 41 |
include_once(__DIR__ . '/../../lib/ldap.inc'); |
| 42 |
|
| 43 |
include_once(__DIR__ . '/../../lib/status.inc'); |
| 44 |
|
| 45 |
include_once(__DIR__ . '/../../lib/modules.inc'); |
| 46 |
|
| 47 |
include_once(__DIR__ . '/../../lib/pdf.inc'); |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
startSecureSession(); |
| 52 |
enforceUserIsLoggedIn(); |
| 53 |
|
| 54 |
|
| 55 |
checkIfToolIsActive('toolFileUpload'); |
| 56 |
|
| 57 |
|
| 58 |
if (!checkIfWriteAccessIsAllowed()) { |
| 59 |
die(); |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
if (!isLoggedIn()) { |
| 64 |
metaRefresh("../login.php"); |
| 65 |
exit; |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
setlanguage(); |
| 70 |
|
| 71 |
include_once __DIR__ . '/../../lib/adminHeader.inc'; |
| 72 |
$typeId = htmlspecialchars($_SESSION['mass_typeId']); |
| 73 |
$typeManager = new TypeManager(); |
| 74 |
$type = $typeManager->getConfiguredType($typeId); |
| 75 |
if ($type === null) { |
| 76 |
logNewMessage(LOG_ERR, 'User tried to access invalid upload type: ' . $typeId); |
| 77 |
die(); |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
if ($type->isHidden()) { |
| 82 |
logNewMessage(LOG_ERR, 'User tried to access hidden upload: ' . $type->getId()); |
| 83 |
die(); |
| 84 |
} |
| 85 |
if (!checkIfNewEntriesAreAllowed($type->getId()) || !checkIfWriteAccessIsAllowed($type->getId())) { |
| 86 |
logNewMessage(LOG_ERR, 'User tried to access forbidden upload: ' . $type->getId()); |
| 87 |
die(); |
| 88 |
} |
| 89 |
|
| 90 |
$container = new htmlResponsiveRow(); |
| 91 |
$javaScript = new htmlJavaScript('window.lam.upload.continueUpload(\'../misc/ajax.php?function=upload&typeId=' . $type->getId() . '\', \'' . getSecurityTokenName() . '\', \'' . getSecurityTokenValue() . '\');'); |
| 92 |
$contentDiv = new htmlDiv('uploadContent', $javaScript, ['smallPaddingContent']); |
| 93 |
$container->add($contentDiv); |
| 94 |
parseHtml(null, $container, [], false); |
| 95 |
|
| 96 |
include_once __DIR__ . '/../../lib/adminFooter.inc'; |