fix line endings, translate german comments

This commit is contained in:
Uwe Steinmann 2013-02-28 17:28:57 +01:00
parent a300013709
commit 7eb7e57f62

View File

@ -1,124 +1,124 @@
<?php <?php
// MyDMS. Document Management System // MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal // Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe // Copyright (C) 2006-2008 Malcolm Cowe
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or // the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include("../inc/inc.Settings.php"); include("../inc/inc.Settings.php");
include("../inc/inc.LogInit.php"); include("../inc/inc.LogInit.php");
include("../inc/inc.Utils.php"); include("../inc/inc.Utils.php");
include("../inc/inc.DBInit.php"); include("../inc/inc.DBInit.php");
include("../inc/inc.Language.php"); include("../inc/inc.Language.php");
include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUI.php");
include("../inc/inc.ClassEmail.php"); include("../inc/inc.ClassEmail.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
} }
$folderid = $_GET["folderid"]; $folderid = $_GET["folderid"];
$folder = $dms->getFolder($folderid); $folder = $dms->getFolder($folderid);
if (!is_object($folder)) { if (!is_object($folder)) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
} }
$folderPathHTML = getFolderPathHTML($folder, true); $folderPathHTML = getFolderPathHTML($folder, true);
if ($folder->getAccessMode($user) < M_ALL) { if ($folder->getAccessMode($user) < M_ALL) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied"));
} }
/* Check if the form data comes for a trusted request */ /* Check if the form data comes for a trusted request */
/* FIXME: Currently GET request are allowed. */ /* FIXME: Currently GET request are allowed. */
if(!checkFormKey('folderaccess', 'GET')) { if(!checkFormKey('folderaccess', 'GET')) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("invalid_request_token")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("invalid_request_token"));
} }
switch ($_GET["action"]) { switch ($_GET["action"]) {
case "setowner": case "setowner":
case "delaccess": case "delaccess":
case "inherit": case "inherit":
$action = $_GET["action"]; $action = $_GET["action"];
break; break;
case "setdefault": case "setdefault":
case "editaccess": case "editaccess":
case "addaccess": case "addaccess":
$action = $_GET["action"]; $action = $_GET["action"];
if (!isset($_GET["mode"]) || !is_numeric($_GET["mode"]) || $_GET["mode"]<M_ANY || $_GET["mode"]>M_ALL) { if (!isset($_GET["mode"]) || !is_numeric($_GET["mode"]) || $_GET["mode"]<M_ANY || $_GET["mode"]>M_ALL) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("invalid_access_mode")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("invalid_access_mode"));
} }
$mode = $_GET["mode"]; $mode = $_GET["mode"];
break; break;
case "notinherit": case "notinherit":
$action = $_GET["action"]; $action = $_GET["action"];
if (strcasecmp($_GET["mode"], "copy") && strcasecmp($_GET["mode"], "empty")) { if (strcasecmp($_GET["mode"], "copy") && strcasecmp($_GET["mode"], "empty")) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("invalid_access_mode")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("invalid_access_mode"));
} }
$mode = $_GET["mode"]; $mode = $_GET["mode"];
break; break;
default: default:
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("invalid_action")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("invalid_action"));
break; break;
} }
if (isset($_GET["userid"])) { if (isset($_GET["userid"])) {
if (!is_numeric($_GET["userid"])) { if (!is_numeric($_GET["userid"])) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("unknown_user")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("unknown_user"));
} }
if (!strcasecmp($action, "addaccess") && $_GET["userid"]==-1) { if (!strcasecmp($action, "addaccess") && $_GET["userid"]==-1) {
$userid = -1; $userid = -1;
} }
else { else {
if (!is_object($dms->getUser($_GET["userid"]))) { if (!is_object($dms->getUser($_GET["userid"]))) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("unknown_user")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("unknown_user"));
} }
$userid = $_GET["userid"]; $userid = $_GET["userid"];
} }
} }
if (isset($_GET["groupid"])) { if (isset($_GET["groupid"])) {
if (!is_numeric($_GET["groupid"])) { if (!is_numeric($_GET["groupid"])) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("unknown_group")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("unknown_group"));
} }
if (!strcasecmp($action, "addaccess") && $_GET["groupid"]==-1) { if (!strcasecmp($action, "addaccess") && $_GET["groupid"]==-1) {
$groupid = -1; $groupid = -1;
} }
else { else {
if (!is_object($dms->getGroup($_GET["groupid"]))) { if (!is_object($dms->getGroup($_GET["groupid"]))) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("unknown_group")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("unknown_group"));
} }
$groupid = $_GET["groupid"]; $groupid = $_GET["groupid"];
} }
} }
//Ändern des Besitzers ---------------------------------------------------------------------------- // Change owner -----------------------------------------------------------
if ($action == "setowner") { if ($action == "setowner") {
if (!$user->isAdmin()) { if (!$user->isAdmin()) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied"));
} }
if (!isset($_GET["ownerid"]) || !is_numeric($_GET["ownerid"]) || $_GET["ownerid"]<1) { if (!isset($_GET["ownerid"]) || !is_numeric($_GET["ownerid"]) || $_GET["ownerid"]<1) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("unknown_user")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("unknown_user"));
} }
$newOwner = $dms->getUser($_GET["ownerid"]); $newOwner = $dms->getUser($_GET["ownerid"]);
if (!is_object($newOwner)) { if (!is_object($newOwner)) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("unknown_user")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("unknown_user"));
} }
$oldOwner = $folder->getOwner(); $oldOwner = $folder->getOwner();
if($folder->setOwner($newOwner)) { if($folder->setOwner($newOwner)) {
if($notifier) { if($notifier) {
@ -134,23 +134,20 @@ if ($action == "setowner") {
getMLText("comment").": ".$folder->getComment()."\r\n". getMLText("comment").": ".$folder->getComment()."\r\n".
"URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$folder->getID()."\r\n"; "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$folder->getID()."\r\n";
// $subject=mydmsDecodeString($subject);
// $message=mydmsDecodeString($message);
$notifier->toList($user, $folder->_notifyList["users"], $subject, $message); $notifier->toList($user, $folder->_notifyList["users"], $subject, $message);
foreach ($folder->_notifyList["groups"] as $grp) { foreach ($folder->_notifyList["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message); $notifier->toGroup($user, $grp, $subject, $message);
} }
} }
} else { } else {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("set_owner_error")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("set_owner_error"));
} }
} }
//Änderung auf nicht erben ------------------------------------------------------------------------ // Set Permission to no inherit -------------------------------------------
else if ($action == "notinherit") { else if ($action == "notinherit") {
$defAccess = $folder->getDefaultAccess(); $defAccess = $folder->getDefaultAccess();
if($folder->setInheritAccess(false)) { if($folder->setInheritAccess(false)) {
if($notifier) { if($notifier) {
// Send notification to subscribers. // Send notification to subscribers.
@ -162,9 +159,6 @@ else if ($action == "notinherit") {
getMLText("folder").": ".$folder->getFolderPathPlain()."\r\n". getMLText("folder").": ".$folder->getFolderPathPlain()."\r\n".
"URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$folder->getID()."\r\n"; "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$folder->getID()."\r\n";
// $subject=mydmsDecodeString($subject);
// $message=mydmsDecodeString($message);
$notifier->toList($user, $folder->_notifyList["users"], $subject, $message); $notifier->toList($user, $folder->_notifyList["users"], $subject, $message);
foreach ($folder->_notifyList["groups"] as $grp) { foreach ($folder->_notifyList["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message); $notifier->toGroup($user, $grp, $subject, $message);
@ -182,31 +176,28 @@ else if ($action == "notinherit") {
getMLText("folder").": ".$folder->getFolderPathPlain()."\r\n". getMLText("folder").": ".$folder->getFolderPathPlain()."\r\n".
"URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$folder->getID()."\r\n"; "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$folder->getID()."\r\n";
// $subject=mydmsDecodeString($subject);
// $message=mydmsDecodeString($message);
$notifier->toList($user, $folder->_notifyList["users"], $subject, $message); $notifier->toList($user, $folder->_notifyList["users"], $subject, $message);
foreach ($folder->_notifyList["groups"] as $grp) { foreach ($folder->_notifyList["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message); $notifier->toGroup($user, $grp, $subject, $message);
} }
} }
} }
if ($mode == "copy") { if ($mode == "copy") {
$parent = $folder->getParent(); $parent = $folder->getParent();
$accessList = $parent->getAccessList(); $accessList = $parent->getAccessList();
foreach ($accessList["users"] as $userAccess) foreach ($accessList["users"] as $userAccess)
$folder->addAccess($userAccess->getMode(), $userAccess->getUserID(), true); $folder->addAccess($userAccess->getMode(), $userAccess->getUserID(), true);
foreach ($accessList["groups"] as $groupAccess) foreach ($accessList["groups"] as $groupAccess)
$folder->addAccess($groupAccess->getMode(), $groupAccess->getGroupID(), false); $folder->addAccess($groupAccess->getMode(), $groupAccess->getGroupID(), false);
} }
} }
//Änderung auf erben ------------------------------------------------------------------------------ // Set permission to inherit ----------------------------------------------
else if ($action == "inherit") { else if ($action == "inherit") {
if ($folderid == $settings->_rootFolderID || !$folder->getParent()) return; if ($folderid == $settings->_rootFolderID || !$folder->getParent()) return;
$folder->clearAccessList(); $folder->clearAccessList();
if($folder->setInheritAccess(true)) { if($folder->setInheritAccess(true)) {
if($notifier) { if($notifier) {
// Send notification to subscribers. // Send notification to subscribers.
@ -227,10 +218,10 @@ else if ($action == "inherit") {
} }
} }
} }
} }
//Standardberechtigung setzen---------------------------------------------------------------------- // Set default permission -------------------------------------------------
else if ($action == "setdefault") { else if ($action == "setdefault") {
if($folder->setDefaultAccess($mode)) { if($folder->setDefaultAccess($mode)) {
if($notifier) { if($notifier) {
// Send notification to subscribers. // Send notification to subscribers.
@ -251,42 +242,42 @@ else if ($action == "setdefault") {
} }
} }
} }
}
//Bestehende Berechtigung änndern -----------------------------------------------------------------
else if ($action == "editaccess") {
if (isset($userid)) {
$folder->changeAccess($mode, $userid, true);
}
else if (isset($groupid)) {
$folder->changeAccess($mode, $groupid, false);
}
}
//Berechtigung löschen ----------------------------------------------------------------------------
else if ($action == "delaccess") {
if (isset($userid)) {
$folder->removeAccess($userid, true);
}
else if (isset($groupid)) {
$folder->removeAccess($groupid, false);
}
}
//Neue Berechtigung hinzufügen --------------------------------------------------------------------
else if ($action == "addaccess") {
if (isset($userid) && $userid != -1) {
$folder->addAccess($mode, $userid, true);
}
if (isset($groupid) && $groupid != -1) {
$folder->addAccess($mode, $groupid, false);
}
} }
add_log_line(); // Modify permission ------------------------------------------------------
else if ($action == "editaccess") {
if (isset($userid)) {
$folder->changeAccess($mode, $userid, true);
}
else if (isset($groupid)) {
$folder->changeAccess($mode, $groupid, false);
}
}
// Delete Permission ------------------------------------------------------
else if ($action == "delaccess") {
if (isset($userid)) {
$folder->removeAccess($userid, true);
}
else if (isset($groupid)) {
$folder->removeAccess($groupid, false);
}
}
// Add new permission -----------------------------------------------------
else if ($action == "addaccess") {
if (isset($userid) && $userid != -1) {
$folder->addAccess($mode, $userid, true);
}
if (isset($groupid) && $groupid != -1) {
$folder->addAccess($mode, $groupid, false);
}
}
add_log_line();
header("Location:../out/out.FolderAccess.php?folderid=".$folderid); header("Location:../out/out.FolderAccess.php?folderid=".$folderid);
?> ?>