phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc class.translation_sql.inc.php func...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] phpgwapi/inc class.translation_sql.inc.php func...
Date: Wed, 05 Jul 2006 12:40:43 +0000

CVSROOT:        /sources/phpgwapi
Module name:    phpgwapi
Changes by:     Sigurd Nes <sigurdne>   06/07/05 12:40:43

Modified files:
        inc            : class.translation_sql.inc.php functions.inc.php 

Log message:
        Reset language after preferences are set if different from 'en'

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.translation_sql.inc.php?cvsroot=phpgwapi&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/functions.inc.php?cvsroot=phpgwapi&r1=1.191&r2=1.192

Patches:
Index: class.translation_sql.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.translation_sql.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- class.translation_sql.inc.php       4 Jul 2006 13:06:36 -0000       1.21
+++ class.translation_sql.inc.php       5 Jul 2006 12:40:43 -0000       1.22
@@ -7,7 +7,7 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage application
-       * @version $Id: class.translation_sql.inc.php,v 1.21 2006/07/04 
13:06:36 sigurdne Exp $
+       * @version $Id: class.translation_sql.inc.php,v 1.22 2006/07/05 
12:40:43 sigurdne Exp $
        */
 
        /**
@@ -25,31 +25,25 @@
        */
        class translation
        {
-               function translation()  
-               {
+               var $userlang;
 
+               function translation($reset = '')
+               {
                        if(!is_object($GLOBALS['phpgw']->shm))
                        {
                                $GLOBALS['phpgw']->shm = 
CreateObject('phpgwapi.shm');
                        }
                                
-                               if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) &&
-                                       
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
-                       {
-                               $userlang = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
-                       }
-                       else
+                       if(!$userlang = $this->userlang)
                        {
                                $userlang = 'en';
                        }
                        
-                       $this->userlang = $userlang;
-                       
-                       if ( !is_array($GLOBALS['lang']) ) //This should avoid 
problems for php-nuke & postnuke I guess (Caeies)
+                       if ( !is_array($GLOBALS['lang']) || $reset) //This 
should avoid problems for php-nuke & postnuke I guess (Caeies)
                        {
                                if($GLOBALS['lang'] = 
$GLOBALS['phpgw']->shm->get_value('lang_' . $userlang))
                                {
-                                       $this->loade_from_shm = true;
+                                       $this->loaded_from_shm = true;
                                }
                                else
                                {
@@ -89,10 +83,12 @@
                        // as string
                        // this makes many problems
 
-                               $userlang = $this->userlang;
- 
+                       if(!$userlang = $this->userlang)
+                       {
+                               $userlang = 'en';
+                       }
 
-                       
if(!array_key_exists(strtolower(trim(substr($key,0,MAX_MESSAGE_ID_LENGTH))),$GLOBALS['lang'])
 && !$this->loade_from_shm) //Using array_key_exists permits empty string ... 
Ugly but ... (Caeies)
+                       
if(!array_key_exists(strtolower(trim(substr($key,0,MAX_MESSAGE_ID_LENGTH))),$GLOBALS['lang'])
 && !$this->loaded_from_shm) //Using array_key_exists permits empty string ... 
Ugly but ... (Caeies)
                        {
                                $sql = "select message_id,content from 
phpgw_lang where lang = '".$userlang."' ".
                                        "and message_id = 
'".$GLOBALS['phpgw']->db->db_addslashes($key)."' or message_id = 'charset' and 
(app_name = '".$GLOBALS['phpgw_info']['flags']['currentapp']."' or app_name = 
'common' or app_name = 'all')";

Index: functions.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/functions.inc.php,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -b -r1.191 -r1.192
--- functions.inc.php   20 Jun 2006 07:01:18 -0000      1.191
+++ functions.inc.php   5 Jul 2006 12:40:43 -0000       1.192
@@ -7,7 +7,7 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage utilities
-       * @version $Id: functions.inc.php,v 1.191 2006/06/20 07:01:18 sigurdne 
Exp $
+       * @version $Id: functions.inc.php,v 1.192 2006/07/05 12:40:43 sigurdne 
Exp $
        */
        
        
@@ -332,8 +332,13 @@
                        $GLOBALS['phpgw']->redirect_link('/login.php','cd=10');
                }
 
-               $redirect = 
unserialize(stripslashes(get_var('redirect',array('GET','COOKIE'))));
+               
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] !='en')
+               {
+                       $GLOBALS['phpgw']->translation->userlang = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+                       $GLOBALS['phpgw']->translation->translation($reset = 
True);
+               }
 
+               $redirect = 
unserialize(stripslashes(get_var('redirect',array('GET','COOKIE'))));
                if($redirect)
                {
                        while(list($key,$value) = each($redirect))




reply via email to

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