phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpgwapi/inc class.translation_sql.inc.php,1.8,1


From: Miles Lott <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.translation_sql.inc.php,1.8,1.9
Date: Sun, 17 Feb 2002 13:43:33 -0500

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv12515

Modified Files:
        class.translation_sql.inc.php 
Log Message:
Formatting



Index: class.translation_sql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.translation_sql.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.translation_sql.inc.php       23 Nov 2001 19:35:45 -0000      1.8
--- class.translation_sql.inc.php       17 Feb 2002 18:43:31 -0000      1.9
***************
*** 27,45 ****
        class translation
        {
!               function translate($key, $vars=false ) 
                {
!                       if (!$vars)
                        {
                                $vars = array();
                        }
                        $ret = $key;
!                       // check also if $GLOBALS['lang'] is a array
!                       // php-nuke and postnuke are using $GLOBALS['lang'] too
!                       // as string
!                       // this makes many problems
!                       if (!isset($GLOBALS['lang']) || !$GLOBALS['lang'] || 
!is_array($GLOBALS['lang']))
                        {
                                $GLOBALS['lang'] = array();
!                               if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) &&
                                        
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
                                {
--- 27,52 ----
        class translation
        {
!               function translate($key, $vars=False) 
                {
!                       if(!$vars)
                        {
                                $vars = array();
                        }
                        $ret = $key;
!                       /*
!                        Check also if $GLOBALS['lang'] is a array.
!                        php-nuke and postnuke are using $GLOBALS['lang'], too,
!                        as string.
!                        This makes many problems.
!                       */
! 
!                       if(isset($GLOBALS['lang'][strtolower($key)]) && 
$GLOBALS['lang'][strtolower($key)])
!                       {
!                               $ret = $GLOBALS['lang'][strtolower($key)];
!                       }
!                       elseif(!isset($GLOBALS['lang']) || !$GLOBALS['lang'] || 
!is_array($GLOBALS['lang']))
                        {
                                $GLOBALS['lang'] = array();
!                               
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) &&
                                        
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
                                {
***************
*** 50,63 ****
                                        $userlang = 'en';
                                }
!                               $sql = "select message_id,content from lang 
where lang like '".$userlang."' ".
!                                       "and (app_name like 
'".$GLOBALS['phpgw_info']['flags']['currentapp']."' or app_name like 'common' 
or app_name like 'all')";
  
                                if (strcasecmp 
($GLOBALS['phpgw_info']['flags']['currentapp'], 'common')>0)
                                {
!                                       $sql .= ' order by app_name asc';
                                }
                                else
                                {
!                                       $sql .= ' order by app_name desc';
                                }
  
--- 57,71 ----
                                        $userlang = 'en';
                                }
!                               $sql = "SELECT message_id,content FROM lang 
WHERE lang LIKE '" . $userlang
!                                       . "' AND (app_name LIKE '" . 
$GLOBALS['phpgw_info']['flags']['currentapp']
!                                       . "' OR app_name LIKE 'common' OR 
app_name LIKE 'all')";
  
                                if (strcasecmp 
($GLOBALS['phpgw_info']['flags']['currentapp'], 'common')>0)
                                {
!                                       $sql .= ' ORDER BY app_name ASC';
                                }
                                else
                                {
!                                       $sql .= ' ORDER BY app_name DESC';
                                }
  
***************
*** 65,84 ****
                                $GLOBALS['phpgw']->db->next_record();
                                $count = $GLOBALS['phpgw']->db->num_rows();
!                               for ($idx = 0; $idx < $count; ++$idx)
                                {
!                                       $GLOBALS['lang'][strtolower 
($GLOBALS['phpgw']->db->f('message_id'))] = $GLOBALS['phpgw']->db->f('content');
                                        $GLOBALS['phpgw']->db->next_record();
                                }
                        }
!                       if (isset($GLOBALS['lang'][strtolower ($key)]) && 
$GLOBALS['lang'][strtolower ($key)])
!                       {
!                               $ret = $GLOBALS['lang'][strtolower ($key)];
!                       }
!                       else
!                       {
!                               $ret = $key . '*';
!                       }
                        $ndx = 1;
!                       while( list($key,$val) = each( $vars ) )
                        {
                                $ret = preg_replace( "/%$ndx/", $val, $ret );
--- 73,86 ----
                                $GLOBALS['phpgw']->db->next_record();
                                $count = $GLOBALS['phpgw']->db->num_rows();
!                               for($idx = 0; $idx < $count; ++$idx)
                                {
!                                       
$GLOBALS['lang'][strtolower($GLOBALS['phpgw']->db->f('message_id'))] = 
$GLOBALS['phpgw']->db->f('content');
                                        $GLOBALS['phpgw']->db->next_record();
                                }
+                               $ret = $GLOBALS['lang'][strtolower($key)] ? 
$GLOBALS['lang'][strtolower($key)] : $key . '*';
                        }
! 
                        $ndx = 1;
!                       while(list($key,$val) = each($vars))
                        {
                                $ret = preg_replace( "/%$ndx/", $val, $ret );
***************
*** 90,102 ****
                function add_app($app) 
                {
!                       // post-nuke and php-nuke are using $GLOBALS['lang'] too
!                       // but not as array!
!                       // this produces very strange results
!                       if (!is_array($GLOBALS['lang']))
                        {
                                $GLOBALS['lang'] = array();
                        }
                        
!                       if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
                        {
                                $userlang = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
--- 92,106 ----
                function add_app($app) 
                {
!                       /*
!                        post-nuke and php-nuke are using $GLOBALS['lang'], too.
!                        But not as array!
!                        This produces very strange results.
!                       */
!                       if(!is_array($GLOBALS['lang']))
                        {
                                $GLOBALS['lang'] = array();
                        }
                        
!                       
if($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
                        {
                                $userlang = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
***************
*** 106,114 ****
                                $userlang = 'en';
                        }
!                       $sql = "select message_id,content from lang where lang 
like '".$userlang."' and app_name like '".$app."'";
                        $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
                        $GLOBALS['phpgw']->db->next_record();
                        $count = $GLOBALS['phpgw']->db->num_rows();
!                       for ($idx = 0; $idx < $count; ++$idx)
                        {
                                $GLOBALS['lang'][strtolower 
($GLOBALS['phpgw']->db->f('message_id'))] = $GLOBALS['phpgw']->db->f('content');
--- 110,118 ----
                                $userlang = 'en';
                        }
!                       $sql = "SELECT message_id,content FROM lang WHERE lang 
LIKE '".$userlang."' AND app_name LIKE '".$app."'";
                        $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
                        $GLOBALS['phpgw']->db->next_record();
                        $count = $GLOBALS['phpgw']->db->num_rows();
!                       for($idx = 0; $idx < $count; ++$idx)
                        {
                                $GLOBALS['lang'][strtolower 
($GLOBALS['phpgw']->db->f('message_id'))] = $GLOBALS['phpgw']->db->f('content');




reply via email to

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