Ignore:
Timestamp:
08/16/07 08:06:05 (17 years ago)
Author:
niltonneto
Message:

Nova versão do Instant Messenger.

File:
1 edited

Legend:

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

    r20 r55  
    11<? 
    2 // Load the lang of the module. 
    3         if(!$_SESSION['phpgw_info']['instant_messenger']['lang'])  
    4         { 
    5                 $array_keys = array(); 
    6                 $fn = '../setup/phpgw_pt-br.lang';                       
    7                 if (file_exists($fn)){ 
    8                         $fp = fopen($fn,'r'); 
    9                         while ($data = fgets($fp,16000))        { 
    10                                 list($message_id,$app_name,$null,$content) = explode("\t",substr($data,0,-1));                   
    11                                 $_SESSION['phpgw_info']['instant_messenger']['lang'][$message_id] =  $content; 
    12                         } 
    13                         fclose($fp); 
    14                 } 
    15         } 
    16         $script  = "IM.array_lang_im[0] = new Array();"; 
    17         $script .= "IM.array_lang_im[1] = new Array();";                 
    18         $i = 0; 
    19         foreach($_SESSION['phpgw_info']['instant_messenger']['lang'] as $key => $value) {                
    20                 $script .= "IM.array_lang_im[0][".$i."] = '".str_replace("'","\'",strtolower($key))."';";                
    21                 $script .= "IM.array_lang_im[1][".$i."] = '".str_replace("'","\'",$value)."';"; 
    22                 $i++;                                    
    23         } 
    24          
    25         echo $script; 
     2if ( !isset($_SESSION['phpgw_info']['instant_messenger']['lang']) || !is_array($_SESSION['phpgw_info']['instant_messenger']['lang']) ) 
     3   if ( file_exists(($fn = dirname(__FILE__) . '/../setup/phpgw_pt-br.lang')) ) 
     4      if ( ($fp = fopen($fn,'r')) ) 
     5      { 
     6         while ($data = fgets($fp,16000)) 
     7         { 
     8            list($message_id, $app_name, $null, $content) = explode("\t",substr($data,0,-1)); 
     9            $_SESSION['phpgw_info']['instant_messenger']['lang'][$message_id] = $content; 
     10         } 
     11         fclose($fp); 
     12      } 
     13 
     14$script  = '<script>'; 
     15$script .= 'var lang_im = [];'; 
     16 
     17foreach ( $_SESSION['phpgw_info']['instant_messenger']['lang'] as $key => $value ) 
     18   $script .= "lang_im['" . strtolower(addslashes($key)) . "'] = '" . addslashes($value) . "';"; 
     19 
     20   #$_key = str_replace("'","\'",strtolower($key)); 
     21   #$_val = str_replace("'","\'",$value); 
     22 
     23$script .= '</script>'; 
     24 
     25echo $script; 
    2626?> 
Note: See TracChangeset for help on using the changeset viewer.