if (!chgrp($uploadfile, 'dms')) { echo 'CHGRP failed'; } if (!chmod($uploadfile, 0774)) { echo 'CHMOD failed'; } exec('sudo chown wwwrun ' . $uploadfile); $dms = new dms(); $dms->version = '0'; $dms->kategorie_kurzbz = $kategorie_kurzbz; $dms->insertamum = date('Y-m-d H:i:s'); //$dms->insertvon = $user; $dms->mimetype = $_FILES['file']['type']; $dms->filename = $filename; $dms->name = $_FILES['file']['name']; if ($dms->save(true)) { $dms_id = $dms->dms_id; } else { echo 'Fehler beim Speichern der Daten'; $error = true; } } else { echo 'Fehler beim Hochladen der Datei'; $error = true; } } if (isset($_FILES['file']['tmp_name']) && !$error) { //Extension herausfiltern $ext = explode('.', $_FILES['file']['name']); $ext = mb_strtolower($ext[count($ext) - 1]); $filename = $_FILES['file']['tmp_name'];
/** * Erstellt eine neue Datei */ function createFile($name, $data = null) { $dms = new dms(); $pos = mb_strrpos($name, '.') + 1; if ($pos > 1) { $ext = '.' . mb_substr($name, $pos); } else { $ext = ''; } $filename = uniqid() . $ext; $dms->version = '0'; $dms->kategorie_kurzbz = $this->kategorie_kurzbz; $dms->insertamum = date('Y-m-d H:i:s'); $dms->insertvon = $this->getUser(); //$dms->mimetype= mime_content_type(IMPORT_PATH.$importFile); $dms->filename = $filename; $dms->name = $name; if ($dms->save(true)) { file_put_contents(DMS_PATH . $filename, $data); if (!chgrp(DMS_PATH . $filename, 'dms')) { echo 'CHGRP failed'; } if (!chmod(DMS_PATH . $filename, 0774)) { echo 'CHMOD failed'; } exec('sudo chown wwwrun ' . $filename); } else { throw new Sabre_DAV_Exception_MethodNotAllowed('Failed ' . $dms->errormsg); } }
/** * Speichert Daten in eine Datei * @param $data */ function put($data) { $dms = new dms(); if ($dms->load($this->dms_id)) { $dms->version = $dms->version++; $pos = mb_strrpos($dms->name, '.') + 1; if ($pos > 1) { $ext = '.' . mb_substr($dms->name, $pos); } else { $ext = ''; } $filename = uniqid() . $ext; $dms->version++; $dms->insertamum = date('Y-m-d H:i:s'); $dms->insertvon = $this->getUser(); $dms->filename = $filename; if ($dms->save(true)) { if (file_put_contents(DMS_PATH . $filename, $data)) { if (!chgrp(DMS_PATH . $filename, 'dms')) { echo 'CHGRP failed'; } if (!chmod(DMS_PATH . $filename, 0774)) { echo 'CHMOD failed'; } exec('sudo chown wwwrun ' . $filename); $dms->save(false); } else { throw new Sabre_DAV_Exception_FileNotFound('Failed to Write File'); } } else { throw new Sabre_DAV_Exception_FileNotFound('Failed ' . $dms->errormsg); } } }
} elseif ($renameId != '') { // Datei umbenennen echo '<h1>Datei umbennen</h1>'; if (isset($_REQUEST['searching']) && $_REQUEST['searching'] == 'true') { echo '<p><a href="' . $_SERVER['PHP_SELF'] . '?searching=true&searchstring=' . $_REQUEST['searchstring'] . '&page=' . $page . '&dpp=' . $dpp . '">zurück</a></p>'; } else { echo '<p><a href="' . $_SERVER['PHP_SELF'] . '?kategorie_kurzbz=' . $_REQUEST['kategorie_kurzbz'] . '&page=' . $page . '&dpp=' . $dpp . '">zurück</a></p>'; } drawRenameForm($renameId, $version, $page, $dpp, $searching, $searchstring); } elseif ($chkatID != '') { if (isset($_POST['action']) && $_POST['action'] == 'chkat') { // neue Kategorie speichern $dms = new dms(); $dms->load($chkatID); $dms->kategorie_kurzbz = $_POST['kategoriez']; $dms->save(); if (isset($_REQUEST['searching']) && $_REQUEST['searching'] == 'true') { echo '<meta http-equiv="refresh" content="0; url=' . $_SERVER['PHP_SELF'] . '?searching=true&searchstring=' . $_REQUEST['searchstring'] . '&page=' . $page . '&dpp=' . $dpp . '" />'; } else { echo '<meta http-equiv="refresh" content="0; url=' . $_SERVER['PHP_SELF'] . '?kategorie_kurzbz=' . $_REQUEST['kategorie_kurzbz'] . '&page=' . $page . '&dpp=' . $dpp . '" />'; } } else { // Kategorieauswahl $dms = new dms(); $dms->load($chkatID); echo '<h1>Kategorie von ' . $dms->name . ' ändern</h1>'; echo '<span style="float:right";><a href="' . $_SERVER['PHP_SELF'] . '">zurück</a></span>'; drawChangeKategorie($chkatID, $page, $dpp); } } else { echo '<div align="left"><h1>Dokument Auswählen</h1></div><div align="right"></div>