/**
 * deletes all the files, folders, comments, revisions, etc.. in the specified workspace.
 */
function fs_delete_workspace($owner_type, $owner_id) {
	global $db;

	$sql = "SELECT folder_id, owner_type, owner_id FROM ".TABLE_PREFIX."folders WHERE owner_type=$owner_type AND owner_id=$owner_id AND parent_folder_id=0";
	$result = mysql_query($sql, $db);
	while ($row = mysql_fetch_assoc($result)) {
		fs_delete_folder($row['folder_id'], $row['owner_type'], $row['owner_id']);
	}

	$sql = "SELECT file_id, owner_type, owner_id FROM ".TABLE_PREFIX."files WHERE owner_type=$owner_type AND owner_id=$owner_id";
	$result = mysql_query($sql, $db);
	while ($row = mysql_fetch_assoc($result)) {
		fs_delete_file($row['file_id'], $row['owner_type'], $row['owner_id']);
	}
}
Beispiel #2
0
     // handle the delete
     if (isset($_POST['files'])) {
         $files = explode(',', $_POST['files']);
     }
     if (isset($_POST['folders'])) {
         $folders = explode(',', $_POST['folders']);
     }
     if (isset($files)) {
         foreach ($files as $file) {
             fs_delete_file($file, $owner_type, $owner_id);
         }
         $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
     }
     if (isset($folders)) {
         foreach ($folders as $folder) {
             fs_delete_folder($folder, $owner_type, $owner_id);
         }
         $msg->addFeedback('DIR_DELETED');
     }
     header('Location: ' . url_rewrite('mods/_standard/file_storage/index.php' . $owner_arg_prefix . 'folder=' . abs($_POST['folder']), AT_PRETTY_URL_IS_HEADER));
     exit;
 } else {
     if (query_bit($owner_status, WORKSPACE_AUTH_WRITE) && isset($_POST['submit_no'])) {
         $msg->addFeedback('CANCELLED');
         header('Location: ' . url_rewrite('mods/_standard/file_storage/index.php' . $owner_arg_prefix . 'folder=' . abs($_POST['folder']), AT_PRETTY_URL_IS_HEADER));
         exit;
         // action - Create Folder
     } else {
         if (query_bit($owner_status, WORKSPACE_AUTH_WRITE) && isset($_POST['create_folder'])) {
             // create a new folder
             $_POST['new_folder_name'] = trim($_POST['new_folder_name']);
/**
 * deletes all the files, folders, comments, revisions, etc.. in the specified workspace.
 */
function fs_delete_workspace($owner_type, $owner_id)
{
    $sql = "SELECT folder_id, owner_type, owner_id FROM %sfolders WHERE owner_type=%d AND owner_id=%d AND parent_folder_id=0";
    $rows_folders = queryDB($sql, array(TABLE_PREFIX, $owner_type, $owner_id));
    foreach ($rows_folders as $row) {
        fs_delete_folder($row['folder_id'], $row['owner_type'], $row['owner_id']);
    }
    $sql = "SELECT file_id, owner_type, owner_id FROM %sfiles WHERE owner_type=%d AND owner_id=%d";
    $rows_files = queryDB($sql, array(TABLE_PREFIX, $owner_type, $owner_id));
    foreach ($rows_files as $row) {
        fs_delete_file($row['file_id'], $row['owner_type'], $row['owner_id']);
    }
}