Esempio n. 1
0
    $gMessage->show($gL10n->get('SYS_MODULE_DISABLED'));
}
//nur von eigentlicher OragHompage erreichbar
if ($gCurrentOrganization->getValue('org_shortname') != $g_organization) {
    // das Modul ist deaktiviert
    $gMessage->show($gL10n->get('SYS_MODULE_ACCESS_FROM_HOMEPAGE_ONLY', $g_organization));
}
try {
    // get recordset of current file from databse
    $file = new TableFile($gDb);
    $file->getFileForDownload($getFileId);
} catch (AdmException $e) {
    $e->showHtml();
}
//kompletten Pfad der Datei holen
$completePath = $file->getCompletePathOfFile();
//pruefen ob File ueberhaupt physikalisch existiert
if (!file_exists($completePath)) {
    $gMessage->show($gL10n->get('SYS_FILE_NOT_EXIST'));
}
//Downloadcounter inkrementieren
$file->setValue('fil_counter', $file->getValue('fil_counter') + 1);
$file->save();
//Dateigroese ermitteln
$fileSize = filesize($completePath);
$filename = $file->getValue('fil_name');
// for IE the filename must have special chars in hexadecimal
if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) {
    $filename = urlencode($filename);
}
// Passenden Datentyp erzeugen.
Esempio n. 2
0
            $e->setNewMessage('DOW_FOLDER_NAME_INVALID');
        }
        $e->showHtml();
    }
} elseif ($getMode == 4) {
    if (!$getFileId && !$getFolderId or $getFileId && $getFolderId) {
        //Es muss entweder eine FileID ODER eine FolderId uebergeben werden
        //beides ist auch nicht erlaubt
        $gMessage->show($gL10n->get('SYS_INVALID_PAGE_VIEW'));
    }
    try {
        if ($getFileId > 0) {
            // get recordset of current file from database and throw exception if necessary
            $file = new TableFile($gDb);
            $file->getFileForDownload($getFileId);
            $oldFile = $file->getCompletePathOfFile();
            $newFile = null;
            // check filename and throw exception if something is wrong
            if (admStrIsValidFileName($_POST['new_name'], true)) {
                $newFile = $_POST['new_name'] . admFuncGetFilenameExtension($oldFile);
                $newDescription = $_POST['new_description'];
                //Test ob die Datei schon existiert im Filesystem
                if ($newFile != $file->getValue('fil_name') && file_exists(SERVER_PATH . $file->getValue('fol_path') . '/' . $file->getValue('fol_name') . '/' . $newFile)) {
                    $gMessage->show($gL10n->get('DOW_FILE_EXIST', $newFile));
                } else {
                    $oldName = $file->getValue('fil_name');
                    // Datei umbenennen im Filesystem und in der Datenbank
                    if (rename($oldFile, SERVER_PATH . $file->getValue('fol_path') . '/' . $file->getValue('fol_name') . '/' . $newFile)) {
                        $file->setValue('fil_name', $newFile);
                        $file->setValue('fil_description', $newDescription);
                        $file->save();