phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpgwapi/inc class.setup_detection.inc.php,1.6,1


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.setup_detection.inc.php,1.6,1.7 class.setup_translation.inc.php,1.3,1.4 class.translation_sql.inc.php,1.15,1.16
Date: Wed, 02 Apr 2003 12:46:09 -0500

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

Modified Files:
        class.setup_detection.inc.php class.setup_translation.inc.php 
        class.translation_sql.inc.php 
Log Message:
limited the length of the message_id to 230 and defined a constant for it


Index: class.setup_detection.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.setup_detection.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.setup_detection.inc.php       22 Mar 2003 01:31:38 -0000      1.6
--- class.setup_detection.inc.php       2 Apr 2003 17:46:07 -0000       1.7
***************
*** 162,167 ****
                                                                
$setup_info['depends'][$depkey]['status'] = True;
                                                        }
!                                                       else
                                                        {
                                                        }
                                                }
--- 162,174 ----
                                                                
$setup_info['depends'][$depkey]['status'] = True;
                                                        }
!                                                       else    // check if 
majors are equal and minors greater or equal
                                                        {
+                                                               
$major_depsvalue = $GLOBALS['phpgw_setup']->get_major($depsvalue);
+                                                               
list(,,,$minor_depsvalue) = explode('.',$depsvalue);
+                                                               list(,,,$minor) 
= explode('.',$setup_info[$value['depends'][$depkey]['appname']]['currentver']);
+                                                               if ($major == 
$major_depsvalue && $minor <= $minor_depsvalue)
+                                                               {
+                                                                       
$setup_info['depends'][$depkey]['status'] = True;
+                                                               }
                                                        }
                                                }
***************
*** 331,346 ****
                                $GLOBALS['setup_info'] = 
$GLOBALS['phpgw_setup']->detection->get_db_versions($GLOBALS['setup_info']);
                        }
!                       
if($GLOBALS['phpgw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'],
 '0.9.15.002'))
                        {
                                $langtbl  = 'lang';
!                               $langstbl = 'languages';
                        }
                        else
                        {
                                $langtbl  = 'phpgw_lang';
!                               $langstbl = 'phpgw_languages';
                        }
! 
!                       $GLOBALS['phpgw_setup']->db->query("SELECT DISTINCT 
lang FROM $langtbl",__LINE__,__FILE__);
                        if($GLOBALS['phpgw_setup']->db->num_rows() == 0)
                        {
--- 338,353 ----
                                $GLOBALS['setup_info'] = 
$GLOBALS['phpgw_setup']->detection->get_db_versions($GLOBALS['setup_info']);
                        }
!                       
if($GLOBALS['phpgw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'],
 '0.9.14.501') ||
!                          
ereg('0\.9\.15\.00[01]{1,1}',$GLOBALS['setup_info']['phpgwapi']['currentver']))
                        {
                                $langtbl  = 'lang';
!                               $languagestbl = 'languages';
                        }
                        else
                        {
                                $langtbl  = 'phpgw_lang';
!                               $languagestbl = 'phpgw_languages';
                        }
