1<?php 2 3/** 4 +-----------------------------------------------------------------------+ 5 | This file is part of the Roundcube Webmail client | 6 | | 7 | Copyright (C) The Roundcube Dev Team | 8 | | 9 | Licensed under the GNU General Public License version 3 or | 10 | any later version with exceptions for skins & plugins. | 11 | See the README file for a full license statement. | 12 | | 13 | PURPOSE: | 14 | Provide functionality to delete a folder | 15 +-----------------------------------------------------------------------+ 16 | Author: Thomas Bruederli <roundcube@gmail.com> | 17 | Author: Aleksander Machniak <alec@alec.pl> | 18 +-----------------------------------------------------------------------+ 19*/ 20 21class rcmail_action_settings_folder_delete extends rcmail_action 22{ 23 protected static $mode = self::MODE_AJAX; 24 25 /** 26 * Request handler. 27 * 28 * @param array $args Arguments from the previous step(s) 29 */ 30 public function run($args = []) 31 { 32 $rcmail = rcmail::get_instance(); 33 $storage = $rcmail->get_storage(); 34 $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true); 35 36 if (strlen($mbox)) { 37 $plugin = $rcmail->plugins->exec_hook('folder_delete', ['name' => $mbox]); 38 39 if (empty($plugin['abort'])) { 40 $deleted = $storage->delete_folder($plugin['name']); 41 } 42 else { 43 $deleted = $plugin['result']; 44 } 45 46 // #1488692: update session 47 if ($deleted && isset($_SESSION['mbox']) && $_SESSION['mbox'] === $mbox) { 48 $rcmail->session->remove('mbox'); 49 } 50 } 51 52 if (!empty($deleted)) { 53 // Remove folder and subfolders rows 54 $rcmail->output->command('remove_folder_row', $mbox); 55 $rcmail->output->show_message('folderdeleted', 'confirmation'); 56 // Clear content frame 57 $rcmail->output->command('subscription_select'); 58 $rcmail->output->command('set_quota', self::quota_content()); 59 } 60 else { 61 self::display_server_error('errorsaving'); 62 } 63 64 $rcmail->output->send(); 65 } 66} 67