phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] api class.lang.php, 1.1.2.3, 1.1.2.4 class.phpgw.php,


From: Dan Kuykendall <address@hidden>
Subject: [Phpgroupware-cvs] api class.lang.php, 1.1.2.3, 1.1.2.4 class.phpgw.php, 1.1.1.1.2.4, 1.1.1.1.2.5 core_functions.inc.php, 1.1.1.1.2.1, 1.1.1.1.2.2 starter.inc.php, 1.1.1.1.2.2, 1.1.1.1.2.3
Date: Sat, 25 Oct 2003 18:29:24 +0000

Update of /cvsroot/phpgroupware/api
In directory subversions:/tmp/cvs-serv2703/api

Modified Files:
      Tag: proposal-branch
        class.lang.php class.phpgw.php core_functions.inc.php 
        starter.inc.php 
Log Message:
updated landg class

Index: starter.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/starter.inc.php,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.3
diff -C2 -d -r1.1.1.1.2.2 -r1.1.1.1.2.3
*** starter.inc.php     24 Oct 2003 22:09:44 -0000      1.1.1.1.2.2
--- starter.inc.php     25 Oct 2003 18:29:22 -0000      1.1.1.1.2.3
***************
*** 204,208 ****
        else
        {
!               $GLOBALS['msgbox']->add('You do not have access to 
'.$methodname,__LINE__,__FILE__, 'access');
                foreach($inputs as $key=>$val)                          
                {
--- 204,208 ----
        else
        {
!               $GLOBALS['msgbox']->add(lang('You do not have access to 
').$methodname,__LINE__,__FILE__, 'access');
                foreach($inputs as $key=>$val)                          
                {

Index: core_functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/core_functions.inc.php,v
retrieving revision 1.1.1.1.2.1
retrieving revision 1.1.1.1.2.2
diff -C2 -d -r1.1.1.1.2.1 -r1.1.1.1.2.2
*** core_functions.inc.php      23 Oct 2003 20:27:53 -0000      1.1.1.1.2.1
--- core_functions.inc.php      25 Oct 2003 18:29:22 -0000      1.1.1.1.2.2
***************
*** 108,112 ****
                                        elseif(!$silent)
                                        {
!                                               
$GLOBALS['msgbox']->add($class.' does not exist',__LINE__,__FILE__, 'warning');
                                        }
                                }
--- 108,117 ----
                                        elseif(!$silent)
                                        {
!                                               $msg = 'does not exist';
!                                               if(function_exists('lang'))
!                                               {
!                                                       $msg = lang($msg);
!                                               }
!                                               
$GLOBALS['msgbox']->add($class.' '.$msg,__LINE__,__FILE__, 'warning');
                                        }
                                }
***************
*** 142,146 ****
                                elseif(!$silent)
                                {
!                                       
$GLOBALS['msgbox']->add($class.'::'.$methodname.' does not 
exist',__LINE__,__FILE__, 'warning'); 
                                }                       
                        }
--- 147,156 ----
                                elseif(!$silent)
                                {
!                                       $msg = 'does not exist';
!                                       if(function_exists('lang'))
!                                       {
!                                               $msg = lang($msg);
!                                       }
!                                       
$GLOBALS['msgbox']->add($class.'::'.$methodname.' '.$msg,__LINE__,__FILE__, 
'warning'); 
                                }                       
                        }
***************
*** 286,290 ****
                                        {
                                                case '##REQUIRED##':
!                                                       
$GLOBALS['msgbox']->add('Missing required paramater "'.$key.'"',$line,$file, 
'fatal');
                                                        break;
                                                case '##DEFAULT##':
--- 296,305 ----
                                        {
                                                case '##REQUIRED##':
!                                                       $msg = 'Missing 
required paramater';
!                                                       
if(function_exists('lang'))
!                                                       {
!                                                               $msg = 
lang($msg);
!                                                       }
!                                                       
$GLOBALS['msgbox']->add($msg.' "'.$key.'"',$line,$file, 'fatal');
                                                        break;
                                                case '##DEFAULT##':
***************
*** 297,301 ****
                                                        
if(!sanitize($val,$this->types[$key]))
                                                        {
!                                                               
$GLOBALS['msgbox']->add('Invalid paramater type for "'.$key.'"',$line,$file, 
'fatal');
                                                        }
                                        }                               
--- 312,321 ----
                                                        
if(!sanitize($val,$this->types[$key]))
                                                        {
!                                                               $msg = 'Invalid 
paramater type for';
!                                                               
if(function_exists('lang'))
!                                                               {
!                                                                       $msg = 
lang($msg);
!                                                               }
!                                                               
$GLOBALS['msgbox']->add($msg.' "'.$key.'"',$line,$file, 'fatal');
                                                        }
                                        }                               
***************
*** 381,385 ****
                                        if ($pass_length < 
(int)$GLOBALS['phpgw_data']['server']['pass_min_length'])
                                        {
!                                               
$GLOBALS['msgbox']->add('Password must be at least '.$min_length.' 
characters',__LINE__,__FILE__, 'error');
                                                return False;
                                        }
--- 401,415 ----
                                        if ($pass_length < 
(int)$GLOBALS['phpgw_data']['server']['pass_min_length'])
                                        {
!                                               $msg = 'Password must be at 
least';
!                                               if(function_exists('lang'))
!                                               {
!                                                       $msg = lang($msg);
!                                               }
!                                               $msg2 = 'characters';
!                                               if(function_exists('lang'))
!                                               {
!                                                       $msg2 = lang($msg2);
!                                               }
!                                               $GLOBALS['msgbox']->add($msg.' 
'.$min_length.' '.$msg2,__LINE__,__FILE__, 'error');
                                                return False;
                                        }
***************
*** 390,394 ****
                                        if (!preg_match("[[:^alpha:]]", $input))
                                        {
!                                               
$GLOBALS['msgbox']->add('Password requires at least one non-alpha 
character',__LINE__,__FILE__, 'error');                                         
      
                                                return False;
                                        }
--- 420,429 ----
                                        if (!preg_match("[[:^alpha:]]", $input))
                                        {
!                                               $msg = 'Password requires at 
least one non-alpha character';
!                                               if(function_exists('lang'))
!                                               {
!                                                       $msg = lang($msg);
!                                               }
!                                               $GLOBALS['msgbox']->add($msg 
,__LINE__,__FILE__, 'error');                                              
                                                return False;
                                        }
***************
*** 399,403 ****
                                        if (!preg_match("/^[0-9]+$/", $input))
                                        {
!                                               
$GLOBALS['msgbox']->add('Password requires at least one numeric 
character',__LINE__,__FILE__, 'error');                                         
                                                return False;
                                        }
--- 434,443 ----
                                        if (!preg_match("/^[0-9]+$/", $input))
                                        {
!                                               $msg = 'Password requires at 
least one numeric character';
!                                               if(function_exists('lang'))
!                                               {
!                                                       $msg = lang($msg);
!                                               }
!                                               $GLOBALS['msgbox']->add($msg 
,__LINE__,__FILE__, 'error');                                              
                                                return False;
                                        }
***************
*** 408,412 ****
                                        if (preg_match("[[:^alnum:]]", $input))
                                        {
!                                               
$GLOBALS['msgbox']->add('Password requires at least one special character 
(non-letter and non-number)',__LINE__,__FILE__, 'error');                       
                      
                                                return False;
                                        }
--- 448,457 ----
                                        if (preg_match("[[:^alnum:]]", $input))
                                        {
!                                               $msg = 'Password requires at 
least one special character (non-letter and non-number)';
!                                               if(function_exists('lang'))
!                                               {
!                                                       $msg = lang($msg);
!                                               }
!                                               $GLOBALS['msgbox']->add($msg 
,__LINE__,__FILE__, 'error');                                              
                                                return False;
                                        }

Index: class.lang.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/Attic/class.lang.php,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** class.lang.php      24 Oct 2003 23:17:43 -0000      1.1.2.3
--- class.lang.php      25 Oct 2003 18:29:21 -0000      1.1.2.4
***************
*** 28,32 ****
                var $messages = array();
                var     $domain = 'messages';
!               var     $language = 'en';
                var     $registered_app = 'api';
                var $envset = False;
--- 28,32 ----
                var $messages = array();
                var     $domain = 'messages';
!               var     $language;
                var     $registered_app = 'api';
                var $envset = False;
***************
*** 34,37 ****
--- 34,42 ----
                function api_lang()
                {
+                       if(!isset($GLOBALS['phpgw_data']['prefs']['api.lang']))
+                       {
+                               $GLOBALS['phpgw_data']['prefs']['api.lang'] = 
'en';
+                       }
+                       $this->language = 
$GLOBALS['phpgw_data']['prefs']['api.lang'];
                        $this->switchlang();
                }
***************
*** 64,73 ****
                        if($result == $msg)
                        {
!                               //if(1 == 1)
!                               
if($GLOBALS['phpgw_data']['server']['usebabelfish'] == 'Yes')
!                               {
!                                       return 
$this->_babelfish_translate($omsg);
!                               }
!                               return $omsg;                                   
                        }
  
--- 69,73 ----
                        if($result == $msg)
                        {
!                               return $this->translate_service($omsg);
                        }
  
***************
*** 75,87 ****
                }
  
!               function _babelfish_translate($msg)
                {
                        if(!function_exists('curl_init'))
                        {
                                return $msg;
                        }
!                       $str = 
'urltext='.urlencode($msg).'&lp=en_'.$this->language.'&submit=Translate';
                        $ch = curl_init();
!                       curl_setopt($ch, 
CURLOPT_URL,"http://babelfish.altavista.com/babelfish/tr";);
                        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
                        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
--- 75,115 ----
                }
  
!               function translate_service($msg)
                {
+                       
if(!isset($GLOBALS['phpgw_data']['server']['translate_service']))
+                       {
+                               
$GLOBALS['phpgw_data']['server']['translate_service'] = 'google';
+                       }
+                       
+                       switch 
($GLOBALS['phpgw_data']['server']['translate_service'])
+                       {
+                               case 'disabled':
+                                       return $msg;
+                                       break;
+                               case 'babelfish':
+                                       $url_string = 
'http://babelfish.altavista.com/babelfish/tr';
+                                       $get_string = 
'urltext='.urlencode($msg).'&lp=en_'.$this->language.'&submit=Translate'; 
+                                       $start_string = 'padding:10px; 
lang='.$this->language.'>';
+                                       $end_string = '</div>';
+                                       break;
+                               case 'google':
+                               default:
+                                       $url_string = 
'http://translate.google.com/translate_t';
+                                       $get_string = 
'text='.urlencode($msg).'&langpair=en|'.$this->language.'&submit=Translate'; 
+                                       $start_string = '<textarea name=q 
rows=5 cols=45 wrap=PHYSICAL>';
+                                       $start_string2 = '<textarea name=q 
rows=5 cols=45 wrap=PHYSICAL readonly>';
+                                       $end_string = '</textarea>';
+                       }
+                       
                        if(!function_exists('curl_init'))
                        {
                                return $msg;
                        }
!                       if(isset($GLOBALS['phpgw_session']['lang_cache'][$msg]))
!                       {
!                               return 
$GLOBALS['phpgw_session']['lang_cache'][$msg];
!                       }
                        $ch = curl_init();
!                       curl_setopt($ch, CURLOPT_URL,$url_string);
                        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
                        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
***************
*** 89,105 ****
                        curl_setopt ($ch, CURLOPT_HEADER, 0);
                        curl_setopt($ch, CURLOPT_POST, 1);
!                       curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
                        ob_start();
                        curl_exec ($ch);
                        $buffer = ob_get_contents();
                        ob_end_clean();
!                       curl_close ($ch);
!                       $lang_length = strlen($this->language);
!                       $start = strpos ($buffer, 'padding:10px; 
lang=')+20+$lang_length;
                        $buffer = substr($buffer, $start);
!                       $end = strpos ($buffer, '</div>');
                        $buffer = trim(substr($buffer, 0, $end));
                        if(!empty($buffer))
                        {
                                return $buffer;
                        }
--- 117,152 ----
                        curl_setopt ($ch, CURLOPT_HEADER, 0);
                        curl_setopt($ch, CURLOPT_POST, 1);
!                       curl_setopt($ch, CURLOPT_POSTFIELDS, $get_string);
                        ob_start();
                        curl_exec ($ch);
                        $buffer = ob_get_contents();
                        ob_end_clean();
!                       curl_close ($ch);                       
!                       $start = strpos ($buffer, $start_string);
!                       if($start === False)
!                       {
!                               if(!isset($start_string2))
!                               {
!                                       return $msg;                            
!                               }
!                               else
!                               {
!                                       $start_string = $start_string2;
!                                       $start = strpos ($buffer, 
$start_string);
!                                       if($start === False)
!                                       {
!                                               return $msg;                    
        
!                                       }
!                               }
!                       }
! 
!                       $start_length = strlen($start_string);
!                       $start = $start+$start_length;
                        $buffer = substr($buffer, $start);
!                       $end = strpos ($buffer, $end_string);
                        $buffer = trim(substr($buffer, 0, $end));
                        if(!empty($buffer))
                        {
+                               $GLOBALS['phpgw_session']['lang_cache'][$msg] = 
$buffer;
                                return $buffer;
                        }
***************
*** 148,155 ****
                function switchlang()
                {
!                       if(isset($GLOBALS['phpgw_data']['prefs']['api.lang']) 
&& $this->language != $GLOBALS['phpgw_data']['prefs']['api.lang'])
                        {
                                $this->language = 
$GLOBALS['phpgw_data']['prefs']['api.lang'];
                                $this->envset = False;
                        }
                        if(!$this->envset)
--- 195,203 ----
                function switchlang()
                {
!                       if($this->language != 
$GLOBALS['phpgw_data']['prefs']['api.lang'])
                        {
                                $this->language = 
$GLOBALS['phpgw_data']['prefs']['api.lang'];
                                $this->envset = False;
+                               
//unset($GLOBALS['phpgw_session']['lang_cache']);
                        }
                        if(!$this->envset)

Index: class.phpgw.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/class.phpgw.php,v
retrieving revision 1.1.1.1.2.4
retrieving revision 1.1.1.1.2.5
diff -C2 -d -r1.1.1.1.2.4 -r1.1.1.1.2.5
*** class.phpgw.php     24 Oct 2003 23:17:43 -0000      1.1.1.1.2.4
--- class.phpgw.php     25 Oct 2003 18:29:22 -0000      1.1.1.1.2.5
***************
*** 97,101 ****
                        $this->prefs = createobject('api_prefs');
                        $this->prefs->fill_phpgw_data();
! 
                        $GLOBALS['lang']->switchlang();
  
--- 97,101 ----
                        $this->prefs = createobject('api_prefs');
                        $this->prefs->fill_phpgw_data();
! //$GLOBALS['phpgw_data']['prefs']['api.lang'] = 'es';
                        $GLOBALS['lang']->switchlang();
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]