[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/components/com_languages/actions/ -> remove.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 removeAction extends Action
  19  {
  20      function execute(&$controller, &$request)
  21      {
  22          $langpath = mamboCore::get('rootPath').'/language/';
  23          $lang = mosGetParam($_POST,'lang','en');
  24          if ($lang != 'en') {
  25              $language =& new mamboLanguage($lang);
  26              @unlink($langpath.'glossary/'.$lang.'.'.$language->charset.'.po');
  27              @unlink($langpath.$_POST['lang'].'.xml');
  28              $this->rmdir($langpath.$_POST['lang']);
  29          }
  30          $controller->redirect('index', mosGetParam($_REQUEST, 'act', 'language'));
  31      }
  32      function rmdir($dir) {
  33          if($files = glob($dir."/*")){
  34              foreach($files as $file) {
  35                  is_dir($file)? $this->rmdir($file) : unlink($file);
  36              }
  37          }
  38          rmdir($dir);
  39      }
  40  }
  41  
  42  ?>