[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/administrator/components/com_languages/actions/ -> export.action.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Languages
   5  * @author Mambo Foundation Inc see README.php
   6  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   7  * See COPYRIGHT.php for copyright notices and details.
   8  * @license GNU/GPL Version 2, see LICENSE.php
   9  *
  10  * Redistributions of files must retain the above copyright notice.
  11  *
  12  * Mambo is free software; you can redistribute it and/or
  13  * modify it under the terms of the GNU General Public License
  14  * as published by the Free Software Foundation; version 2 of the License.
  15  */
  16  
  17  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  18  class exportAction extends Action
  19  {
  20      function execute(&$controller, &$request)
  21      {
  22          $root = mamboCore::get('rootPath');
  23          $live = mamboCore::get('mosConfig_live_site');
  24          include ($root.'/administrator/includes/pcl/pclzip.lib.php');
  25          chdir($root);
  26  
  27          $lang = mosGetParam($_POST, 'lang', '');
  28          $language = new mamboLanguage($lang);
  29          $language->load(true);
  30          $zipfile = "$root/media/MamboLanguage_$lang.zip";
  31          $archive = new PclZip($zipfile);
  32  
  33          foreach ($language->files as $file) {
  34              if (file_exists($root.'/'.$file['filename'])){
  35              $v_list = $archive->add($root.'/'.$file['filename'], PCLZIP_OPT_REMOVE_PATH, $root.'language/');
  36              if ($v_list == 0){
  37                 die("Error : ".$archive->errorInfo(true));
  38                  }
  39              }
  40          }
  41  
  42          if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $UserAgent)) {
  43              $UserBrowser = "Opera";
  44          }
  45          elseif (ereg('MSIE ([0-9].[0-9]{1,2})', $UserAgent)) {
  46              $UserBrowser = "IE";
  47          } else {
  48              $UserBrowser = '';
  49          }
  50          $mime_type = 'application/x-zip';
  51          $filename = "MamboLanguage_$lang.zip";
  52          @ob_end_clean();
  53          ob_start();
  54          header('Content-Type: ' . $mime_type);
  55          header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  56  
  57          if ($UserBrowser == 'IE') {
  58              header('Content-Disposition: inline; filename="' . $filename . '"');
  59              header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  60              header('Pragma: public');
  61          } else {
  62              header('Content-Disposition: attachment; filename="' . $filename . '"');
  63              header('Pragma: no-cache');
  64          }
  65          
  66          readfile($zipfile);
  67          ob_end_flush();
  68          $fmanager =& mosFileManager::getInstance();
  69          $fmanager->deleteFile($zipfile);
  70          exit(0);
  71      }
  72  }
  73  
  74  ?>