!                       $GLOBALS['phpgw_setup']->db->query($q = "SELECT 
DISTINCT lang FROM $langtbl",__LINE__,__FILE__);
                        if($GLOBALS['phpgw_setup']->db->num_rows() == 0)
                        {
***************
*** 357,361 ****
                                while(list($key, $value) = 
each($GLOBALS['phpgw_info']['setup']['installed_langs']))
                                {
!                                       $sql = "SELECT lang_name FROM $langstbl 
WHERE lang_id = '".$value."'";
                                        
$GLOBALS['phpgw_setup']->db->query($sql);
                                        
$GLOBALS['phpgw_setup']->db->next_record();
--- 364,368 ----
                                while(list($key, $value) = 
each($GLOBALS['phpgw_info']['setup']['installed_langs']))
                                {
!                                       $sql = "SELECT lang_name FROM 
$languagestbl WHERE lang_id = '".$value."'";
                                        
$GLOBALS['phpgw_setup']->db->query($sql);
                                        
$GLOBALS['phpgw_setup']->db->next_record();

Index: class.setup_translation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.setup_translation.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.setup_translation.inc.php     30 Apr 2002 03:35:52 -0000      1.3
--- class.setup_translation.inc.php     2 Apr 2003 17:46:07 -0000       1.4
***************
*** 24,31 ****
    /* $Id$ */
  
        class setup_translation
        {
                var $langarray;
-               var $langtbl = 'phpgw_lang';
  
                /*!
--- 24,35 ----
    /* $Id$ */
  
+       if (!defined('MAX_MESSAGE_ID_LENGTH'))
+       {
+               define('MAX_MESSAGE_ID_LENGTH',230);
+       }
+ 
        class setup_translation
        {
                var $langarray;
  
                /*!
***************
*** 38,49 ****
                        $ConfigLang = 
get_var('ConfigLang',Array('POST','COOKIE'));
  
-                       /* TODO */
-                       /*
-                       
if(@$GLOBALS['phpgw_setup']->alessthanb(@$GLOBALS['setup_info']['phpgwapi']['currentver'],
 '0.9.15.002'))
-                       {
-                               $this->langtbl = 'lang';
-                       }
-                       */
- 
                        if(!$ConfigLang)
                        {
--- 42,45 ----
***************
*** 78,82 ****
                        }
                }
! 
                /*!
                @function translate
--- 74,78 ----
                        }
                }
!               
                /*!
                @function translate
***************
*** 129,133 ****
                                echo '<br>get_langs(): checking db...' . "\n";
                        }
!                       $GLOBALS['phpgw_setup']->db->query("SELECT 
DISTINCT(lang) FROM $this->langtbl",__LINE__,__FILE__);
                        $langs = array();
  
--- 125,129 ----
                                echo '<br>get_langs(): checking db...' . "\n";
                        }
!                       $GLOBALS['phpgw_setup']->db->query("SELECT 
DISTINCT(lang) FROM phpgw_lang",__LINE__,__FILE__);
                        $langs = array();
  
***************
*** 154,162 ****
                                echo '<br>drop_langs(): Working on: ' . 
$appname;
                        }
!                       $GLOBALS['phpgw_setup']->db->query("SELECT 
COUNT(message_id) FROM $this->langtbl WHERE 
app_name='$appname'",__LINE__,__FILE__);
                        $GLOBALS['phpgw_setup']->db->next_record();
                        if($GLOBALS['phpgw_setup']->db->f(0))
                        {
!                               $GLOBALS['phpgw_setup']->db->query("DELETE FROM 
$this->langtbl WHERE app_name='$appname'",__LINE__,__FILE__);
                                return True;
                        }
--- 150,158 ----
                                echo '<br>drop_langs(): Working on: ' . 
$appname;
                        }
!                       $GLOBALS['phpgw_setup']->db->query("SELECT 
COUNT(message_id) FROM phpgw_lang WHERE app_name='$appname'",__LINE__,__FILE__);
                        $GLOBALS['phpgw_setup']->db->next_record();
                        if($GLOBALS['phpgw_setup']->db->f(0))
                        {
!                               $GLOBALS['phpgw_setup']->db->query("DELETE FROM 
phpgw_lang WHERE app_name='$appname'",__LINE__,__FILE__);
                                return True;
                        }
***************
*** 203,207 ****
                                        {
                                                
list($message_id,$app_name,$GLOBALS['phpgw_setup']->db_lang,$content) = 
explode("\t",$line);
!                                               $message_id = 
$GLOBALS['phpgw_setup']->db->db_addslashes(chop($message_id));
                                                /* echo '<br>APPNAME:' . 
$app_name . ' PHRASE:' . $message_id; */
                                                $app_name   = 
$GLOBALS['phpgw_setup']->db->db_addslashes(chop($app_name));
--- 199,203 ----
                                        {
                                                
list($message_id,$app_name,$GLOBALS['phpgw_setup']->db_lang,$content) = 
explode("\t",$line);
!                                               $message_id = 
$GLOBALS['phpgw_setup']->db->db_addslashes(chop(substr($message_id,0,MAX_MESSAGE_ID_LENGTH)));
                                                /* echo '<br>APPNAME:' . 
$app_name . ' PHRASE:' . $message_id; */
                                                $app_name   = 
$GLOBALS['phpgw_setup']->db->db_addslashes(chop($app_name));
***************
*** 209,213 ****
                                                $content    = 
$GLOBALS['phpgw_setup']->db->db_addslashes(chop($content));
  
!                                               
$GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) FROM $this->langtbl WHERE 
message_id='$message_id' and lang='"
                                                        . 
$GLOBALS['phpgw_setup']->db_lang . "'",__LINE__,__FILE__);
                                                
$GLOBALS['phpgw_setup']->db->next_record();
--- 205,209 ----
                                                $content    = 
$GLOBALS['phpgw_setup']->db->db_addslashes(chop($content));
  
!                                               
$GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) FROM phpgw_lang WHERE 
message_id='$message_id' and lang='"
                                                        . 
$GLOBALS['phpgw_setup']->db_lang . "'",__LINE__,__FILE__);
                                                
$GLOBALS['phpgw_setup']->db->next_record();
***************
*** 219,226 ****
                                                                if($DEBUG)
                                                                {
!                                                                       echo 
"<br>add_langs(): adding - INSERT INTO $this->langtbl VALUES 
('$message_id','$app_name','"
                                                                                
. $GLOBALS['phpgw_setup']->db_lang . "','$content')";
                                                                }
!                                                               
$GLOBALS['phpgw_setup']->db->query("INSERT INTO $this->langtbl VALUES 
('$message_id','$app_name','"
                                                                        . 
$GLOBALS['phpgw_setup']->db_lang . "','$content')",__LINE__,__FILE__);
                                                        }
--- 215,222 ----
                                                                if($DEBUG)
                                                                {
!                                                                       echo 
"<br>add_langs(): adding - INSERT INTO phpgw_lang VALUES 
('$message_id','$app_name','"
                                                                                
. $GLOBALS['phpgw_setup']->db_lang . "','$content')";
                                                                }
!                                                               
$GLOBALS['phpgw_setup']->db->query("INSERT INTO phpgw_lang VALUES 
('$message_id','$app_name','"
                                                                        . 
$GLOBALS['phpgw_setup']->db_lang . "','$content')",__LINE__,__FILE__);
                                                        }

Index: class.translation_sql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.translation_sql.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** class.translation_sql.inc.php       18 Oct 2002 22:53:12 -0000      1.15
--- class.translation_sql.inc.php       2 Apr 2003 17:46:07 -0000       1.16
***************
*** 26,29 ****
--- 26,36 ----
    /* $Id$ */
  
+       // define the maximal length of a message_id, all message_ids have to 
be unique 
+       // in this length, our column is varchar 255, but addslashes might add 
some length
+       if (!defined('MAX_MESSAGE_ID_LENGTH'))
+       {
+               define('MAX_MESSAGE_ID_LENGTH',230);    
+       }
+ 
        class translation
        {
***************
*** 104,108 ****
                        }
                        $ret  = $key;
!                       $_key = strtolower($key);
  
                        if(address@hidden($this->lang[$_key]) && !$this->loaded)
--- 111,115 ----
                        }
                        $ret  = $key;
!                       $_key = 
substr(strtolower($key),0,MAX_MESSAGE_ID_LENGTH);
  
                        if(address@hidden($this->lang[$_key]) && !$this->loaded)
***************
*** 140,143 ****
--- 147,168 ----
                                $GLOBALS['phpgw']->db->next_record();
                        }
+               }
+               
+               /*!
+                @function get_installed_langs
+                @returns array of installed langs, in the form eg. 'de' => 
'German'
+               */
+               function get_installed_langs()
+               {
+                       $GLOBALS['phpgw']->db->query("SELECT DISTINCT 
l.lang,ln.lang_name FROM phpgw_lang l,phpgw_languages ln WHERE l.lang = 
ln.lang_id",__LINE__,__FILE__);
+                       if (!$GLOBALS['phpgw']->db->num_rows())
+                       {
+                               return False;
+                       }
+                       while ($GLOBALS['phpgw']->db->next_record())
+                       {
+                               $langs[$GLOBALS['phpgw']->db->f('lang')] = 
$GLOBALS['phpgw']->db->f('lang_name');
+                       }
+                       return $langs;
                }
        }





reply via email to

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