2011-01-28 07:38:39 +00:00
|
|
|
<?php
|
|
|
|
// MyDMS. Document Management System
|
|
|
|
// Copyright (C) 2010 Matteo Lucarelli
|
|
|
|
//
|
|
|
|
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
include("../inc/inc.Settings.php");
|
2011-05-16 15:44:59 +00:00
|
|
|
include("../inc/inc.LogInit.php");
|
2011-01-28 07:38:39 +00:00
|
|
|
include("../inc/inc.ClassEmail.php");
|
2010-10-29 13:19:51 +00:00
|
|
|
include("../inc/inc.DBInit.php");
|
2011-01-28 07:38:39 +00:00
|
|
|
include("../inc/inc.Language.php");
|
|
|
|
include("../inc/inc.ClassUI.php");
|
2010-10-29 13:19:51 +00:00
|
|
|
include("../inc/inc.Authentication.php");
|
|
|
|
|
|
|
|
if (!$user->isAdmin()) {
|
2011-01-28 07:38:39 +00:00
|
|
|
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
2010-10-29 13:19:51 +00:00
|
|
|
}
|
|
|
|
|
2012-08-29 20:37:22 +00:00
|
|
|
/* Check if the form data comes for a trusted request */
|
|
|
|
if(!checkFormKey('removefolderfiles')) {
|
|
|
|
UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
|
|
|
|
}
|
|
|
|
|
2011-01-28 07:38:39 +00:00
|
|
|
function removeFolderFiles($folder) {
|
|
|
|
global $dms;
|
|
|
|
|
2010-10-29 13:19:51 +00:00
|
|
|
$documents = $folder->getDocuments();
|
|
|
|
foreach ($documents as $document)
|
2013-02-14 11:10:53 +00:00
|
|
|
SeedDMS_Core_File::removeDir($dms->contentDir . $document->getDir());
|
2010-10-29 13:19:51 +00:00
|
|
|
|
|
|
|
$subFolders = $folder->getSubFolders();
|
2011-01-28 07:38:39 +00:00
|
|
|
|
|
|
|
foreach ($subFolders as $folder)
|
|
|
|
removeFolderFiles($folder);
|
2010-10-29 13:19:51 +00:00
|
|
|
|
|
|
|
return true;
|
2011-01-28 07:38:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!isset($_POST["folderid"]) || !is_numeric($_POST["folderid"]) || intval($_POST["folderid"])<1) {
|
|
|
|
UI::exitError(getMLText("admin_tools"),getMLText("invalid_folder_id"));
|
|
|
|
}
|
|
|
|
$folderid = $_POST["folderid"];
|
2010-11-12 22:47:41 +00:00
|
|
|
$folder = $dms->getFolder($folderid);
|
2011-01-28 07:38:39 +00:00
|
|
|
|
|
|
|
if (!is_object($folder)) {
|
|
|
|
UI::exitError(getMLText("admin_tools"),getMLText("invalid_folder_id"));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!removeFolderFiles($folder)) {
|
|
|
|
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
2010-10-29 13:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
add_log_line();
|
|
|
|
|
2011-01-28 07:38:39 +00:00
|
|
|
header("Location:../out/out.BackupTools.php");
|
|
|
|
?>
|