source: trunk/phpgwapi/inc/class.translation_sql.inc.php @ 2

Revision 2, 20.2 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2  /**************************************************************************\
3  * eGroupWare API - Translation class for SQL                               *
4  * This file written by Joseph Engo <jengo@phpgroupware.org>                *
5  * and Dan Kuykendall <seek3r@phpgroupware.org>                             *
6  * Handles multi-language support use SQL tables                            *
7  * Copyright (C) 2000, 2001 Joseph Engo                                     *
8  * ------------------------------------------------------------------------ *
9  * This library is part of the eGroupWare API                               *
10  * http://www.egroupware.org/api                                            *
11  * ------------------------------------------------------------------------ *
12  * This library is free software; you can redistribute it and/or modify it  *
13  * under the terms of the GNU Lesser General Public License as published by *
14  * the Free Software Foundation; either version 2.1 of the License,         *
15  * or any later version.                                                    *
16  * This library is distributed in the hope that it will be useful, but      *
17  * WITHOUT ANY WARRANTY; without even the implied warranty of               *
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
19  * See the GNU Lesser General Public License for more details.              *
20  * You should have received a copy of the GNU Lesser General Public License *
21  * along with this library; if not, write to the Free Software Foundation,  *
22  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
23  \**************************************************************************/
24
25
26        // define the maximal length of a message_id, all message_ids have to be unique
27        // in this length, our column is varchar 255, but addslashes might add some length
28        if (!defined('MAX_MESSAGE_ID_LENGTH'))
29        {
30                define('MAX_MESSAGE_ID_LENGTH',230);
31        }
32        // some constanst for pre php4.3
33        if (!defined('PHP_SHLIB_SUFFIX'))
34        {
35                define('PHP_SHLIB_SUFFIX',strtoupper(substr(PHP_OS, 0,3)) == 'WIN' ? 'dll' : 'so');
36        }
37        if (!defined('PHP_SHLIB_PREFIX'))
38        {
39                define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '');
40        }
41
42        class translation
43        {
44                var $userlang = 'en';
45                var $loaded_apps = array();
46                var $line_rejected = array();
47
48                function translation($warnings = False)
49                {
50                        for ($i = 1; $i <= 9; $i++)
51                        {
52                                $this->placeholders[] = '%'.$i;
53                        }
54                        $this->db = is_object($GLOBALS['phpgw']->db) ? $GLOBALS['phpgw']->db : $GLOBALS['phpgw_setup']->db;
55                        if (!isset($GLOBALS['phpgw_setup']))
56                        {
57                                $this->system_charset = @$GLOBALS['phpgw_info']['server']['system_charset'];
58                        }
59                        else
60                        {
61                                $this->db->query("SELECT config_value FROM phpgw_config WHERE config_app='phpgwapi' AND config_name='system_charset'",__LINE__,__FILE__);
62                                if ($this->db->next_record())
63                                {
64                                        $this->system_charset = $this->db->f(0);
65                                }
66                        }
67                        // load multi-byte-string-extension if needed, and set its internal encodeing to your system_charset
68                        if ($this->system_charset && substr($this->system_charset,0,9) != 'iso-8859-1')
69                        {
70                                if ($this->mbstring = extension_loaded('mbstring') || @dl(PHP_SHLIB_PREFIX.'mbstring.'.PHP_SHLIB_SUFFIX))
71                                {
72                                        ini_set('mbstring.internal_encoding',$this->system_charset);
73                                        if (ini_get('mbstring.func_overload') < 7)
74                                        {
75                                                if ($warnings)
76                                                {
77                                                        echo "<p>Warning: Please set <b>mbstring.func_overload = 7</b> in your php.ini for useing <b>$this->system_charset</b> as your charset !!!</p>\n";
78                                                }
79                                        }
80                                }
81                                else
82                                {
83                                        if ($warnings)
84                                        {
85                                                echo "<p>Warning: Please get and/or enable the <b>mbstring extension</b> in your php.ini for useing <b>$this->system_charset</b> as your charset, we are defaulting to <b>iconv</b> for now !!!</p>\n";
86                                        }
87                                }
88                        }
89                }
90
91                /*
92                @function charset
93                @abstract returns the charset to use (!$lang) or the charset of the lang-files or $lang
94                */
95                function charset($lang=False)
96                {
97                        if ($lang)
98                        {
99                                if (!isset($this->charsets[$lang]))
100                                {
101                                        $this->db->query("SELECT content FROM phpgw_lang WHERE lang='$lang' AND message_id='charset' AND app_name='common'",__LINE__,__FILE__);
102                                        $this->charsets[$lang] = $this->db->next_record() ? strtolower($this->db->f(0)) : 'iso-8859-1';
103                                }
104                                return $this->charsets[$lang];
105                        }
106                        if ($this->system_charset)      // do we have a system-charset ==> return it
107                        {
108                                return $this->system_charset;
109                        }
110                        // if no translations are loaded (system-startup) use a default, else lang('charset')
111                        return !is_array(@$GLOBALS['lang']) ? 'iso-8859-1' : strtolower($this->translate('charset'));
112                }
113
114                function init()
115                {
116                        // post-nuke and php-nuke are using $GLOBALS['lang'] too
117                        // but not as array!
118                        // this produces very strange results
119                        if (!is_array(@$GLOBALS['lang']))
120                        {
121                                $GLOBALS['lang'] = array();
122                        }
123
124                        if ($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
125                        {
126                                $this->userlang = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
127                        }
128                        $this->add_app('common');
129                        if (!count($GLOBALS['lang']))
130                        {
131                                $this->userlang = 'en';
132                                $this->add_app('common');
133                        }
134                        $this->add_app($GLOBALS['phpgw_info']['flags']['currentapp']);
135                }
136
137                /*!
138                @function translate
139                @abstract translates a phrase and evtl. substitute some variables
140                @returns the translation
141                */
142                function translate($key, $vars=false, $not_found='*' )
143                {
144                        if (!is_array(@$GLOBALS['lang']) || !count($GLOBALS['lang']))
145                        {
146                                $this->init();
147                        }
148                        $ret = $key.$not_found; // save key if we dont find a translation
149
150                        if (isset($GLOBALS['lang'][$key]))
151                        {
152                                $ret = $GLOBALS['lang'][$key];
153                        }
154                        else
155                        {
156                                $new_key = strtolower(trim(substr($key,0,MAX_MESSAGE_ID_LENGTH)));
157
158                                if (isset($GLOBALS['lang'][$new_key]))
159                                {
160                                        // we save the original key for performance
161                                        $ret = $GLOBALS['lang'][$key] = $GLOBALS['lang'][$new_key];
162                                }
163                        }
164                        if (is_array($vars) && count($vars))
165                        {
166                                if (count($vars) > 1)
167                                {
168                                        $ret = str_replace($this->placeholders,$vars,$ret);
169                                }
170                                else
171                                {
172                                        $ret = str_replace('%1',$vars[0],$ret);
173                                }
174                        }
175                        return $ret;
176                }
177
178                /*!
179                @function add_app
180                @abstract adds translations for an application from the database to the lang-array
181                @syntax add_app($app,$lang=False)
182                @param $app name of the application to add (or 'common' for the general translations)
183                @param $lang 2-char code of the language to use or False if the users language should be used
184                */
185                function add_app($app,$lang=False)
186                {
187                        $lang = $lang ? $lang : $this->userlang;
188
189                        if (!isset($this->loaded_apps[$app]) || $this->loaded_apps[$app] != $lang)
190                        {
191                                $sql = "select message_id,content from phpgw_lang where lang='".$lang."' and app_name='".$app."'";
192                                $this->db->query($sql,__LINE__,__FILE__);
193                                while ($this->db->next_record())
194                                {
195                                        $GLOBALS['lang'][strtolower ($this->db->f('message_id'))] = $this->db->f('content');
196                                }
197                                $this->loaded_apps[$app] = $lang;
198                        }
199                }
200
201                /*!
202                @function get_installed_langs
203                @abstract returns a list of installed langs
204                @returns array with 2-character lang-code as key and descriptiv lang-name as data
205                */
206                function get_installed_langs()
207                {
208                        if (!is_array($this->langs))
209                        {
210                                $this->db->query("SELECT DISTINCT l.lang,ln.lang_name FROM phpgw_lang l,phpgw_languages ln WHERE l.lang = ln.lang_id",__LINE__,__FILE__);
211                                if (!$this->db->num_rows())
212                                {
213                                        return False;
214                                }
215                                while ($this->db->next_record())
216                                {
217                                        $this->langs[$this->db->f('lang')] = $this->db->f('lang_name');
218                                }
219                                foreach($this->langs as $lang => $name)
220                                {
221                                        $this->langs[$lang] = $this->translate($name,False,'');
222                                }
223                        }
224                        return $this->langs;
225                }
226
227                /*!
228                @function get_installed_charsets
229                @abstract returns a list of installed charsets
230                @returns array with charset as key and comma-separated list of langs useing the charset as data
231                */
232                function get_installed_charsets()
233                {
234                        if (!is_array($this->charsets))
235                        {
236                                $distinct = 'DISTINCT';
237                                switch($this->db->Type)
238                                {
239                                        case 'mssql':
240                                                $distinct = ''; // cant use distinct on text columns (l.content is text)
241                                }
242                                $this->db->query("SELECT $distinct l.lang,lx.lang_name,l.content AS charset FROM phpgw_lang l,phpgw_languages lx WHERE l.lang = lx.lang_id AND l.message_id='charset'",__LINE__,__FILE__);
243                                if (!$this->db->num_rows())
244                                {
245                                        return False;
246                                }
247                                while ($this->db->next_record())
248                                {
249                                        $data = &$this->charsets[$charset = strtolower($this->db->f('charset'))];
250                                        $lang = $this->db->f('lang_name').' ('.$this->db->f('lang').')';
251                                        if ($distinct || strstr($data,$lang) === false)
252                                        {
253                                                $data .= ($data ? ', ' : $charset.': ').$lang;
254                                        }                                               
255                                }
256                        }
257                        return $this->charsets;
258                }
259
260                /*!
261                @function convert
262                @abstract converts a string $data from charset $from to charset $to
263                @syntax convert($data,$from=False,$to=False)
264                @param $data string or array of strings to convert
265                @param $from charset $data is in or False if it should be detected
266                @param $to charset to convert to or False for the system-charset
267                @returns the converted string
268                */
269                function convert($data,$from=False,$to=False)
270                {
271                        if (is_array($data))
272                        {
273                                foreach($data as $key => $str)
274                                {
275                                        $ret[$key] = $this->convert($str,$from,$to);
276                                }
277                                return $ret;
278                        }
279
280                        if ($from)
281                        {
282                                $from = strtolower($from);
283                        }
284                        if ($to)
285                        {
286                                $to = strtolower($to);
287                        }
288
289                        if (!$from)
290                        {
291                                $from = $this->mbstring ? strtolower(mb_detect_encoding($data)) : 'iso-8859-1';
292                                if($from == 'ascii')
293                                {
294                                        $from = 'iso-8859-1';
295                                }
296                                //echo "<p>autodetected charset of '$data' = '$from'</p>\n";
297                        }
298                        /*
299                           php does not seem to support gb2312
300                           but seems to be able to decode it as EUC-CN
301                        */
302                        switch($from)
303                        {
304                                case 'gb2312':
305                                case 'gb18030':
306                                        $from = 'EUC-CN';
307                                        break;
308                                case 'us-ascii':
309                                case 'macroman':
310                                        $from = 'iso-8859-1';
311                                        break;
312                        }
313                        if (!$to)
314                        {
315                                $to = $this->charset();
316                        }
317                        if ($from == $to || !$from || !$to || !$data)
318                        {
319                                return $data;
320                        }
321                        if ($from == 'iso-8859-1' && $to == 'utf-8')
322                        {
323                                return utf8_encode($data);
324                        }
325                        if ($to == 'iso-8859-1' && $from == 'utf-8')
326                        {
327                                return utf8_decode($data);
328                        }
329                        if ($this->mbstring)
330                        {
331                                return @mb_convert_encoding($data,$to,$from);
332                        }
333                        if(function_exists('iconv'))
334                        {
335                        if($from=='EUC-CN') $from='gb18030';
336                        // the above is to workaround patch #962307
337                        // if using EUC-CN, for iconv it strickly follow GB2312 and fail
338                        // in an email on the first Traditional/Japanese/Korean character,
339                        // but in reality when people send mails in GB2312, UMA mostly use
340                        // extended GB13000/GB18030 which allow T/Jap/Korean characters.
341                                if (($data = iconv($from,$to,$data)))
342                                {
343                                        return $data;
344                                }
345                        }
346                        #die("<p>Can't convert from charset '$from' to '$to' without the <b>mbstring extension</b> !!!</p>");
347
348                        // this is not good, not convert did succed
349                        return $data;
350                }
351
352                /*!
353                @function install_langs
354                @abstract installs translations for the selected langs into the database
355                @syntax install_langs($langs,$upgrademethod='dumpold')
356                @param $langs array of langs to install (as data NOT keys (!))
357                @param $upgrademethod 'dumpold' (recommended & fastest), 'addonlynew' languages, 'addmissing' phrases
358                */
359                function install_langs($langs,$upgrademethod='dumpold',$only_app=False)
360                {
361                        @set_time_limit(0);     // we might need some time
362
363                        if (!isset($GLOBALS['phpgw_info']['server']) && $upgrademethod != 'dumpold')
364                        {
365                                $this->db->query("SELECT * FROM phpgw_config WHERE config_app='phpgwapi' AND config_name='lang_ctimes'",__LINE__,__FILE__);
366                                if ($this->db->next_record())
367                                {
368                                        $GLOBALS['phpgw_info']['server']['lang_ctimes'] = unserialize(stripslashes($this->db->f('config_value')));
369                                }
370                        }
371
372                        if (!is_array($langs) || !count($langs))
373                        {
374                                return;
375                        }
376                        $this->db->transaction_begin();
377
378                        if ($upgrademethod == 'dumpold')
379                        {
380                                // dont delete the custom main- & loginscreen messages every time
381                                $this->db->query("DELETE FROM phpgw_lang WHERE app_name != 'mainscreen' AND app_name != 'loginscreen'",__LINE__,__FILE__);
382                                //echo '<br>Test: dumpold';
383                                $GLOBALS['phpgw_info']['server']['lang_ctimes'] = array();
384                        }
385                        foreach($langs as $lang)
386                        {
387                                //echo '<br>Working on: ' . $lang;
388                                $addlang = False;
389                                if ($upgrademethod == 'addonlynew')
390                                {
391                                        //echo "<br>Test: addonlynew - select count(*) from phpgw_lang where lang='".$lang."'";
392                                        $this->db->query("SELECT COUNT(*) FROM phpgw_lang WHERE lang='".$lang."'",__LINE__,__FILE__);
393                                        $this->db->next_record();
394
395                                        if ($this->db->f(0) == 0)
396                                        {
397                                                //echo '<br>Test: addonlynew - True';
398                                                $addlang = True;
399                                        }
400                                }
401                                if ($addlang && $upgrademethod == 'addonlynew' || $upgrademethod != 'addonlynew')
402                                {
403                                        //echo '<br>Test: loop above file()';
404                                        if (!is_object($GLOBALS['phpgw_setup']))
405                                        {
406                                                $GLOBALS['phpgw_setup'] = CreateObject('phpgwapi.setup');
407                                                $GLOBALS['phpgw_setup']->db = $this->db;
408                                        }
409                                        $setup_info = $GLOBALS['phpgw_setup']->detection->get_versions();
410                                        $setup_info = $GLOBALS['phpgw_setup']->detection->get_db_versions($setup_info);
411                                        $raw = array();
412                                        $apps = $only_app ? array($only_app) : array_keys($setup_info);
413                                        // Visit each app/setup dir, look for a phpgw_lang file
414                                        foreach($apps as $app)
415                                        {
416                                                $appfile = PHPGW_SERVER_ROOT . SEP . $app . SEP . 'setup' . SEP . 'phpgw_' . strtolower($lang) . '.lang';
417                                                //echo '<br>Checking in: ' . $app['name'];
418                                                if($GLOBALS['phpgw_setup']->app_registered($app) && file_exists($appfile))
419                                                {
420                                                        //echo '<br>Including: ' . $appfile;
421                                                        $lines = file($appfile);
422                                                        foreach($lines as $line)
423                                                        {
424                                                                // explode with "\t" and removing "\n" with str_replace, needed to work with mbstring.overload=7
425                                                                list($message_id,$app_name,,$content) = $_f_buffer = explode("\t",$line);
426                                                                $content=str_replace(array("\n","\r"),'',$content);
427
428                                                                if( count($_f_buffer) != 4 )
429                                                                {
430                                                                        $line_display = str_replace(array("\t","\n"),
431                                                                                array("<font color='red'><b>\\t</b></font>","<font color='red'><b>\\n</b></font>"), $line);
432                                                                        $this->line_rejected[] = array(
433                                                                                'appfile' => $appfile,
434                                                                                'line'    => $line_display,
435                                                                        );
436                                                                }
437                                                                $message_id = substr(strtolower(chop($message_id)),0,MAX_MESSAGE_ID_LENGTH);
438                                                                $app_name = chop($app_name);
439                                                                $raw[$app_name][$message_id] = $content;
440                                                        }
441                                                        $GLOBALS['phpgw_info']['server']['lang_ctimes'][$lang][$app] = filectime($appfile);
442                                                }
443                                        }
444                                        $charset = strtolower(@$raw['common']['charset'] ? $raw['common']['charset'] : $this->charset($lang));
445                                        //echo "<p>lang='$lang', charset='$charset', system_charset='$this->system_charset')</p>\n";
446                                        //echo "<p>raw($lang)=<pre>".print_r($raw,True)."</pre>\n";
447                                        foreach($raw as $app_name => $ids)
448                                        {
449                                                $app_name = $this->db->db_addslashes($app_name);
450
451                                                foreach($ids as $message_id => $content)
452                                                {
453                                                        if ($this->system_charset)
454                                                        {
455                                                                $content = $this->convert($content,$charset,$this->system_charset);
456                                                        }
457                                                        $message_id = $this->db->db_addslashes($message_id);
458                                                        $content = $this->db->db_addslashes($content);
459
460                                                        $addit = False;
461                                                        //echo '<br>APPNAME:' . $app_name . ' PHRASE:' . $message_id;
462                                                        if ($upgrademethod == 'addmissing')
463                                                        {
464                                                                //echo '<br>Test: addmissing';
465                                                                $this->db->query("SELECT content,CASE WHEN app_name IN ('common') then 1 else 0 END AS in_api FROM phpgw_lang WHERE message_id='$message_id' AND lang='$lang' AND (app_name='$app_name' OR app_name='common') ORDER BY in_api DESC",__LINE__,__FILE__);
466
467                                                                if (!($row = $this->db->row(True)))
468                                                                {
469                                                                        $addit = True;
470                                                                }
471                                                                else
472                                                                {
473                                                                        if ($row['in_api'])             // same phrase is in the api
474                                                                        {
475                                                                                $addit = $row['content'] != $content;   // only add if not identical
476                                                                        }
477                                                                        $row2 = $this->db->row(True);
478                                                                        if (!$row['in_api'] || $app_name=='common' || $row2)    // phrase is alread in the db
479                                                                        {
480                                                                                $addit = $content != ($row2 ? $row2['content'] : $row['content']);
481                                                                                if ($addit)     // if we want to add/update it ==> delete it
482                                                                                {
483                                                                                        $this->db->query($q="DELETE FROM phpgw_lang WHERE message_id='$message_id' AND lang='$lang' AND app_name='$app_name'",__LINE__,__FILE__);
484                                                                                }
485                                                                        }
486                                                                }
487                                                        }
488
489                                                        if ($addit || $upgrademethod == 'addonlynew' || $upgrademethod == 'dumpold')
490                                                        {
491                                                                if($message_id && $content)
492                                                                {
493                                                                        //echo "<br>adding - insert into phpgw_lang values ('$message_id','$app_name','$lang','$content')";
494                                                                        $result = $this->db->query("INSERT INTO phpgw_lang (message_id,app_name,lang,content) VALUES('$message_id','$app_name','$lang','$content')",__LINE__,__FILE__);
495                                                                        if ((int)$result <= 0)
496                                                                        {
497                                                                                echo "<br>Error inserting record: phpgw_lang values ('$message_id','$app_name','$lang','$content')";
498                                                                        }
499                                                                }
500                                                        }
501                                                }
502                                        }
503                                }
504                        }
505                        $this->db->transaction_commit();
506
507                        // update the ctimes of the installed langsfiles for the autoloading of the lang-files
508                        //
509                        $config =  CreateObject('phpgwapi.config.save_value');
510                        $config->save_value('lang_ctimes',$GLOBALS['phpgw_info']['server']['lang_ctimes'],'phpgwapi');
511                }
512
513                /*!
514                @function autolaod_changed_langfiles
515                @abstract re-loads all (!) langfiles if one langfile for the an app and the language of the user has changed
516                */
517                function autoload_changed_langfiles()
518                {
519                        //echo "<h1>check_langs()</h1>\n";
520                        if ($GLOBALS['phpgw_info']['server']['lang_ctimes'] && !is_array($GLOBALS['phpgw_info']['server']['lang_ctimes']))
521                        {
522                                $GLOBALS['phpgw_info']['server']['lang_ctimes'] = unserialize($GLOBALS['phpgw_info']['server']['lang_ctimes']);
523                        }
524                        //_debug_array($GLOBALS['phpgw_info']['server']['lang_ctimes']);
525
526                        $lang = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
527                        $apps = $GLOBALS['phpgw_info']['user']['apps'];
528                        $apps['phpgwapi'] = True;       // check the api too
529                        foreach($apps as $app => $data)
530                        {
531                                $fname = PHPGW_SERVER_ROOT . "/$app/setup/phpgw_$lang.lang";
532
533                                if (file_exists($fname))
534                                {
535                                        $ctime = filectime($fname);
536                                        /* This is done to avoid string offset error at least in php5 */
537                                        $tmp = $GLOBALS['phpgw_info']['server']['lang_ctimes'][$lang];
538                                        $ltime = (int)$tmp[$app];
539                                        unset($tmp);
540                                        //echo "checking lang='$lang', app='$app', ctime='$ctime', ltime='$ltime'<br>\n";
541
542                                        if ($ctime != $ltime)
543                                        {
544                                                // update all langs
545                                                $installed = $this->get_installed_langs();
546                                                //echo "<p>install_langs(".print_r($installed,True).")</p>\n";
547                                                $this->install_langs($installed ? array_keys($installed) : array());
548                                                break;
549                                        }
550                                }
551                        }
552                }
553
554                /* Following functions are called for app (un)install */
555
556                /*!
557                @function get_langs
558                @abstract return array of installed languages, e.g. array('de','en')
559                */
560                function get_langs($DEBUG=False)
561                {
562                        if($DEBUG)
563                        {
564                                echo '<br>get_langs(): checking db...' . "\n";
565                        }
566                        if (!$this->langs)
567                        {
568                                $this->get_installed_langs();
569                        }
570                        return $this->langs ? array_keys($this->langs) : array();
571                }
572
573                /*!
574                @function drop_langs
575                @abstract delete all lang entries for an application, return True if langs were found
576                @param $appname app_name whose translations you want to delete
577                */
578                function drop_langs($appname,$DEBUG=False)
579                {
580                        if($DEBUG)
581                        {
582                                echo '<br>drop_langs(): Working on: ' . $appname;
583                        }
584                        $this->db->query("SELECT COUNT(message_id) FROM phpgw_lang WHERE app_name='$appname'",__LINE__,__FILE__);
585                        $this->db->next_record();
586                        if($this->db->f(0))
587                        {
588                                $this->db->query("DELETE FROM phpgw_lang WHERE app_name='$appname'",__LINE__,__FILE__);
589                                return True;
590                        }
591                        return False;
592                }
593
594                /*!
595                @function add_langs
596                @abstract process an application's lang files, calling get_langs() to see what langs the admin installed already
597                @param $appname app_name of application to process
598                */
599                function add_langs($appname,$DEBUG=False,$force_langs=False)
600                {
601                        $langs = $this->get_langs($DEBUG);
602                        if(is_array($force_langs))
603                        {
604                                foreach($force_langs as $lang)
605                                {
606                                        if (!in_array($lang,$langs))
607                                        {
608                                                $langs[] = $lang;
609                                        }
610                                }
611                        }
612
613                        if($DEBUG)
614                        {
615                                echo '<br>add_langs(): chose these langs: ';
616                                _debug_array($langs);
617                        }
618
619                        $this->install_langs($langs,'addmissing',$appname);
620                }
621        }
Note: See TracBrowser for help on using the repository browser.