LDAPAccountManager/lam/templates/upload/massDoUpload.php

92 lines
2.8 KiB
PHP
Raw Normal View History

2016-12-07 20:18:06 +00:00
<?php
2017-01-07 17:23:04 +00:00
namespace LAM\UPLOAD;
2016-12-07 20:18:06 +00:00
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2004 - 2018 Roland Gruber
2016-12-07 20:18:06 +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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Creates LDAP accounts for file upload.
*
* @author Roland Gruber
* @package tools
*/
/** security functions */
2018-12-23 16:28:42 +00:00
include_once(__DIR__ . "/../../lib/security.inc");
2016-12-07 20:18:06 +00:00
/** access to configuration */
2018-12-23 16:28:42 +00:00
include_once(__DIR__ . '/../../lib/config.inc');
2016-12-07 20:18:06 +00:00
/** LDAP handle */
2018-12-23 16:28:42 +00:00
include_once(__DIR__ . '/../../lib/ldap.inc');
2016-12-07 20:18:06 +00:00
/** status messages */
2018-12-23 16:28:42 +00:00
include_once(__DIR__ . '/../../lib/status.inc');
2016-12-07 20:18:06 +00:00
/** account modules */
2018-12-23 16:28:42 +00:00
include_once(__DIR__ . '/../../lib/modules.inc');
2016-12-07 20:18:06 +00:00
/** PDF */
2018-12-23 16:28:42 +00:00
include_once(__DIR__ . '/../../lib/pdf.inc');
2016-12-07 20:18:06 +00:00
// Start session
startSecureSession();
2017-02-11 16:11:37 +00:00
enforceUserIsLoggedIn();
2016-12-07 20:18:06 +00:00
// check if this tool may be run
checkIfToolIsActive('toolFileUpload');
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
// Redirect to startpage if user is not loged in
if (!isLoggedIn()) {
metaRefresh("../login.php");
exit;
}
// Set correct language, codepages, ....
setlanguage();
2018-12-23 16:28:42 +00:00
include __DIR__ . '/../../lib/adminHeader.inc';
2017-01-07 17:23:04 +00:00
$typeId = htmlspecialchars($_SESSION['mass_typeId']);
$typeManager = new \LAM\TYPES\TypeManager();
$type = $typeManager->getConfiguredType($typeId);
2016-12-07 20:18:06 +00:00
// check if account type is ok
2017-01-07 17:23:04 +00:00
if ($type->isHidden()) {
logNewMessage(LOG_ERR, 'User tried to access hidden upload: ' . $type->getId());
2016-12-07 20:18:06 +00:00
die();
}
2017-01-07 17:23:04 +00:00
if (!checkIfNewEntriesAreAllowed($type->getId()) || !checkIfWriteAccessIsAllowed($type->getId())) {
logNewMessage(LOG_ERR, 'User tried to access forbidden upload: ' . $type->getId());
2016-12-07 20:18:06 +00:00
die();
}
2017-01-07 17:23:04 +00:00
echo '<div id="uploadContent" class="' . $type->getScope() . '-bright smallPaddingContent">';
2016-12-07 20:18:06 +00:00
$tokenPrefix = '?' . getSecurityTokenName() . '=' . getSecurityTokenValue();
?>
<script type="text/javascript">
jQuery(document).ready(function(){
window.lam.upload.continueUpload('../misc/ajax.php?function=upload&typeId=' + '<?php echo $type->getId() ?>', '<?php echo getSecurityTokenName(); ?>', '<?php echo getSecurityTokenValue(); ?>');
2016-12-07 20:18:06 +00:00
});
</script>
<?php
echo '</div>';
2018-12-23 16:28:42 +00:00
include __DIR__ . '/../../lib/adminFooter.inc';
2016-12-07 20:18:06 +00:00
?>