Ignore:
Timestamp:
04/16/10 12:11:51 (14 years ago)
Author:
rodsouza
Message:

Ticket #1009 - Corrigindo problemas com a execução de javascript no ExpressoMail?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/load_lang.php

    r2549 r2561  
    1111\**************************************************************************/ 
    1212 
    13 // Load the lang of the module. 
    14 if(isset($offline_language)) { //Expresso offline, quando o gears sincroniza com uma nova versão, não é dado acesso as sessões do usuário, e é preciso o nome do arquivo de linguagens na session abaixo. 
    15         $_SESSION['phpgw_info']['expressomail']['user']['preferences']['common']['lang'] = $offline_language; 
     13if ( array_key_exists( 'lang', $_GET ) ) 
     14        $lang = $_GET[ 'lang' ]; 
     15else 
     16{ 
     17        if ( isset( $_SESSION[ 'phpgw_info' ][ 'expressomail' ][ 'user' ][ 'preferences' ][ 'common' ][ 'lang' ] ) ) 
     18                $lang = $_SESSION[ 'phpgw_info' ][ 'expressomail' ][ 'user' ][ 'preferences' ][ 'common' ][ 'lang' ]; 
    1619} 
    1720 
    18 if(!$_SESSION['phpgw_info']['expressomail']['lang']) 
     21 
     22$array_keys = array(); 
     23$fn = dirname( __FILE__ ) . "/../setup/phpgw_{$lang}.lang"; 
     24$lang = array( ); 
     25 
     26if ( file_exists( $fn ) ) 
    1927{ 
    20         $array_keys = array(); 
    21         $fn = 'setup/phpgw_'.$_SESSION['phpgw_info']['expressomail']['user']['preferences']['common']['lang'].'.lang'; 
    22         if (file_exists($fn)){ 
    23                 $fp = fopen($fn,'r'); 
    24                 while ($data = fgets($fp,16000)){ 
    25                         list($message_id,$app_name,$null,$content) = explode("\t",substr($data,0,-1)); 
    26                         $_SESSION['phpgw_info']['expressomail']['lang'][$message_id] =  $content; 
    27                 } 
    28                 fclose($fp); 
     28        $fp = fopen( $fn, 'r' ); 
     29        while ( $data = fgets( $fp, 16000 ) ) 
     30        { 
     31                list( $message_id, $app_name, $null, $content ) = explode( "\t", substr( $data, 0, -1 ) ); 
     32                $lang[ ] = '"' . str_replace( '"', '\"', strtolower( $message_id ) ) . '" : "' . str_replace( '"', '\"', $content ) . '"'; 
    2933        } 
     34        fclose($fp); 
    3035} 
    3136 
    32 foreach($_SESSION['phpgw_info']['expressomail']['lang'] as $key => $value) 
    33         $script .= "array_lang['".str_replace("'","\'",strtolower($key))."'] = '".str_replace("'","\'",$value)."';\n"; 
     37echo '{' . implode( ",\n", $lang ) . '}' 
    3438 
    35 $GLOBALS['phpgw_info']['flags']['java_script_thirst'] = '<script type="text/javascript">var array_lang = new Array();'.$script.'</script>'; 
    3639?> 
Note: See TracChangeset for help on using the changeset viewer.