| 2775 | 
           rexy | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
           /**
  | 
        
        
            | 
            | 
           3 | 
            * language reading
  | 
        
        
            | 
            | 
           4 | 
            * read the language wich is passed as a parameter in the url and if
  | 
        
        
            | 
            | 
           5 | 
            * it is not available read the default language
  | 
        
        
            | 
            | 
           6 | 
            *
  | 
        
        
            | 
            | 
           7 | 
            * PHP version 5
  | 
        
        
            | 
            | 
           8 | 
            *
  | 
        
        
            | 
            | 
           9 | 
            * @category  PHP
  | 
        
        
            | 
            | 
           10 | 
            * @package   PSI_Language
  | 
        
        
            | 
            | 
           11 | 
            * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
  | 
        
        
            | 
            | 
           12 | 
            * @copyright 2009 phpSysInfo
  | 
        
        
            | 
            | 
           13 | 
            * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
  | 
        
        
            | 
            | 
           14 | 
            * @version   SVN: $Id: language.php 661 2012-08-27 11:26:39Z namiltd $
  | 
        
        
            | 
            | 
           15 | 
            * @link      http://phpsysinfo.sourceforge.net
  | 
        
        
            | 
            | 
           16 | 
            */
  | 
        
        
            | 
            | 
           17 | 
              | 
        
        
            | 
            | 
           18 | 
           // Set the correct content-type header.
  | 
        
        
            | 
            | 
           19 | 
           header("Content-Type: text/xml\n\n");
  | 
        
        
            | 
            | 
           20 | 
              | 
        
        
            | 
            | 
           21 | 
           /**
  | 
        
        
            | 
            | 
           22 | 
            * default language
  | 
        
        
            | 
            | 
           23 | 
            *
  | 
        
        
            | 
            | 
           24 | 
            * @var String
  | 
        
        
            | 
            | 
           25 | 
            */
  | 
        
        
            | 
            | 
           26 | 
           $lang = 'en';
  | 
        
        
            | 
            | 
           27 | 
              | 
        
        
            | 
            | 
           28 | 
           /**
  | 
        
        
            | 
            | 
           29 | 
            * default pluginname
  | 
        
        
            | 
            | 
           30 | 
            *
  | 
        
        
            | 
            | 
           31 | 
            * @var String
  | 
        
        
            | 
            | 
           32 | 
            */
  | 
        
        
            | 
            | 
           33 | 
           $plugin = '';
  | 
        
        
            | 
            | 
           34 | 
              | 
        
        
            | 
            | 
           35 | 
           /**
  | 
        
        
            | 
            | 
           36 | 
            * application root path
  | 
        
        
            | 
            | 
           37 | 
            *
  | 
        
        
            | 
            | 
           38 | 
            * @var string
  | 
        
        
            | 
            | 
           39 | 
            */
  | 
        
        
            | 
            | 
           40 | 
           define('PSI_APP_ROOT', realpath(dirname((__FILE__)).'/../'));
  | 
        
        
            | 
            | 
           41 | 
              | 
        
        
            | 
            | 
           42 | 
           include_once PSI_APP_ROOT.'/read_config.php';
  | 
        
        
            | 
            | 
           43 | 
              | 
        
        
            | 
            | 
           44 | 
           if (defined('PSI_DEFAULT_LANG')) {
  | 
        
        
            | 
            | 
           45 | 
               $lang = PSI_DEFAULT_LANG;
  | 
        
        
            | 
            | 
           46 | 
           }
  | 
        
        
           | 2795 | 
           rexy | 
           47 | 
           /** ALCASAR changes
  | 
        
        
            | 
            | 
           48 | 
            *  $lang set by the web browser config
  | 
        
        
            | 
            | 
           49 | 
            */
  | 
        
        
            | 
            | 
           50 | 
            if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
  | 
        
        
            | 
            | 
           51 | 
           	$Langue	  = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
  | 
        
        
            | 
            | 
           52 | 
           	$lang = strtolower(substr(chop($Langue[0]), 0, 2));
  | 
        
        
           | 2802 | 
           rexy | 
           53 | 
           }
  | 
        
        
           | 2800 | 
           rexy | 
           54 | 
           //if (isset($_GET['lang']) && (trim($_GET['lang'])!=="")
  | 
        
        
            | 
            | 
           55 | 
           //   && !preg_match('/[^A-Za-z\-]/', $_GET['lang'])
  | 
        
        
            | 
            | 
           56 | 
           //   && file_exists(PSI_APP_ROOT.'/language/'.$_GET['lang'].'.xml')) {
  | 
        
        
            | 
            | 
           57 | 
           //    $lang = strtolower($_GET['lang']);
  | 
        
        
            | 
            | 
           58 | 
           //}
  | 
        
        
            | 
            | 
           59 | 
              | 
        
        
           | 2775 | 
           rexy | 
           60 | 
           if (isset($_GET['plugin'])) {
  | 
        
        
            | 
            | 
           61 | 
              if ((trim($_GET['plugin'])!=="") && !preg_match('/[^A-Za-z]/', $_GET['plugin'])) {
  | 
        
        
            | 
            | 
           62 | 
                  $plugin = strtolower($_GET['plugin']);
  | 
        
        
            | 
            | 
           63 | 
                   if (file_exists(PSI_APP_ROOT.'/plugins/'.$plugin.'/lang/'.$lang.'.xml')) {
  | 
        
        
            | 
            | 
           64 | 
                       echo file_get_contents(PSI_APP_ROOT.'/plugins/'.$plugin.'/lang/'.$lang.'.xml');
  | 
        
        
            | 
            | 
           65 | 
                   } elseif (file_exists(PSI_APP_ROOT.'/plugins/'.$plugin.'/lang/en.xml')) {
  | 
        
        
            | 
            | 
           66 | 
                       echo file_get_contents(PSI_APP_ROOT.'/plugins/'.$plugin.'/lang/en.xml');
  | 
        
        
            | 
            | 
           67 | 
                   }
  | 
        
        
            | 
            | 
           68 | 
              }
  | 
        
        
            | 
            | 
           69 | 
           } else {
  | 
        
        
            | 
            | 
           70 | 
               if (file_exists(PSI_APP_ROOT.'/language/'.$lang.'.xml')) {
  | 
        
        
            | 
            | 
           71 | 
                   echo file_get_contents(PSI_APP_ROOT.'/language/'.$lang.'.xml');
  | 
        
        
            | 
            | 
           72 | 
               } else {
  | 
        
        
            | 
            | 
           73 | 
                   echo file_get_contents(PSI_APP_ROOT.'/language/en.xml');
  | 
        
        
            | 
            | 
           74 | 
               }
  | 
        
        
            | 
            | 
           75 | 
           }
  |