<?php
class exportAction extends Action
{
    function execute(&$controller, &$request)
    {
        $root = mamboCore::get('rootPath');
        include($root.'/administrator/includes/pcl/pclzip.lib.php');
        chdir($root);
        $lang = mosGetParam($_POST, 'lang', '');
        $language = new mamboLanguage($lang);
        $language->load(true);
        $zipfile = "$root/language/MamboLanguage_$lang.zip";
        $archive = new PclZip($zipfile);
        $archive->create( "$root/language/$lang.xml", PCLZIP_OPT_REMOVE_PATH, $root.'/language');
        $archive->add("$root/language/glossary/$lang.po",  PCLZIP_OPT_REMOVE_PATH, $root.'/language');
        foreach ($language->files as $file) {
            $archive->add($root.'/'.$file['filename'], PCLZIP_OPT_REMOVE_PATH, $root.'/language');
        }
        
        /*$zip = new PclZip("$root/MamboLanguage_$lang.zip");
        dump($zip->extract());      
        dump($zip);  ;*/
        header("Content-Type: application/octet-stream");
        header("Content-Disposition: attachment; filename=MamboLanguage_$lang.zip");
        #header("Content-length: ".filesize($zipfile));
        readfile($zipfile);
        exit(0);        
    }
}

?>