Ejemplo n.º 1
0
$rootFolderPathString = 'custom/intranet/downloads';
$rootFolderAbsolutePathString = $libFilesystem->getAbsolutePath($rootFolderPathString);
/*
* pre scan actions
*/
foreach ($libAuth->getAemter() as $amt) {
    if (!is_dir($rootFolderAbsolutePathString . '/' . $amt)) {
        mkdir($rootFolderAbsolutePathString . '/' . $amt);
    }
}
if (isset($_GET['aktion']) && $_GET['aktion'] == 'open') {
    $_SESSION['openFolders'][$_GET['hash']] = 1;
} elseif (isset($_GET['aktion']) && $_GET['aktion'] == 'close') {
    unset($_SESSION['openFolders'][$_GET['hash']]);
}
$rootFolderObject = new \vcms\filesystem\Folder('', '/', $rootFolderAbsolutePathString);
$hashes = $rootFolderObject->getHashMap();
/*
* actions
*/
//delete file
if (isset($_GET['aktion']) && $_GET['aktion'] == 'delete' && isset($_GET['hash'])) {
    $element = $hashes[$_GET['hash']];
    if (in_array($element->owningAmt, $libAuth->getAemter())) {
        $element->delete();
        $libGlobal->notificationTexts[] = 'Das Element wurde gelöscht.';
    } else {
        $libGlobal->errorTexts[] = 'Du hast keine Löschberechtigung.';
    }
} elseif (isset($_POST['aktion']) && $_POST['aktion'] == 'upload' && isset($_POST['hash'])) {
    $folder = $hashes[$_POST['hash']];
Ejemplo n.º 2
0
VCMS 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 VCMS. If not, see <http://www.gnu.org/licenses/>.
*/
if (!is_object($libGlobal) || !$libAuth->isLoggedin()) {
    exit;
}
if ($libAuth->isLoggedin() && isset($_GET['hash']) && $_GET['hash'] != '') {
    $rootFolderPathString = 'custom/intranet/downloads';
    $rootFolderAbsolutePathString = $libFilesystem->getAbsolutePath($rootFolderPathString);
    $rootFolderObject = new \vcms\filesystem\Folder('', '/', $rootFolderAbsolutePathString);
    $hashes = $rootFolderObject->getHashMap();
    $file = $hashes[$_GET['hash']];
    if (is_object($file)) {
        $outputFileName = $file->name;
        $outputFilePathString = $file->getFileSystemPath();
        if (in_array($libAuth->getGruppe(), $file->readGroups)) {
            $libMime = new \vcms\LibMime();
            $mime = $libMime->detectMime($outputFileName);
            /*
             * disable caching
             */
            header('Cache-Control: no-cache, no-store, must-revalidate');
            header('Pragma: no-cache');
            header('Expires: 0');
            // mime