<?php
class removeAction extends Action
{
    function execute(&$controller, &$request)
    {
        $langpath = mamboCore::get('rootPath').'/language/';
        if ($_POST['lang'] && $_POST['lang'] != 'en') {
            @unlink($langpath.$_POST['lang'].'.xml');
            $this->rmdir($langpath.$_POST['lang']);
        }
        $controller->redirect('index', mosGetParam($_REQUEST, 'act', 'language'));
    }
    function rmdir($dir) {
        if($files = glob($dir."/*")){
            foreach($files as $file) {
                is_dir($file)? $this->rmdir($file) : unlink($file);
            }
        }
        rmdir($dir);
    }
}

?>